diff --git a/README.md b/README.md index 81a7876..d0569ff 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,10 @@ npx geckodriver --port=4444 # Start Edgedriver npx edgedriver --port=4444 -# Start Safaridriver (macOS) -npx safaridriver --port=4444 - ``` +The `safaridriver` package has no CLI: Safaridriver is part of macOS, so run `/usr/bin/safaridriver --port=4444` directly (once, run `safaridriver --enable` to allow remote automation). + ### Environment Variables & Global Installation Setup #### Auto-Installation Flags @@ -103,13 +102,19 @@ By default, binaries download when initialized via CLI or API. To download them #### Windows Setup (`selenium-webdriver` note) -When installing `geckodriver` or `edgedriver` globally on Windows, `selenium-webdriver` expects the `.exe` extension in PATH. You can create a symlink in your global npm binary directory: +A global install on Windows adds `geckodriver.cmd` and `edgedriver.cmd` to your `PATH`, but `selenium-webdriver` looks for `geckodriver.exe` and `msedgedriver.exe`. The packages download the binary into their cache folder, not into the package folder: `geckodriver-.exe` in `GECKODRIVER_CACHE_DIR`, `msedgedriver.exe` in `EDGEDRIVER_CACHE_DIR` (both default to the system temporary folder). Set the cache folder and the version, run the driver once, then copy the binary to a folder on your `PATH`: ```cmd -mklink %USERPROFILE%\AppData\Roaming\npm\geckodriver.exe %USERPROFILE%\AppData\Roaming\npm\node_modules\geckodriver\geckodriver.exe - +set GECKODRIVER_CACHE_DIR=%USERPROFILE%\geckodriver +set GECKODRIVER_VERSION=0.37.1 +geckodriver --version +copy /Y %GECKODRIVER_CACHE_DIR%\geckodriver-%GECKODRIVER_VERSION%.exe %APPDATA%\npm\geckodriver.exe ``` +Name the exact version: with a wildcard, `copy` joins all cached versions into one broken file. + +Recent `selenium-webdriver` versions can also download the drivers themselves with Selenium Manager. + --- ## Programmatic Usage diff --git a/packages/node-geckodriver/README.md b/packages/node-geckodriver/README.md index cefcf94..b093cc4 100644 --- a/packages/node-geckodriver/README.md +++ b/packages/node-geckodriver/README.md @@ -19,12 +19,17 @@ Or install it globally: npm install -g geckodriver ``` -__Note:__ This installs a `geckodriver` shell script that runs the executable, but on Windows, [`selenium-webdriver`](https://www.npmjs.com/package/selenium-webdriver) looks for `geckodriver.exe`. To use a global installation of this package with [`selenium-webdriver`](https://www.npmjs.com/package/selenium-webdriver) on Windows, copy or link `geckodriver.exe` to a location on your `PATH` (such as the npm bin directory) after installing this package: +__Note:__ This installs a `geckodriver` shell script that runs the executable, but on Windows, [`selenium-webdriver`](https://www.npmjs.com/package/selenium-webdriver) looks for `geckodriver.exe`. The package downloads the binary into its cache folder (`GECKODRIVER_CACHE_DIR`, by default the system temporary folder) as `geckodriver-.exe`, not into the package folder. Set the cache folder and the version, run the driver once, then copy the binary to a folder on your `PATH` (such as the npm bin directory): -```sh -mklink %USERPROFILE%\AppData\Roaming\npm\geckodriver.exe %USERPROFILE%\AppData\Roaming\npm\node_modules\geckodriver\geckodriver.exe +```cmd +set GECKODRIVER_CACHE_DIR=%USERPROFILE%\geckodriver +set GECKODRIVER_VERSION=0.37.1 +geckodriver --version +copy /Y %GECKODRIVER_CACHE_DIR%\geckodriver-%GECKODRIVER_VERSION%.exe %APPDATA%\npm\geckodriver.exe ``` +Name the exact version: with a wildcard, `copy` joins all cached versions into one broken file. + Once installed you can start Geckodriver via: ```sh