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 ...
随机推荐
- (转)inux Read系统调用
转载网址:http://my.oschina.net/haomcu/blog/468656 1. 什么是系统调用 2. read系统调用在内核空间的处理层次模型 3. 相关的内核数据结构 4. rea ...
- CQRS学习——集成ASP.NET Identity[其五]
[其实和Cqrs没啥关系] 缘由 其实没啥原因,只是觉得以前写了不知多少遍的用户登录复用性太差,实现的功能也不多. 依赖的Nuget包 简单登陆 就简单登陆而言,只需要实现如下接口/抽象类: Stor ...
- ABC: Always Be Coding——程序员面试必
本文作者@guitardave24 ">David Byttow 是一名程序员,曾在 Google 和 Square 等公司工作过. 在正文之前,先让我们回答几个简单的问题:第一,你面 ...
- highcharts 切换
<!doctype html> <html lang="en"> <head> <script type="text/javas ...
- window下编译ffmpeg 比较简单
网上关于编译ffmpeg的帖子很多,我也尝试了很多次,但是很多都过不了,一部分原因是版本问题,还有就是有的路劲没说的太明白导致的,经过一天的摸索,最终编译好了,下面把编译方式写下来,希望对看到帖子的人 ...
- 【转】win7如何设置共享目录,并且访问不需要输入用户名和密码。
1.打开guest帐号,guest帐号默认情况下是不启用的 进入控制面板->用户帐户->管理其他帐户->激活Gust用户 2,右击共享目录,属性->共享->共享-> ...
- Source Insight的应用技巧、宏功能
目录 1 简介... 5 2 搭建我们的SI环境... 5 2.1 搭建步骤... 5 2.2 说明... 6 3 应用技巧... 6 3.1 初级应用技巧... 6 3.1.1 解决字体不等宽与对齐 ...
- QTreeView只显示指定驱动器及其目录,隐藏所有兄弟节点
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setup ...
- 屏蔽QQ聊天对话框中的广告
原文地址: 怎么在QQ聊天对话框中屏蔽广告_百度经验 http://jingyan.baidu.com/article/48a42057ca12c1a924250402.html QQ已经成为 ...
- Git教程之撤销修改(7)
自然,你是不会犯错的.不过现在是凌晨两点,你正在赶一份工作报告,你在readme.txt中添加了一行: