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 and spawn a WebDriver session from the command line, e.g.
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:
Or if you want to run local mobile tests using Appium:
DOCUSAURUS_CODE_TABS
Android
iOS
END_DOCUSAURUS_CODE_TABS
This would open Chrome/Safari session on connected device/emulator/simulator. Make sure Appium running on port 4444
in order to initiate the session.
This would open App session on connected device/emulator/simulator. Make sure Appium running on port 4444
in order to initiate the session.
Capabilities for iOS device can be passed with arguments:
-v
-platformVersion
: version of Android/iOS platform-d
-deviceName
: name of mobile device-u
-udid
: udid for real devices
Usage:
DOCUSAURUS_CODE_TABS
Long Parameter Names
Short Parameter Names
END_DOCUSAURUS_CODE_TABS
You can apply any options (see wdio repl --help
) available for your REPL session.
Another way to use the REPL is in inside your tests via the debug
command. This will stop the browser when called, and enables you to jump into the application (e.g. to the dev tools) or control the browser from the command line. This is helpful when some commands don't trigger a certain action as expected. With the REPL, you can then try out the commands to see which are working most reliably.