区分不同的Selenium Grid节点 [英] Distinguish different Selenium Grid node

查看:60
本文介绍了区分不同的Selenium Grid节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm dealing right now with following problem:

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

My Selenium Grid instance should connect few nodes which are in different locations and I would like to run each test in every location. How can I point to Selenium Grid that it should choose one node from each location and send test there? I tried manipulating browser name or platforms (ex. naming it firefox-pl/firefox-fr or windows-pl/windows-fr) but I received always following exception:

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

我发现这些值是不可更改的.

and I found out that those values are not changeable.

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

Is there any other method to do it? I would not like to change browser or its version, because nature of those tests is to compare network responses on different locations and different browsers can change it.

推荐答案

我也遇到了同样的情况,就想到了node,做了如下操作.

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

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

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

这篇关于区分不同的Selenium Grid节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆