From 2687519ca7dd020ddb8ac00b89680bc8611a6cb6 Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Tue, 30 Apr 2019 15:32:08 +0200 Subject: [PATCH] Adjust ChromeDriver command to beta releases --- src/Console/ChromeDriverCommand.php | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Console/ChromeDriverCommand.php b/src/Console/ChromeDriverCommand.php index 76629ae99..f0357c143 100644 --- a/src/Console/ChromeDriverCommand.php +++ b/src/Console/ChromeDriverCommand.php @@ -26,11 +26,11 @@ class ChromeDriverCommand extends Command protected $description = 'Install the ChromeDriver binary'; /** - * URL to the index page. + * URL to the home page. * * @var string */ - protected $indexUrl = 'https://chromedriver.storage.googleapis.com'; + protected $homeUrl = 'http://chromedriver.chromium.org/home'; /** * URL to the latest release version. @@ -136,18 +136,18 @@ protected function version() { $version = $this->argument('version'); - if ($version) { - if (! ctype_digit($version)) { - return $version; - } + if (! $version) { + return $this->latestVersion(); + } + + if (! ctype_digit($version)) { + return $version; + } - $version = (int) $version; + $version = (int) $version; - if ($version < 70) { - return $this->legacyVersions[$version]; - } - } else { - $version = $this->latestChromeVersion(); + if ($version < 70) { + return $this->legacyVersions[$version]; } return trim(file_get_contents( @@ -156,17 +156,17 @@ protected function version() } /** - * Get the latest major Chrome version. + * Get the latest stable ChromeDriver version. * - * @return int + * @return string */ - protected function latestChromeVersion() + protected function latestVersion() { - $index = file_get_contents($this->indexUrl); + $home = file_get_contents($this->homeUrl); - preg_match('#.*LATEST_RELEASE_(\d+)#', $index, $matches); + preg_match('/Latest stable release:.*?\?path=([\d.]+)/', $home, $matches); - return (int) $matches[1]; + return $matches[1]; } /**