代码和selenium driver相同 只是 启动环境方式不同。至少启动一个hub 一个 node 。如需要多个,可以使用端口进行区分。

  1. java -jar selenium-server-standalone-x.xx.x.jar -role node -port 5555
  2. java -jar selenium-server-standalone-x.xx.x.jar -role node -port 5556
  3. java -jar selenium-server-standalone-x.xx.x.jar -role node -port 5557
  4. 代码如下

WebDriver wd = new RemoteDriver("http://localhost:4444/wd/hub", aDesiredcap);

//test01: 只匹配Windows下的ie来执行此用例,版本不限;多个版本匹配成功时优先级暂未知

  1. DesiredCapabilities aDesiredcap = DesiredCapabilities();
  2. aDesiredcap.setBrowserName("internet explorer")
  3. aDesiredcap.setVersion("")
  4. aDesiredcap.setPlatform(Platform.WINDOWS)
  5. WebDriver wd = new RemoteDriver("http://localhost:4444/wd/hub", aDesiredcap);
  6. wd.doSomething()
  7. //test02: 只匹配linix下的firefox的版本为22的浏览器执行用例;
  8. DesiredCapabilities aDesiredcap = DesiredCapabilities("firefox", "22", Platform.LINUX);
  9. WebDriver wd = new RemoteDriver("http://localhost:4444/wd/hub", aDesiredcap);
  10. wd.doSomething()
  11. //test03: 只匹配MAC下的safari浏览器执行,版本不限
  12. DesiredCapabilities aDesiredcap = DesiredCapabilities.safari();
  13. aDesiredcap.setPlatform(Platform.MAC)
  14. WebDriver wd = new RemoteDriver("http://localhost:4444/wd/hub", aDesiredcap);
  15. wd.doSomething()
  16. //test04: 只匹配chrome浏览器,任意平台,任意版本
  17. DesiredCapabilities aDesiredcap = DesiredCapabilities.chrome();
  18. aDesiredcap.setPlatform(Platform.ANY)
  19. WebDriver wd = new RemoteDriver("http://localhost:4444/wd/hub", aDesiredcap);
  20. wd.doSomething()

selenium grid 使用方法的更多相关文章

  1. 搭建selenium grid简单配置

    1.使用selenium提供的服务端独立jar包 :服务端.客户端都是运行于java7环境. 2.启动hub: hub配置文件如下: Java -jar selenium-server-standal ...

  2. Robot Framework + Selenium2Library环境下,结合Selenium Grid实施分布式自动化测试

    最近一段时间,公司在推行自动化测试流程,本人有幸参与了自定义通用控件的关键字封装和脚本辅助编写.数据驱动管理.测试用例执行管理等一系列工具软件的研发工作,积累了一些经验,在此与大家做一下分享,也算是做 ...

  3. Selenium Grid跨浏览器-兼容性测试

    Selenium Grid跨浏览器-兼容性测试 这里有两台机子,打算这样演示: 一台机子启动一个作为主点节的hub 和 一个作为次节点的hub(系统windows 浏览器为ie) ip为:192.16 ...

  4. 转:Selenium Grid深入学习

    应网友要求写一个用Selenium Grid控制多系统多浏览器并行执行test case的例子. 因为我这里有两台机子,我打算这样演示: 一台机子启动一个作为主点节的hub 和 一个作为次节点的hub ...

  5. Selenium Grid分布式测试入门详解

    本文对Selenium Grid进行了完整的介绍,从环境准备到使用Selenium Grid进行一次完整的多节点分布式测试. 运行环境为Windows 10,Selenium版本为 3.5.0,Chr ...

  6. Selenium Grid和IE /Firefox各种填坑

    使用selenium grid的步骤 1.确保hub和node都安装并且配置好了java jdk. 2.在hub上运行以下命令. java -jar C:\Software\selenium\sele ...

  7. 配置selenium grid

    本文对Selenium Grid进行了完整的介绍,从环境准备到使用Selenium Grid进行一次完整的多节点分布式测试. 运行环境为Windows 10,Selenium版本为 3.5.0,Chr ...

  8. .NET自动化测试工具:Selenium Grid

    在生产环境,QA会同时跑几十个上百个的test case.如果用单机串行的话,是一件非常耗时的事情,估计比手点快不了多少.使用并行方案的话,有两种方法,一个是自己写并行框架,一个是用现成的Seleni ...

  9. [Selenium] Grid 介绍

    Selenium Grid 支持分布式测试,使测试人员可在分布式环境中进行测试 一般而言,在面临以下情况时可考虑使用Selenium Grid : 1.测试多个浏览器或单个浏览器多个版本,或测试不同操 ...

随机推荐

  1. kuangbin专题十二 HDU1069 Monkey and Banana (dp)

    Monkey and Banana Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  2. APP设计规范

    设计师DPI指南 本指南旨在为初级到中级设计人员提供“入门”或介绍性阅读,他们希望从一开始就学习或获得有关跨DPI和跨平台设计的更多知识. 尽可能少的数学和没有不可解析的图形,只需在简短的部分中订购直 ...

  3. Solr学习笔记(3) —— SolrJ管理索引库&集群

    一.什么是SolrJ solrj是访问Solr服务的java客户端,提供索引和搜索的请求方法,SolrJ通常嵌入在业务系统中,通过SolrJ的API接口操作Solr服务,如下图: 二.SolrJ的基本 ...

  4. Luogu P1608 路径统计 最短路计数

    颓了...重边导致我乖乖用邻接矩阵.... 好吧就是个最短路计数....如果更新时d[v]==d[u]+w[i],就可以接起来,把两个加在一起.. 如果d[v]>d[u]+w[i],那么c[v] ...

  5. Diophantus of Alexandria

    Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first ma ...

  6. Django ORM 字段合集

    AutoField(Field) - int自增列,必须填入参数 primary_key=True BigAutoField(AutoField) - bigint自增列,必须填入参数 primary ...

  7. Nand Flash 基础

    1. 根据物理结构上的区别,Nand Flash主要分为: SLC(Single Level Cell): 单层式存储 MLC(Multi Level Cell): 多层式存储 TLC(Triple ...

  8. sql server 字符串转table

    -- ============================================= -- Author: gengc -- Create date: <2012-12-29> ...

  9. spring boot 启动时运行代码(2)ApplicationListener

    项目概览: StepExecutor: @Component @Slf4j public class StepExecutor implements Runnable { @Autowired pri ...

  10. tcp头和ip头 图文简介和简要说明

    https://blog.csdn.net/soullsj/article/details/80304124