Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Selenium2Library/keywords/_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,11 @@ def simulate(self, locator, event):

def press_key(self, locator, key):
"""Simulates user pressing key on element identified by `locator`.
`key` is either a single character, or a numerical ASCII code of the key
`key` is either a single character, a string, or a numerical ASCII code of the key
lead by '\\\\'.
Examples:
| Press Key | text_field | q |
| Press Key | text_field | abcde |
| Press Key | login_button | \\\\13 | # ASCII code for enter key |
"""
if key.startswith('\\') and len(key) > 1:
Expand Down
9 changes: 5 additions & 4 deletions test/acceptance/keywords/textfields.robot
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ Input Password
Press Key
[Setup] Go To Page "forms/login.html"
Cannot Be Executed in IE
Input Text username_field James Bond
Press Key password_field f
Press Key password_field \\9
Press Key login_button \\10
Press Key username_field James Bon
Press Key username_field \\100
Textfield Value Should Be username_field James Bond
Press Key password_field f
Press Key login_button \\10
Verify Location Is "forms/submit.html"

Attempt Clear Element Text On Non-Editable Field
Expand Down