1

我现在正在处理以下问题:

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

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

我发现这些值是不可改变的。

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

4

3 回答 3

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 中的隐藏功能。现在只需测试和享受。

于 2015-03-09T12:07:11.207 回答
0

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

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

于 2013-06-26T10:13:34.687 回答
0

听起来您希望并行运行测试,testng 是帮助您设置的好工具。看看下面的链接

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

于 2013-02-02T19:11:25.310 回答