I have a problem with trigger keypress event in WebDriver with using php. There is element with class > test On this element bind keypress by jquery . I try to click,but its no result
$this->_city = $this->driver->findElement(WebDriverBy::className('test'));
$this->_city->click()
Plz, help me, who know how to emulate keypress on webdriwer with using php.
$this->_city = $this->driver->findElement(WebDriverBy::className('test'));
$this->_city->click()
$this->driver->getKeyboard()->sendKeys('TEXT HERE'); // this will insert text in the box
$this->driver->getKeyboard()->pressKey(WebDriverKeys::ENTER); // This will do a enter or whatever key you like to press ( not letter/numbers move ARROW_UP or whatever you like to presskey)
Here are some other keys for the driver:
Check out more Keys from WebDriverKey
CHECK getKeyboard() Methods
The only one worked for me is WebDriverKeys
:
$driver->getKeyboard()->pressKey(WebDriverKeys::ENTER);
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With