selenium Grid
grid原理图

安装java jdk 并配置好环境的条件下
1.本机启动hub ( win 7 64bit FF 28.0)
java -jar selenium-server-standalone-2.41.0.jar -role hub -maxSession 40 -port 4444

2.另外一台启动node (win 7 32bit ff 24.5.0),防火墙需要关闭
java -jar selenium-server-standalone-2.41.0.jar -role node \
-hub http://{grid_server}:4444/grid/register -port 5555 \
-firefoxProfileTemplate llinotes.profile -maxSession 20 \
-browser "browserName=firefox,version=28.0,platform=WINDOWS,maxInstances"
在远程机器显示 couldn't register this node,

将node输入命令改成如下:
java -jar selenium-server-standalone-2.41.0.jar -role webdriver \
-hub http://192.168.1.9:4444/grid/register -port 5555 \
-firefoxProfileTemplate llinotes.profile -maxSession 20 \
-browser "browserName=firefox,version=28.0,platform=WINDOWS,maxInstances"

register成功

run hub机器上的脚本
[Test]
public void Test()
{
DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities = DesiredCapabilities.Firefox(); capabilities.SetCapability(CapabilityType.BrowserName, "firefox"); capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows)); capabilities.SetCapability(CapabilityType.Version, "24.5.0"); driver = new RemoteWebDriver(new Uri("nodeUrl/wd/hub"), capabilities); baseURL = "https://www.google.com/"; verificationErrors = new StringBuilder(); driver.Navigate().GoToUrl(baseURL);
driver.FindElement(By.Id("lst-ib")).SendKeys("selenium");
driver.FindElement(By.Name("btnK")).Click();
}
可以打开Node FF浏览器并进行操作。Done
hub机器显示信息:

node机器显示:

接着又遇到一个问题:如果我要在不同的机器上运行hub上的测试,应该怎么做呢
我试着在另外一台node机器register node(记得关闭防火墙)
在hub机器添加如下代码,将nodeUrl改成其他机器上的ip,运行所有测试,按照测试顺序启动不同机器的浏览器
[Test]
public void Test()
{
DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities = DesiredCapabilities.Firefox(); capabilities.SetCapability(CapabilityType.BrowserName, "firefox"); capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows)); capabilities.SetCapability(CapabilityType.Version, "28.0"); driver = new RemoteWebDriver(new Uri("nodeUrl2/wd/hub"), capabilities); baseURL = "https://www.google.com/"; verificationErrors = new StringBuilder(); driver.Navigate().GoToUrl(baseURL);
driver.FindElement(By.Id("lst-ib")).SendKeys("selenium");
driver.FindElement(By.Name("btnK")).Click();
}
为了省事,我想把那些命令直接用cmd批处理来执行
新建.txt文件,输入如下内容:
cd selenium-server-standalone-2.41.0.jar路径
java -jar selenium-server-standalone-2.41.0.jar -role hub -maxSession 40 -port 4444
另存为hubstart.bat,双击就能直接运行这个命令启动hub
selenium Grid的更多相关文章
- 搭建selenium grid简单配置
1.使用selenium提供的服务端独立jar包 :服务端.客户端都是运行于java7环境. 2.启动hub: hub配置文件如下: Java -jar selenium-server-standal ...
- Robot Framework + Selenium2Library环境下,结合Selenium Grid实施分布式自动化测试
最近一段时间,公司在推行自动化测试流程,本人有幸参与了自定义通用控件的关键字封装和脚本辅助编写.数据驱动管理.测试用例执行管理等一系列工具软件的研发工作,积累了一些经验,在此与大家做一下分享,也算是做 ...
- Selenium Grid 学习笔记
Selenium Grid 学习笔记http://www.docin.com/p-765680298.html
- 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(一)
selenium grid Quick Start selenium-grid是用于设计帮助我们进行分布式测试的工具,其整个结构是由一个hub节点和若干个代理节点组成.hub用来管理各个代理节点的注册 ...
- selenium grid java 资料
Grid TestNG: 使用Selenium Grid改进Web应用程序的测试: http://www.ithov.com/server/117464.shtml
- Selenium Grid跨浏览器-兼容性测试
Selenium Grid跨浏览器-兼容性测试 这里有两台机子,打算这样演示: 一台机子启动一个作为主点节的hub 和 一个作为次节点的hub(系统windows 浏览器为ie) ip为:192.16 ...
- selenium grid的使用与配置
一.selenium grid的组成与作用:由一个集线器hub和多个客户机node组成,如果你的程序需要在不用的浏览器,不同的操作系统上测试,而且比较多的case需要多线程远程执行,那么一个比较好的测 ...
- 转:Selenium Grid深入学习
应网友要求写一个用Selenium Grid控制多系统多浏览器并行执行test case的例子. 因为我这里有两台机子,我打算这样演示: 一台机子启动一个作为主点节的hub 和 一个作为次节点的hub ...
随机推荐
- 滤镜简单demo(转,供参考)
NSURL *iamgeUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"default" ...
- why you write code so slow.
今天我们要写一个日历表,用以存储所有的节假日. 虽然这个表设计的并不是很妙.但是将就着继续了. 让小弟把该表数据初始化3-5年的,结果一上午还没有出来,着急了,自己写了一个初始化的工具. 分享出来. ...
- 动态内存 this指针
#include <iostream> #include <string> class Company { public: Company(std::string theNam ...
- WEB开发者必备的7个JavaScript函数
防止高频调用的debounce函数 这个 debounce 函数对于那些执行事件驱动的任务来说是必不可少的提高性能的函数.如果你在使用scroll, resize, key*等事件触发执行任务时不使用 ...
- 使用Web代理实现Ajax跨域
目前的工作项目分为前端和后台,双方事先约定接口,之后独立开发.后台每天开发完后在测试服务器上部署,前端连接测试服务器进行数据交互.前端和后台分开的好处是代码不用混在一个工程里一起build,互不干涉. ...
- POJ 1850 Code(组合数)
http://poj.org/problem?id=1850 题意 :给定字符串,系统是用字符串组成的,字符串是按字典序排的.编码系统有三条规则,1这些的单词的长度是由小到大的,2相同长度的按字母在字 ...
- C语言不是C++的严格子集
C语言是C++的子集吗?C++是在C语言的基础上扩展而来并包含所有C语言的内容吗? 回复: 从实用角度讲,C++属于C语言的一个超集,基本上兼容ANSI C.但是从编译角度上讲,C语言的有些特性在C+ ...
- fork、vfork、clone区别
在Linux中主要提供了fork.vfork.clone三个进程创建方法. 问题 在linux源码中这三个调用的执行过程是执行fork(),vfork(),clone()时,通过一个系统调用表映射到s ...
- linux的终端,网络虚拟终端,伪终端(转)
blog.csdn.net/todd911/article/details/8025540 Linux上许多网络服务应用,如l2tp.pptp.telnet,都用到了伪终端.有朋友在问这方面的概念 ...
- R语言笔记:快速入门
1.简单会话 > x<-c(1,2,4) > x [1] 1 2 4 R语言的标准赋值运算符是<-.也可以用=,不过不建议用它,有些情况会失灵.其中c表示连接(concaten ...