2013-02-01 55 views
1

我处理现在有以下问题:区分不同的硒网格节点

我的硒网格实例应该连接的是在不同地点几个节点,我想运行每个位置每个测试。我如何指向Selenium Grid,它应该从每个位置选择一个节点并在那里发送测试?我试图操纵浏览器的名称或平台(例如将其命名为火狐-PL /火狐-FR或Windows-PL /窗口-FR),但我收到的总是以下情况例外:

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

,我发现,这些值不可改变。

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

回答

0

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

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

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