Skip to content

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.

Constructing the test experiment URL

  • browser.getExperimentUrl() Constructs the test experiment URL based on the testrun --url CLI option

Information about the browser and Selenium/Appium server

  • 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

Additional features

Clone this wiki locally