学习目的:


  掌握WebDriver的高级应用

正式步骤:


# -*-  coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
import unittest
import os
import time
import traceback class WebdriverAPI(unittest.TestCase):
def setUp(self):
# 每个用例都执行,在单个用例运行前执行
#打开浏览器
self.driver = webdriver.Chrome() def tearDown(self):
#每个用例都执行,在单个用例运行后执行
#退出浏览器
self.driver.quit() def test_closeBrowserProcess(self):
url = 'https://www.baidu.com/'
self.driver.get(url)
returnCode = os.system("taskkill /F /im " + "chrome.exe")
if returnCode == 0:
print("chrome process over")
else:
print("chrome process over fail") if __name__ == '__main__':
unittest.main()

Python3 Selenium自动化web测试 ==> 第八节 WebDriver高级应用 -- 结束Windows中浏览器的进程的更多相关文章

  1. Python3 Selenium自动化web测试 ==> 第九节 WebDriver高级应用 -- 操作select 和 alert

    学习目的: 掌握页面常规元素的定位方法 场景: 网页正常的select元素下拉框常规方法和select专属方法 正式步骤: step1:常规思路select页面元素定位 处理HTML代码截图 # -* ...

  2. selenium高级应用 - 结束Windows中浏览器的进程

    结束Windows中浏览器的进程 #-*- coding:utf-8 #结束Windows中浏览器的进程 from selenium import webdriver import unittest ...

  3. Python3 Selenium自动化web测试 ==> 第一节 起始点之Python单元测试框架 unittest

    前置步骤 Python版本:3.6.4 selenium版本:3.11.0 >>> import selenium >>> help(selenium) IDE:P ...

  4. Python3 Selenium自动化web测试 ==> 第七节 WebDriver高级应用 -- 浮动框中,单击选择某个关键字选项

    学习目的: 了解WebDriver的高级应用 正式步骤: 测试Python3代码 # -*- coding:utf-8 -*- from selenium import webdriver from ...

  5. Python3 Selenium自动化web测试 ==> 第六节 WebDriver高级应用 -- 操作web页面的滚动条

    学习目的: 掌握页面元素定位以外的其他重要知识点. 正式步骤: 测试Python3代码 # -*- coding:utf-8 -*- from selenium import webdriver fr ...

  6. Python3 Selenium自动化web测试 ==> 第三节 常用WebDriver API使用示例上(24个API)

    前置步骤: 安装selenium,chrome驱动,Python3.6 学习目的: 常见API的使用 涉及的API: step1: 访问一个网址 step2: 网页的前进和后退 step3: 刷新当前 ...

  7. Python3 Selenium自动化web测试 ==> 第五节 WebDriver高级应用 -- 使用JavaScript操作页面元素

    学习目的: 中级水平技术提升 在WebDriver脚本代码中执行JS代码,可以解决某些 .click()方法无法生效等问题 正式步骤: Python3代码如下 # -*- coding:utf-8 - ...

  8. Python3 Selenium自动化web测试 ==> 第十一节 WebDriver高级应用 -- 显示等待 + 二次封装

    学习目的: 掌握显示等待 掌握二次封装 正式步骤: step1:显示等待的代码示例 # -*- coding:utf-8 -*- from selenium import webdriver from ...

  9. Python3 Selenium自动化web测试 ==> 第十节 WebDriver高级应用 -- xpath语法

    学习目的: xpath定位是针对常规定位方法中,最有效的定位方式. 场景: 页面元素的定位. 正式步骤: step1:常规属性 示例UI 示例UI相关HTML代码 相关代码示例: #通过id定位 dr ...

随机推荐

  1. 【bfs分层图 dp】hihocoder#1147 : 时空阵

    最短路径树上分层dp的一类套路吧 题目大意 幽香这几天学习了魔法,准备建造一个大型的时空传送阵. 幽香现在可以在幻想乡的n个地点建造一些传送门,如果她建造了从地点a与地点b之间的传送门,那么从a到b和 ...

  2. git 解决 error: failed to push some refs to 'https://github.com/xxxx.git'

    在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误 [root@foundation38 demo]# git push -u origin master Usern ...

  3. pandas.to_json&to_dict&from_json&from_dict解读

    pandas 中的to_dict 可以对DataFrame类型的数据进行转换 可以选择六种的转换类型,分别对应于参数 ‘dict’, ‘list’, ‘series’, ‘split’, ‘recor ...

  4. “景驰科技杯”2018年华南理工大学程序设计竞赛 G. Youhane as "Bang Riot"(斜率DP)

    题目链接:https://www.nowcoder.com/acm/contest/94/G 题意:中文题目,见链接 题解:设 sum[i] 为 a[i] 的前缀和,可得公式 dp[i] = min( ...

  5. 洛谷P1280 尼克的任务【线性dp】

    题目:https://www.luogu.org/problemnew/show/P1280 题意: 给定k个任务的开始时间和持续时间要求在n时间内完成.问如何安排工作使得休息时间最多. 思路: 用d ...

  6. Codeforces Round #590 (Div. 3) C. Pipes

    链接: https://codeforces.com/contest/1234/problem/C 题意: You are given a system of pipes. It consists o ...

  7. [Spring] Spring Data JPA

    Previouly we need to define a DAO interface and a DAO impl for 'Employee', it is not so reuseable, s ...

  8. mysql: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    https://www.cnblogs.com/jpfss/p/9734487.html (mysql.sock错误解决方案)

  9. BZOJ1070: [SCOI2007]修车(最小费用最大流,思维)

    Description 同一时刻有N位车主带着他们的爱车来到了汽车维修中心.维修中心共有M位技术人员,不同的技术人员对不同 的车进行维修所用的时间是不同的.现在需要安排这M位技术人员所维修的车及顺序, ...

  10. Yet Another Division Into Teams

    E. Yet Another Division Into Teams 首先要想明白一个东西,就是当一个小组达到六个人的时候,它一定可以拆分成两个更优的小组. 这个题可以用动态规划来写,用一个数组来保存 ...