Grid Selenium
python selenium-9 grid模式
grid是进行分布式测试的工具,由一个hub主节点和若干个node代理节点组成
1.下载Selenium Standalone Server
下载地址:https://www.seleniumhq.org/download/
2.启动hub和节点
#hub默认端口是4444,node默认端口是5555
java -jar selenium-server-standalone-3.141.59.jar -role hub
#本机注册节点
java -jar selenium-server-standalone-3.141.59.jar -role node
#本机指定端口注册节点
java -jar selenium-server-standalone-3.141.59.jar -role node -port 5556
#远程机器注册节点
java -jar selenium-server-standalone-3.141.59.jar -role node -port 5557 -hub http://192.168.63.143:4444/grid/register

节点注册地址: http://192.168.63.143:4444/grid/register/
hub管理地址: http://192.168.63.143:4444/grid/console
3.查看后台http://192.168.63.143:4444/grid/console

4.实例1:编写自动化测试脚本
from selenium.webdriver import Remote
driver = Remote(command_executor="http://127.0.0.1:4444/wd/hub",
desired_capabilities={'platform':'ANY',
'browserName':'chrome',
'version':'',
'javascriptEnabled':True})
driver.get("http://www.baidu.com")
driver.find_element_by_xpath("//input[@id='kw' and @class='s_ipt']").send_keys("hello")
driver.find_element_by_xpath("//input[@value='百度一下' and @id='su']").click()
driver.quit()
修改脚本以在不同的浏览器上运行
from selenium.webdriver import Remote
from time import sleep
lists={'http://192.168.63.143:4444/wd/hub':'chrome',
'http://192.168.63.143:5555/wd/hub':'firefox'}
for host,browser in lists.items():
print(host,browser)
driver = Remote(command_executor=host,
desired_capabilities={'browserName': browser,
'platform': 'ANY',
'version':'',
'javascriptEnabled':True
}
)
driver.get("http://www.baidu.com")
driver.find_element_by_xpath("//input[@id='kw' and @class='s_ipt']").send_keys(browser)
driver.find_element_by_xpath("//input[@value='百度一下' and @id='su']").click()
sleep(3)
result_text = driver.find_element_by_xpath("//span[@class='nums_text']").text
assert "百度为您找到相关结果约" in result_text
driver.quit()
5.浏览器内核
浏览器最重要或者最核心的部分是Rendering Engine,即渲染引擎,习惯成为渲染引擎。所谓的浏览器内核,决定了浏览器如何显示网页的内容以及页面的格式信息。
| 内核 | 介绍 |
|---|---|
| TridentIE内核 | 基于Mosaic代码基础上修改而来,从IE4开始开始一直沿用到IE11,是一款开放的内核,其接口内核设计成熟,国内早期浏览器都是基于该内核。如遨游,世界之窗,360安全浏览器 |
| Gecko火狐内核 | 代码完全公开,可开发程度很高 |
| Presto 欧朋内核 | 在欧朋7开始使用,自欧朋12.17已被废弃,开始采用谷歌的Blink内核。 |
| Webkit Safari内核 | 是苹果公司自己的内核。谷歌也曾采用webkit打造Chrome浏览器。国内的浏览器也采用了这一内核,如遨游3,搜狗告诉浏览器、360极速浏览器。 |
| Blink | 谷歌和欧朋开发的浏览器排版引擎,该引擎是Webkit中WebCore组件的一个分支,并且在Chrome(28以后)、欧朋(15以后)和Yandex浏览器中使用 |
Grid Selenium的更多相关文章
- Webdriver - Selenium Grid Configuration
Grid parameter: role = <hub|node> (default is no grid, just run an RC/webdriver server). When ...
- Selenium Grid Configuration
Start Hub and Node with Json config 1. Start Hub with json config file title HubWebDriver java -jar ...
- Selenium Grid 运行报错 Exception thrown in Navigator.Start first time ->Error forwarding the new session Empty pool of VM for setup Capabilities
Selenium Grid 运行报错 : Exception thrown in Navigator.Start first time ->Error forwarding the new se ...
- selenium grid 搭建
hub端 Step1: 下载 selenium-server-standalone-x.xx.x.jar我下载的是:selenium-server-standalone-2.44.0.jar下载地址: ...
- selenium grid的使用与配置
一.selenium grid的组成与作用:由一个集线器hub和多个客户机node组成,如果你的程序需要在不用的浏览器,不同的操作系统上测试,而且比较多的case需要多线程远程执行,那么一个比较好的测 ...
- Selenium 15: How to Run Parallel Tests Using Selenium Grid and JUnit
In this post, I will give two techniques and describe how to run your selenium tests in parallel by ...
- Selenium Grid的原理、配置与使用(转)
Selenium GridSelenium Grid在前面介绍Selenium的时候说过它有三大组件,Selenium Grid就是其中之一而作用就是分布式执行测试.讲分布式之前还是要说说UI自动化的 ...
- Selenium索引
Common Selenium各种工具比较 Selenium firefox 版本问题 Selenium IDE Selenium IDE整理 WebDriver Java 版本 Selenium开始 ...
- 转:selenium 并行启动多个浏览器
https://github.com/fool2fish/selenium-doc/blob/master/official-site/selenium-grid.md Selenium Grid 快 ...
随机推荐
- python学习之老男孩python全栈第九期_数据库day001知识点总结 —— MySQL操作数据库以及数据表、基本数据类型、基本增删改查、外键定义以及创建
一. 学习SQL语句规则以及外键 1. 操作文件夹 create database db2; 创建文件夹 create database db2 default charset utf8; 创建文件夹 ...
- flex自适应宽度显示省略号
text-overflow:ellipsis文本溢出显示省略号,一般的搭配用法如下: div{ text-overflow:ellipsis; overflow:hidden; white-space ...
- 在MyBatis中查询数据、涉及多参数的数据访问操作、插入数据时获取数据自增长的id、关联表查询操作、动态SQL、关于配置MyBatis映射没有代码提示的解决方案
1. 单元测试 在单元测试中,每个测试方法都需要执行相同的前置代码和后置代码,则可以自定义2个方法,分别在这2个方法中执行前置代码和后置代码,并为这2个方法添加@Before和@After注解,然后, ...
- JavaScript之Array
JavaScript是一门非常灵活的动态语言,涵盖的内容也挺多,<JavaScript高级程序设计>看了也有两遍,但是在实际开发的时候,还是有很多东西记不清,然后还得去翻书,特别是一些Ar ...
- android studio 加载libs
eclipse 项目转 android studio libs 不能加载 导致不能导入 记录下:libs 放在和src 同路径 dependencies:增加 compile files('libs ...
- vip会员统计表 (vip等级是灵活配置的 非写死1是金卡用户 2是什么 等)
一个非常常见的报表,分析会员组成比例 以及最新增长情况 和上月同期会员增长情况. 比较特殊一点的是 报表中的 普通会员 和 金卡会员 临时会员 银卡会员 等列 都是根据会员等级配置表动态生成的(即 ...
- SSH安全
新建用户,设置密码 useradd eason passwd eason 不允许root直接登陆 修改配置文件 vi /etc/ssh/sshd_config 禁止root登录 查找“#PermitR ...
- SQL Server ->> 调用系统内建扩展存储过程"master.dbo.xp_delete_file"删除过期备份文件
DECLARE @oldDate DATETIME SET @oldDate = GETDATE()-30 EXECUTE MASTER.dbo.xp_delete_file 0, N'D:\back ...
- Breathing During Sleep
TPO24-2 Breathing During Sleep Of all the physiological differences in human sleep compared with wak ...
- IHttpActionResult不识别解决办法
使用ASP.NET Web API构造基于restful风格web services,IHttpActionResult是一个很好的http结果返回接口.然而发现在vs2012开发环境中,System ...