Zum Hauptinhalt springen

emulate

WebdriverIO allows you to emulate Web APIs using the emulate command. These Web APIs can then behave exactly as you specify it.

Read more on this in the Emulation guidelines.

info

It is not possible to change the emulated value without reloading the page.

info

This feature requires WebDriver Bidi support for the browser. While recent versions of Chrome, Edge and Firefox have such support, Safari does not. For updates follow wpt.fyi. Furthermore if you use a cloud vendor for spawning browsers, make sure your vendor also supports WebDriver Bidi.

Usage
browser.emulate(scope, options)
Parameters
NameTypeDetails
scopestringfeature of the browser you like to emulate, can be either geolocation, userAgent, colorScheme or onLine
optionsEmulationOptionsemulation option for specific scope
Examples
example.js
loading...
example.js
loading...

Welcome! How can I help?

WebdriverIO AI Copilot