WebdriverIO service to start & stop WebDriver component (geckodriver, chrome driver)
npm install wdio-webdriver-serviceWDIO WebDriver Service
================================
(Based on wdio-selenium-standalone-service)
----
This service helps you to run Chromedriver or Geckodriver seamlessly when running tests with the WDIO testrunner.
It uses:
- geckodriver NPM package for runnings tests with Firefox.
- chromedriver NPM package for runnings tests with Chrome.
Note - this service does not require a Selenium server, but uses ChromeDriver or GeckoDriver to communicate with the browser directly.
It supports:
``js
`
capabilities: [{
browserName: 'firefox'
}]
`
and
js
`
capabilities: [{
browserName: 'chrome'
}]
wdio-webdriver-service
Installation
The easiest way is to keep as a devDependency in your package.json.
`
json
`
{
"devDependencies": {
"wdio-webdriver-service": "~0.1"
}
}
`
You can simple do it by:
bash
`
npm install wdio-webdriver-service --save-dev
WebdriverIO
Instructions on how to install can be found here.
webdriver
Configuration
To use the service you need to add to your service array:
`
js
`
// wdio.conf.js
export.config = {
port: '9515',
path: '/',
// ...
services: ['webdriver'],
// ...
webDriverType: 'geckodriver',
webDriverLogs: './',
webDriverArgs: ['--silent'],
webDriverKillProcess: false, // to kill webdriver (chromedriver or geckodriver) process after complete, default true
};
String
Options
$3
Path where all logs from the WebDriver server should be stored.
Type:
geckodriver
----
$3
Type of the driver component to use.
Possible values: , chromedriver
String
Type:
`
----
$3
Arguments to run driver component binary with.
Note that options for Gecko driver and Chrome driver are different.
More info:
- Gecko driver options:
`
-b BINARY/--binary BINARY Path to the Firefox binary to use.
--connect-existing Connecting to an existing Firefox instance.
--host HOST Host to use for the WebDriver server. Defaults to 127.0.0.1.
--log LEVEL Set the Gecko and geckodriver log level.
--marionette-port PORT Port to use for connecting to the Marionette remote protocol.
-p PORT/--port PORT Port to use for the WebDriver server. Defaults to 4444.
`
- Chrome driver options:
`
--port=PORT Port to listen on
--adb-port=PORT Adb server port
--verbose Log verbosely
--version Print the version number and exit
--silent Log nothing
--url-base Base URL path prefix for commands, e.g. wd/url
--port-server Address of server to contact for reserving a port
--whitelisted-ips Comma-separated whitelist of remote IPv4 addresses which are allowed to connect to ChromeDriver
Array`
Type:
----
For more information on WebdriverIO see the homepage.
----