区分不同的Selenium Grid节点

时间:2013-02-01 12:38:24

标签: networking selenium-grid

我现在处理以下问题:

我的Selenium Grid实例应该连接位于不同位置的少数节点,我想在每个位置运行每个测试。我怎样才能指出Selenium Grid应该从每个位置选择一个节点并在那里发送测试?我尝试操纵浏览器名称或平台(例如命名为firefox-pl / firefox-fr或windows-pl / windows-fr)但我总是收到以下异常:

     Selenium::WebDriver::Error::UnknownError:
   Error forwarding the new session cannot find

我发现这些值不可更改。

还有其他方法吗?我不想更改浏览器或其版本,因为这些测试的性质是比较不同位置的网络响应,不同的浏览器可以更改它。

3 个答案:

答案 0 :(得分:2)

我也遇到了同样的情况,我只想到了节点,并按照以下步骤进行操作。

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);". 

在节点中设置应用程序名称是selenium中的隐藏功能。现在只是测试和享受。

答案 1 :(得分:0)

听起来您正在寻求并行运行测试,testng是一个很好的工具,可以帮助您进行设置。看看以下链接

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

答案 2 :(得分:0)

启动节点并指定功能时,可以考虑设置maxInstances。此值控制可在该节点上打开的该浏览器的并发实例数。如果将其设置为1 - 您可以针对网格并行运行测试,但每个节点上一次只能打开一个浏览器。

  

java.exe -jar selenium-server.jar -role node -browser   “browserName =火狐,MAXINSTANCES = 1,平台= ANY,seleniumProtocol = webdriver的”