Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium 2 Grid - Knowing which node your test is using

Is it possible to know which node the selenium grid hub assigned to your test? My tests need to talk to other services on the node machine in order to perform configurations which are not supported by selenium.

Mark

like image 623
Mark Micallef Avatar asked Aug 01 '11 12:08

Mark Micallef


People also ask

How many nodes does a Selenium Grid have?

But Selenium Grid can have any number of nodes. So you can have 200 nodes, and that means you have 200 driver.exe's and 200 browser windows running all at once.

How can I tell if Selenium node is running?

To double-check if the hub is up and running, you can simply type in http://localhost:4444/grid/console in your web browser of choice. Clicking on the View Config link pulls up a detailed configuration window with data that we succeeded in launching a Selenium hub.

Which of the following is used for node that your test will run against?

RemoteWebDriver is used to set which node (or machine) that our test will run against.

What is node in Selenium grid?

A Selenium Grid has only one Hub and it is launched on a single machine once. Node − Nodes are the Selenium instances that are attached to the Hub which execute the tests. There can be one or more nodes in a grid which can be of any OS and can contain any of the Selenium supported browsers.


1 Answers

Generally you shouldn't rely on knowing what machine your test is running on. Grid 2 provides a series of callback listeners that you could implement to provide machine configuration. But, if you really want to see what node a test is running on, you could use one of the API calls. Both endpoints can be found on the hub:

http://localhost:4444/grid/api/proxy

http://localhost:4444/grid/api/testsession

Neither are documented yet. But if you view the source, it's straightforward to see how they work. You want to look at the ProxyStatusServlet and TestSessionStatusServlet.

like image 63
nirvdrum Avatar answered Sep 19 '22 06:09

nirvdrum