Driver Binaries
WebdriverIO allows using driver binaries directly instead of services.
Here’s an example with geckodriver
.
Download Geckodriver
Note: You must have Firefox installed to use Geckodriver.
Download the latest version of geckodriver
for your environment and unpack it in your project directory:
$ curl -L https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz | tar xz
$ curl -L https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz | tar xz
$ brew install geckodriver
$ choco install selenium-gecko-driver
# Run as privileged session. Right-click and set 'Run as Administrator'
# Use geckodriver-v0.24.0-win32.zip for 32 bit Windows
$url = "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win64.zip"
$output = "geckodriver.zip" # will drop into current directory unless defined otherwise
$unzipped_file = "geckodriver" # will unzip to this folder name
# By default, Powershell uses TLS 1.0 the site security requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Downloads Geckodriver
Invoke-WebRequest -Uri $url -OutFile $output
# Unzip Geckodriver
Expand-Archive $output -DestinationPath $unzipped_file
cd $unzipped_file
# Globally Set Geckodriver to PATH
[System.Environment]::SetEnvironmentVariable("PATH", "$Env:Path;$pwd\geckodriver.exe", [System.EnvironmentVariableTarget]::Machine)
Note: Other geckodriver
releases are available here. In order to automate other browsers, you need different drivers. You can find a list with all drivers in the awesome-selenium
README.
Start Browser Driver
Start Geckodriver by running:
/path/to/binary/geckodriver --port 4444
For example, if you ran the curl
command from above, you should have a geckodriver
binary available in the current folder.
Start it like this:
./geckodriver --port 4444
This will start Geckodriver on localhost:4444
with the WebDriver endpoint set to /
.
Keep this running in the background and open a new terminal window. Next step is to download WebdriverIO via NPM: