Distinguish different Selenium Grid node

后端 未结 3 1259
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 03:14

I\'m dealing right now with following problem:

My Selenium Grid instance should connect few nodes which are in different locations and I would like to run each test

相关标签:
3条回答
  • 2021-01-16 03:42

    I also come across same situation and I just think of the node and did as follows.

    In one folder 
      1.place the selenium-server-standalone-2.44.0.jar file and set the environment variable as well.
    
      2.create the hub: Type "java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4444" in the text file and save it as Hub.bat and run it
    
      3.Create the node: Type "java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://(IP Address of the parent machine which has above two files):4444/grid/register -port 8882 -browser "browserName=firefox,maxInstances=1,applicationName=two"" and put this file in another machine and run this. Now this node will be connected with the hub.
    
      4.If you want particular test should run in one node(client machine) then you can just specify the applicationName in the node as like in above point(3) and in setting the capabilities in the test class file as "desiredCapability.setCapability("applicationName", nodeName);". 
    

    setting the application name in the node is hidden features in selenium. Now just test and enjoy.

    0 讨论(0)
  • 2021-01-16 03:45

    Sounds like you're looking to run tests in parallel, testng is a great tool to help you setup. Take a look at the following link

    http://www.deepshiftlabs.com/sel_blog/?p=1932&lang=en-us

    0 讨论(0)
  • 2021-01-16 04:03

    When you start the node and you are specifying the capabilities, you might consider setting maxInstances. This value controls the number of concurrent instances of that browser which can be opened on that node. If you set this to 1 - you can run tests in parallel against the Grid but only one browser will open at a time on each node.

    java.exe -jar selenium-server.jar -role node -browser "browserName=firefox,maxInstances=1,platform=ANY,seleniumProtocol=WebDriver"

    0 讨论(0)
提交回复
热议问题