2

I recently ran into an issue where someone registered a new Selenium node with our hub, but the new node was not configured the same as the other nodes. It occurred to me that just anyone could add a misconfigured node and completely ruin the integrity of our test results without realizing it. For instance, maybe their node reports that Chrome is available, but the path to chromedriver.exe is incorrect.

Is it possible to remotely shut down a Selenium grid node? For example, can I invoke a command on the hub which triggers a shutdown signal to be sent to all the nodes, or--better yet--can I just send a command directly to the unwanted node?

Note that I do not have access to the machine that is running the node, so I cannot simply kill the process from the command-line.

2

A call like the following example will terminate the node in Selenium 2.x:

http://node42.example.com:5555/selenium-server/driver/?cmd=shutDownSeleniumServer

After the node shuts down, the hub console will continue to show the now-defunct node, but after a while, the grid automatically cleans up and deregisters the node.

Update 2019-01-23 - although there is an alternate command shown below which should work for Selenium 2.x and 3.x, this feature is not enabled by default due to the obvious security implications and may be removed entirely, if it hasn't been already.

http://node42.example.com:4444/extra/LifecycleServlet?action=shutdown

Personally, I think if Selenium allows arbitrary nodes to connect without authentication, then allowing arbitrary people to terminate the nodes remotely without authentication is no worse, but the lack of such a capability is worse because you cannot kick off any inadvertently misconfigured nodes that are breaking your Selenium Grid.

  • would you mind sharing the documentation where you found that command? Also, its not working for me, I get java.io.IOException: org.openqa.grid.common.exception.GridException: Session – chitzui Jan 23 at 14:35
  • Unfortunately, I wrote that more than 2 years ago and don't recall where I found it. I might have found it by digging through the source code. Sorry to hear it is not working for you; it's possible something has changed in the past 2.5 years. Silly question, but did you double-check that your host and port are correct and the node is up in your Selenium Grid dashboard? – rob Jan 23 at 15:07
  • Yeah, okay, please always include the documentation or source where you found stuff when answering questions in future. Thank you :) – chitzui Jan 23 at 15:49
  • I can confidently tell you that I did not find it to be a documented feature, and including a link to the source code would not have helped 2+ years later because the link would now be broken (which happened to another Selenium answer I posted with a link to source code). However, I did google for shutDownSeleniumServer and updated my answer. Unfortunately, if you need to kick off a rogue node like I did when I originally researched this, there is a good chance you are out of luck because the remote shutdown feature is not enabled by default in Selenium 3, and is/was planned for removal. – rob Jan 24 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.