Reputation: 553
I want to check whether Selenium Hub or Node is running on a particular port (ex:- 5555). I already have the code to check whether a particular port is free or not. But I am not sure how to find out the application using the port.
if (Port is free)
i=1
else if (Port is used as Selenium Hub)
i=2
else if (Port is used as Selenium Node)
i=3
else if (Port is used by apps other than Selenium)
i=4
else
i=5
Please let me know if this can be done using java.
Upvotes: 0
Views: 4549
Reputation: 695
You could try to access a know http url to the node/server, if it responds with a non error (lets sey an 200 OK) you can assume it's a selenium running there, for example do a httpclient get to:
http://<host>:<port>/wd/hub/static/resource/hub.html
If it does a 404 it's not selenium.
Upvotes: 4