desc.PressKey.txt Maven / Gradle / Ivy
Simulates user pressing key on element identified by locator.
key is either a single character, or a numerical ASCII code of the key lead by '\'.
Examples:
| Press Key | text_field | q |
| Press Key | login_button | \\\\13 | # ASCII code for enter key |
| Press Key | id=passwd | \\\\9 | # ASCII code for tab key |
Sometimes this keyword does not trigger the correct JavaScript event on the clicked element. In those cases Press Key Native can be used as a workaround.
The selenium command key_press [1] that this keyword used exposes some erratic behavior [2], especially when used with the Internet Explorer. If you do not get the expected results, try Press Key Native instead.
[1] http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/python/selenium.selenium-class.html#key_press [2] http://jira.openqa.org/browse/SRC-385