قابلیت ها(capabilities)
A capability is a definition for a remote interface. It helps WebdriverIO to understand in which browser or mobile environment you like to run your tests on. Capabilities are less crucial when developing tests locally as you run it on one remote interface most of the time but becomes more important when running a large set of integration tests in CI/CD.
The format of a capability object is well defined by the WebDriver specification. The WebdriverIO testrunner will fail early if user defined capabilities do not adhere to that specification.
Custom Capabilities
While the amount of fixed defined capabilities is very low, everyone can provide and accept custom capabilities that are specific to the automation driver or remote interface:
Browser Specific Capability Extensions
goog:chromeOptions
: Chromedriver extensions, only applicable for testing in Chromemoz:firefoxOptions
: Geckodriver extensions, only applicable for testing in Firefoxms:edgeOptions
: EdgeOptions for specifying the environment when using EdgeDriver for testing Chromium Edge
Cloud Vendor Capability Extensions
sauce:options
: Sauce Labsbstack:options
: BrowserStacktb:options
: TestingBot- and many more...
Automation Engine Capability Extensions
WebdriverIO Capabilities to manage browser driver options
WebdriverIO manages installing and running browser driver for you. WebdriverIO uses a custom capability that allows you to pass in parameters to the driver.
Common Driver Options
While all driver offer different parameters for configuration, there are some common ones that WebdriverIO understand and uses for setting up your driver or browser:
cacheDir
The path to the root of the cache directory. This directory is used to store all drivers that are downloaded when attempting to start a session.
Type: string
Default: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir()
binary
Path to a custom driver binary. If set WebdriverIO won't attempt to download a driver but will use the one provided by this path. Make sure the driver is compatible with the browser you are using.
Type: string
Browser Specific Driver Options
In order to propagate options to the driver you can use the following custom capabilities:
- Chrome:
wdio:chromedriverOptions
- Firefox:
wdio:geckodriverOptions
- Microsoft Egde:
wdio:edgedriverOptions
- Safari:
wdio:safaridriverOptions
- wdio:chromedriverOptions
- wdio:geckodriverOptions
- wdio:edgedriverOptions
- wdio:safaridriverOptions
adbPort
The port on which the ADB driver should run.
Example: 9515
Type: number
urlBase
Base URL path prefix for commands, e.g. wd/url
.
Example: /
Type: string
logPath
Write server log to file instead of stderr, increases log level to INFO
Type: string
logLevel
Set log level. Possible options ALL
, DEBUG
, INFO
, WARNING
, SEVERE
, OFF
.
Type: string
verbose
Log verbosely (equivalent to --log-level=ALL
)
Type: boolean
silent
Log nothing (equivalent to --log-level=OFF
)
Type: boolean
appendLog
Append log file instead of rewriting.
Type: boolean
replayable
Log verbosely and don't truncate long strings so that the log can be replayed (experimental).
Type: boolean