@@ 471-491 (lines=21) @@ | ||
468 | return $process->getPid(); |
|
469 | } |
|
470 | ||
471 | public function getChromeVersion() |
|
472 | { |
|
473 | if ($this->isWindows()) { |
|
474 | $cmd = 'reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96} | findstr /i pv'; |
|
475 | $match = '/REG_SZ[\s]+([0-9.]+)/is'; |
|
476 | } else { |
|
477 | $cmd = 'google-chrome --version'; |
|
478 | $match = '/Google Chrome ([0-9.]+)/is'; |
|
479 | } |
|
480 | ||
481 | $output = new BufferedOutput(); |
|
482 | ||
483 | $process = new Process($cmd, SeleniumSetup::$APP_ROOT_PATH, SeleniumSetup::$APP_PROCESS_ENV, null, null); |
|
484 | $process->run(function($type, $line) use ($output) { |
|
485 | $output->write($line); |
|
486 | }); |
|
487 | ||
488 | preg_match($match, $output->fetch(), $matches); |
|
489 | ||
490 | return isset($matches[1]) ? $matches[1] : null; |
|
491 | } |
|
492 | ||
493 | public function getFirefoxVersion() |
|
494 | { |
|
@@ 493-512 (lines=20) @@ | ||
490 | return isset($matches[1]) ? $matches[1] : null; |
|
491 | } |
|
492 | ||
493 | public function getFirefoxVersion() |
|
494 | { |
|
495 | if ($this->isWindows()) { |
|
496 | $cmd = 'reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox" | findstr /i CurrentVersion'; |
|
497 | $match = '/REG_SZ[\s]+([0-9.]+)/is'; |
|
498 | } else { |
|
499 | $cmd = 'firefox --version'; |
|
500 | $match = '/Mozilla Firefox ([0-9.]+)/is'; |
|
501 | } |
|
502 | $output = new BufferedOutput(); |
|
503 | ||
504 | $process = new Process($cmd, SeleniumSetup::$APP_ROOT_PATH, SeleniumSetup::$APP_PROCESS_ENV, null, null); |
|
505 | $process->run(function($type, $line) use ($output) { |
|
506 | $output->write($line); |
|
507 | }); |
|
508 | ||
509 | preg_match($match, $output->fetch(), $matches); |
|
510 | ||
511 | return isset($matches[1]) ? $matches[1] : null; |
|
512 | } |
|
513 | ||
514 | } |
|
515 |