Skip to main content

Keyboard

DrevOps\BehatSteps\Steps\Web\KeyboardTrait - Source, Example

Simulate keyboard interactions in the browser.

  • Trigger key press events, including named special keys.
  • Press a string of characters 1 key at a time.
  • Target a key press at a page element or at the focused element.

Steps​

@When I press the key :key

Press a single keyboard key

When I press the key "a"
When I press the key "tab"
@When I press the key :key on the element :selector

Press a single keyboard key on the element

When I press the key "a" on the element "#edit-title"
When I press the key "tab" on the element "#edit-title"
@When I press the keys :keys

Press multiple keyboard keys

When I press the keys "abc"
@When I press the keys :keys on the element :selector

Press multiple keyboard keys on the element

When I press the keys "abc" on the element "#edit-title"