Skip to main content

[Windows] Send Keys

Description

Simulate keystroke events on the specified element by pressing a key or a combination of keys.

Keyword name: sendKeys

Parameters

Parameter Parameter TypeRequiredDescription
windowsObjectWindowsTestObjectYesAn object that describes the locator and locator strategy to find Windows Element.
strKeysStringYesA combination of keys to press.

Method Keys.chord

For pressing a combination of keys, the Keys.chord method is used along with the sendKeys keyword.
Method nameMethod syntaxDescription
Keys.chordKeys.chord(...) or

chord() of org.openqa.selenium.Keys

Simulate pressing many keys at once in a "chord". Takes a sequence of Keys.XXXX or strings; appends each of the values to a string, and adds the chord termination key (Keys.NULL) and returns the resultant string.
Note:

When the low-level webdriver key handlers see Keys.NULL, active modifier keys (CTRL/ALT/SHIFT/etc) release via a keyup event.

Please see this document for further instructions and examples.

Example

//Press Ctrl+A on the Edit element
Windows.sendKeys(findWindowsObject('Object Repository/Notepad/Edit'),Keys.chord(Keys.CONTROL,'a'))
Was this page helpful?