@@ -26,11 +26,11 @@ class ChromeDriverCommand extends Command
2626 protected $ description = 'Install the ChromeDriver binary ' ;
2727
2828 /**
29- * URL to the index page.
29+ * URL to the home page.
3030 *
3131 * @var string
3232 */
33- protected $ indexUrl = 'https ://chromedriver.storage.googleapis.com ' ;
33+ protected $ homeUrl = 'http ://chromedriver.chromium.org/home ' ;
3434
3535 /**
3636 * URL to the latest release version.
@@ -136,18 +136,18 @@ protected function version()
136136 {
137137 $ version = $ this ->argument ('version ' );
138138
139- if ($ version ) {
140- if (! ctype_digit ($ version )) {
141- return $ version ;
142- }
139+ if (! $ version ) {
140+ return $ this ->latestVersion ();
141+ }
142+
143+ if (! ctype_digit ($ version )) {
144+ return $ version ;
145+ }
143146
144- $ version = (int ) $ version ;
147+ $ version = (int ) $ version ;
145148
146- if ($ version < 70 ) {
147- return $ this ->legacyVersions [$ version ];
148- }
149- } else {
150- $ version = $ this ->latestChromeVersion ();
149+ if ($ version < 70 ) {
150+ return $ this ->legacyVersions [$ version ];
151151 }
152152
153153 return trim (file_get_contents (
@@ -156,17 +156,17 @@ protected function version()
156156 }
157157
158158 /**
159- * Get the latest major Chrome version.
159+ * Get the latest stable ChromeDriver version.
160160 *
161- * @return int
161+ * @return string
162162 */
163- protected function latestChromeVersion ()
163+ protected function latestVersion ()
164164 {
165- $ index = file_get_contents ($ this ->indexUrl );
165+ $ home = file_get_contents ($ this ->homeUrl );
166166
167- preg_match ('#.*<Key>LATEST_RELEASE_(\d+)</Key># ' , $ index , $ matches );
167+ preg_match ('/Latest stable release:.*?\?path=([\d.]+)/ ' , $ home , $ matches );
168168
169- return ( int ) $ matches [1 ];
169+ return $ matches [1 ];
170170 }
171171
172172 /**
0 commit comments