Selenium 2 Grid - Knowing which node your test is using

Mark Micallef picture Mark Micallef · Aug 1, 2011 · Viewed 7.4k times · Source

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

Answer

nirvdrum picture nirvdrum · Aug 1, 2011

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.