In AppNeta Experience, we have a selenium script which requires us to use a keyboard command.
How can we delete or backspace to remove text from a field in Selenium?
Or can we hit TAB to move to the next field?
Or can we submit the login using Enter instead of clicking the submit button?
How can I scroll the Page Down?
The commands you are looking for is keyDown and keyUp. These commands requires specifying the correct value.
More details can be found on our Techdocs:
When using the command, you can specify the target (seen below using id= ), or simply use the keyboard command on the page without selecting a target and using only the keyDown value.
Then use keyUp to let go of the key command you specified.
So as indicated above, keyDown is simulating pressing the ENTER Key, which is represented as \e007.
Other popular keys which might be used for navigating the website:
Space is \e00D
Delete is \e017
Backspace is \e003
Escape is \e00C
Tab is \e004
Page Down is \e00f
You may need to add a waitforElement or pause command, depending on your script and the next steps in your wokflow.
Here's a small list of Code Values. When using the following Code values, make sure to only include the E### values and to include a backslash before the E. i.e.: \E00F
|
|
|
|
|
If you need to scroll down on a Web Page, you can use the Page Down or Page Up keyboard keys with keyDown and keyUp.
Additional Values can be found below.
null: "\ue000",
cancel: "\ue001",
help: "\ue002",
backspace: "\ue003",
tab: "\ue004",
clear: "\ue005",
return: "\ue006",
enter: "\ue007",
shift: "\ue008",
left_shift: "\ue008",
control: "\ue009",
left_control: "\ue009",
alt: "\ue00A",
left_alt: "\ue00A",
pause: "\ue00B",
escape: "\ue00C",
space: "\ue00D",
page_up: "\ue00E",
page_down: "\ue00F",
end: "\ue010",
home: "\ue011",
left: "\ue012",
arrow_left: "\ue012",
up: "\ue013",
arrow_up: "\ue013",
right: "\ue014",
arrow_right: "\ue014",
down: "\ue015",
arrow_down: "\ue015",
insert: "\ue016",
delete: "\ue017",
semicolon: "\ue018",
equals: "\ue019",
numpad0: "\ue01A",
numpad1: "\ue01B",
numpad2: "\ue01C",
numpad3: "\ue01D",
numpad4: "\ue01E",
numpad5: "\ue01F",
numpad6: "\ue020",
numpad7: "\ue021",
numpad8: "\ue022",
numpad9: "\ue023",
multiply: "\ue024",
add: "\ue025",
separator: "\ue026",
subtract: "\ue027",
decimal: "\ue028",
divide: "\ue029",
f1: "\ue031",
f2: "\ue032",
f3: "\ue033",
f4: "\ue034",
f5: "\ue035",
f6: "\ue036",
f7: "\ue037",
f8: "\ue038",
f9: "\ue039",
f10: "\ue03A",
f11: "\ue03B",
f12: "\ue03C",
meta: "\ue03D",
command: "\ue03D", # alias
left_meta: "\ue03D", # alias
zenkaku_hankaku: "\uE040",
right_shift: "\ue050",
right_control: "\ue051",
right_alt: "\ue052",
right_meta: "\ue053",
numpad_page_up: "\ue054",
numpad_page_down: "\ue055",
numpad_end: "\ue056",
numpad_home: "\ue057",
numpad_left: "\ue058",
numpad_up: "\ue059",
numpad_right: "\ue05A",
numpad_down: "\ue05B",
numpad_insert: "\ue05C",
numpad_delete: "\ue05D"