Sunday, December 17, 2017

Sending keys in selenium


In Selenium, we are send specific keys from the keyboard like Enter or F2 on WebElement using import org.openqa.selenium.Keys as shown below:


import org.openqa.selenium.Keys

WebElement.sendKeys(Keys.ENTER)

Below is the list of enum constants defined for enum Keys, which we can send on an element in selenium:


ADD 
ALT 
ARROW_DOWN 
ARROW_LEFT 
ARROW_RIGHT 
ARROW_UP 
BACK_SPACE 
CANCEL 
CLEAR 
COMMAND 
CONTROL 
DECIMAL 
DELETE 
DIVIDE 
DOWN 
END 
ENTER 
EQUALS 
ESCAPE 
F1 
F10 
F11 
F12 
F2 
F3 
F4 
F5 
F6 
F7 
F8 
F9 
HELP 
HOME 
INSERT 
LEFT 
LEFT_ALT 
LEFT_CONTROL 
LEFT_SHIFT 
META 
MULTIPLY 
NULL 
NUMPAD0 
NUMPAD1 
NUMPAD2 
NUMPAD3 
NUMPAD4 
NUMPAD5 
NUMPAD6 
NUMPAD7 
NUMPAD8 
NUMPAD9 
PAGE_DOWN 
PAGE_UP 
PAUSE 
RETURN 
RIGHT 
SEMICOLON 
SEPARATOR 
SHIFT 
SPACE 
SUBTRACT 
TAB 
UP 
ZENKAKU_HANKAKU 
For further details, please see the Page: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/Keys.html

No comments:

Post a Comment