Skip to main content

keys

Send a sequence of key strokes to the "active" element. You can make an input element active by just clicking on it. To use characters like "Left arrow" or "Back space", import the Key object from the WebdriverIO package.

Modifier like Control, Shift, Alt and Command will stay pressed so you need to trigger them again to release them. Modifying a click however requires you to use the WebDriver Actions API through the performActions method.

info

Control keys differ based on the operating system the browser is running on, e.g. MacOS: Command and Windows: Control. WebdriverIO provides a cross browser modifier control key called Ctrl (see example below).

Usage
browser.keys(value)
Parameters
NameTypeDetails
valueString, Array[String]The sequence of keys to type. An array or string must be provided.
Example
keys.js
loading...

Welcome! How can I help?

WebdriverIO AI Copilot