Last active
April 18, 2017 12:48
-
-
Save phpdave/53bced5608a093e6ed4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$javaProgramFileName="selenium-server-standalone"; | |
$isSeleniumAlreadyRunning=false; | |
exec("wmic process where name=\"java.exe\" get commandline",$output); | |
foreach($output as $line) | |
{ | |
if(strpos($line, $javaProgramFileName) !== FALSE) | |
{ | |
$isSeleniumAlreadyRunning=true; | |
break; | |
} | |
} | |
if(!$isSeleniumAlreadyRunning) | |
{ | |
//Execute in the background by sending output to NUL | |
exec("java -jar ".__DIR__."\selenium-server-standalone-2.47.1.jar > NUL"); | |
} | |
//Selenium is up an running lets use the PHP Selenium Driver | |
//Example: https://github.com/facebook/php-webdriver/blob/community/example.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment