-
Notifications
You must be signed in to change notification settings - Fork 2
Using custom browser commands
Thomas Pronk edited this page Apr 29, 2021
·
4 revisions
Home - WebdriverIO testing - Creating a new WebdriverIO test - Using custom browser commands
The configuration file in scripts/shared/wdio.conf.cjs adds a couple of custom commands of the browser object. The most important of these are described below.
-
browser.getExperimentUrl()Constructs the test experiment URL based on the testrun--urlCLI option
-
browser.getOsName()Operating system that test is running on: OS X, Windows, Android, or iOS -
browser.getDeviceName()Device that test is running on; only defined for mobile devices -
browser.getPlatformName()Platform name. For its format, see Platform naming scheme -
browser.getPointerType()Returns "touch" on mobile or "mouse" on desktop -
browser.getResolution()Returns the resolution of the device screen in hardware pixels -
browser.runningLocal()Returns true if running a local Selenium server, or false if running on BrowserStack. See Setting up a Selenium or Appium server
- For taking screenshots and performing visual regression tests, see Visual regression testing of screenshots
- For adding custom entries to test logs, use
browser.logAdd(key, value). For more information, see Organization of test logs