Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phpdave/53bced5608a093e6ed4b to your computer and use it in GitHub Desktop.
Save phpdave/53bced5608a093e6ed4b to your computer and use it in GitHub Desktop.
<?
$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