How to check whether Selenium Server is running How to check whether Selenium Server is running selenium selenium

How to check whether Selenium Server is running


By default Selenium server accepts commands on localhost port 4444

So you could do this:

<?php$selenium_running = false;$fp = @fsockopen('localhost', 4444);if ($fp !== false) {    $selenium_running = true;    fclose($fp);}var_dump($selenium_running);

I dont personally like using @, but fsockopen insists on throwing a PHP notice, when the connection fails. Having this warning in output or even in log file is just annoying.