繁体   English   中英

在同一台机器上打开五个Firefox-硒网格

[英]open five firefox in same machine - selenium grid

在进行并行测试之前,我正在寻找确认,我尝试在同一台计算机上的5个firefox浏览器上运行硒测试用例,现在它仅创建单个浏览器。

下面是我的节点创建命令。

 java -Dwebdriver.firefox.marionette="/u01/driver/geckodriver" -jar selenium-server-standalone-3.0.1.jar -role webdriver -hub http://192.168.1.106:4444/grid/register -port 5566 -host 192.168.1.40 -browser browserName=firefox,version=38.0.1,maxInstances=5,platform=LINUX

maxInstances = 5- >这仅足以使五个Firefox或我需要编写线程类来激活五个浏览器?

额外添加maxSession=5参数。

maxInstance设置同一浏览器的最大实例数,但是,如果您的最大实例数( 无论哪个浏览器 )为1( maxSession=1 ),那么即使设置了maxInstance=5 ,也无法启动5个Firefox实例。

maxInstances和maxSession仅不足以打开五个浏览器,我们需要编写代码进行并行测试。

MAXINSTANCES = 5,maxSession = 5

如果您使用TestNg ,它将容易得多。 下面是我的测试服文件

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
  <suite name="Suite" parallel="tests">

     <test name="FirefoxTestOne">
     <parameter name="browser" value="firefox" />
        <classes>
           <class name="example.NewTest" />
        </classes>
     </test>
     <test name="FirefoxTestTwo">
     <parameter name="browser" value="firefox" />
        <classes>
           <class name="example.NewTest" />
        </classes>
     </test> 
        <test name="FirefoxTestThree">
     <parameter name="browser" value="firefox" />
        <classes>
           <class name="example.NewTest" />
        </classes>
     </test> 
        <test name="FirefoxTestFour">
     <parameter name="browser" value="firefox" />
        <classes>
           <class name="example.NewTest" />
        </classes>
     </test> 
        <test name="FirefoxTestFive">
     <parameter name="browser" value="firefox" />
        <classes>
           <class name="example.NewTest" />
        </classes>
     </test> 

  </suite>   

在上面的文件中,我提到要使用不同的测试名称运行类example.NewTest并行。 运行测试套件文件时,它将在硒网格节点中打开五个Firefox,而不会发生会话冲突。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM