Hopefully someone will find this useful.
See http://codeception.com/docs/modules/WebDriver#pressKey
pressKey
Presses the given key on the given element. To specify a character and modifier (e.g. ctrl, alt, shift, meta), pass an array for $char
with the modifier as the first element and the character as the second. For special keys use key constants from WebDriverKeys
class.
<?php
// <input id="page" value="old" />
$I->pressKey('#page','a'); // => olda
$I->pressKey('#page',array('ctrl','a'),'new'); //=> new
$I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x
$I->pressKey('descendant-or-self::*[ * `id='page']','u');` //=> oldu
$I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>''
?>
param $element
param $char
Can be char or array with modifier. You can provide
several chars.
throws \Codeception\Exception\ElementNotFound
Please note, that you may need to add \
or \Facebook\WebDriver\
before WebDriverKeys
:
\Facebook\WebDriver\WebDriverKeys::ENTER