Interview Questions

Selenium WebDriver - How do you send ENTER/TAB keys in WebDriver ?

Selenium WebDriver Interview question and Answers


(Continued from previous question...)

Selenium WebDriver - How do you send ENTER/TAB keys in WebDriver ?

use click() or submit() [submit() can be used only when type=’submit’]) method for ENTER. Or use Actions class to press keys.

For Enter-
act.sendKeys(Keys.RETURN);
1

act.sendKeys(Keys.RETURN);

For Tab-
act.sendKeys(Keys.ENTER);
1

act.sendKeys(Keys.ENTER);

where act is Actions class type. ( Actions act = new Actions(driver); )

(Continued on next question...)

Other Interview Questions