简体   繁体   中英

open five firefox in same machine - selenium grid

I'm looking confirmation before proceeding parallel test, I try to run selenium test case on 5 firefox browser on same machine, right now it is create only single browser.

Below one is my node creation command.

 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 -> this only enough to make five firefox or I need to write thread class for activate five browser?

Add maxSession=5 parameter additionally.

maxInstance sets max number of instances of the same browser , but if your max number of instances ( no matter which browser ) is 1 ( maxSession=1 ), then you can't start 5 firefox instances even if you've set maxInstance=5 .

maxInstances and maxSession only not enough to open five browser, we need to write code for parallel test.

maxInstances=5,maxSession=5

If you use TestNg it would be much easier. Below one is my test suit file

  <?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>   

In above file I mention like run my class example.NewTest parallely with different test name. When run test suite file it will open five firefox in selenium grid node without session conflict.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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