5

I have a page which consists of some disabled inputs, spans and divs.
In the background I wait for pressed keys. Background of this is some memory game.
My problem is, that it turned out to be pretty hard to test.
I know two functions to simulate input: type() and keys(). When I use keys("@someElement", "34"), I get "element not interactable". Similar happens with type() (well that's not surprising as type suggests filling some input).

How can I properly simulate a pressed key without using an active input element?

TimSch
  • 1,189
  • 1
  • 12
  • 27

1 Answers1

8

Use the underlying driver:

$browser->driver->getKeyboard()->sendKeys('a');
$browser->driver->getKeyboard()->sendKeys(\Facebook\WebDriver\WebDriverKeys::ENTER);
Jonas Staudenmeir
  • 24,815
  • 6
  • 63
  • 109