REPL interface
With v4.5.0
, WebdriverIO introduced a REPL interface that helps you to not only learn the framework API, but also debug and inspect your tests. It can be used in multiple ways.
First you can use it as CLI command by installing npm install -g @wdio/cli
and spawn a WebDriver session from the command line, e.g.
wdio repl chrome
This would open a Chrome browser that you can control with the REPL interface. Make sure you have a browser driver running on port 4444
in order to initiate the session. If you have a Sauce Labs (or other cloud vendor) account, you can also directly run the browser on your command line in the cloud via:
wdio repl chrome -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY
If driver is running on different port eg : 9515, it could passed with the command line argument --port or alias -p
wdio repl chrome -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -p 9515
Repl could also be ran using the capabilities from the webdriverIO config file. Wdio supports capabilities object; or ; multiremote capability list or object.
If the config file uses capabilities object then just pass the path to config file, else if its a multiremote capability then, specify which capability to use from list or multiremote using the positional argument . Note: for list we consider zero based index.