Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 4fb525b

Browse files
RobRimmerOndraM
authored andcommitted
Change variable name defining path to ChromeDriver executable
1. Why is this change necessary? Current environment variable in ChromeDriver.php uses '.', whilst valid according to the specification, this will not work using a bash shell (probably the most commonly used) 2. How does it address the issue? '.' replaced with '_'. This is usable in bash (including cygwin) Original code still there, only attempts new variable if original does not exist 3. What are the side effects? None, previous name will still work, new name only used if original name does not exist
1 parent 5dbadd6 commit 4fb525b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/Chrome/ChromeDriverService.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@
1919

2020
class ChromeDriverService extends DriverService
2121
{
22-
// The environment variable storing the path to the chrome driver executable.
22+
/**
23+
* The environment variable storing the path to the chrome driver executable.
24+
* @deprecated Use ChromeDriverService::CHROME_DRIVER_EXECUTABLE
25+
*/
2326
const CHROME_DRIVER_EXE_PROPERTY = 'webdriver.chrome.driver';
27+
// The environment variable storing the path to the chrome driver executable
28+
const CHROME_DRIVER_EXECUTABLE = 'WEBDRIVER_CHROME_DRIVER';
2429

2530
/**
2631
* @return static
2732
*/
2833
public static function createDefaultService()
2934
{
30-
$exe = getenv(self::CHROME_DRIVER_EXE_PROPERTY);
35+
$exe = getenv(self::CHROME_DRIVER_EXECUTABLE) ?: getenv(self::CHROME_DRIVER_EXE_PROPERTY);
3136
$port = 9515; // TODO: Get another port if the default port is used.
32-
$args = ["--port=$port"];
33-
$service = new static($exe, $port, $args);
37+
$args = ['--port=' . $port];
3438

35-
return $service;
39+
return new static($exe, $port, $args);
3640
}
3741
}

0 commit comments

Comments
 (0)