diff --git a/README.md b/README.md index 7d065078..bb089f9a 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ The following environment variables can be set to change some Panthère behavior * `PANTHERE_NO_HEADLESS`: to disable browsers's headless mode (will display the testing window, useful to debug) * `PANTHERE_NO_SANDBOX`: to disable [Chrome's sandboxing](https://chromium.googlesource.com/chromium/src/+/b4730a0c2773d8f6728946013eb812c6d3975bec/docs/design/sandbox.md) (unsafe, but allows to use Panthère in containers) * `PANTHERE_WEB_SERVER_DIR`: to change the project's document root (default to `public/`) +* `PANTHERE_CHROME_DRIVER_BINARY`: to use another `chromedriver` binary, instead of relying on the ones already provided by Panthère ## Docker Integration diff --git a/src/ProcessManager/ChromeManager.php b/src/ProcessManager/ChromeManager.php index b6b3e758..15a614d9 100644 --- a/src/ProcessManager/ChromeManager.php +++ b/src/ProcessManager/ChromeManager.php @@ -32,7 +32,7 @@ final class ChromeManager implements BrowserManagerInterface public function __construct(?string $chromeDriverBinary = null, ?array $arguments = null, array $options = []) { - $this->process = new Process([$chromeDriverBinary ?? $this->findChromeDriverBinary()], null, null, null, null); + $this->process = new Process([$chromeDriverBinary ?: $this->findChromeDriverBinary()], null, null, null, null); $this->arguments = $arguments ?? $this->getDefaultArguments(); $this->options = \array_merge($this->getDefaultOptions(), $options); } @@ -66,6 +66,10 @@ public function quit(): void private function findChromeDriverBinary(): string { + if ($binary = $_SERVER['PANTHERE_CHROME_DRIVER_BINARY'] ?? null) { + return $binary; + } + switch (PHP_OS_FAMILY) { case 'Windows': return __DIR__.'/../../chromedriver-bin/chromedriver.exe';