On occasion you’ll come across functionality that requires the use of keyboard key presses in your tests. Perhaps you’ll need to tab to traverse from one portion of the page to another, back out of some kind of menu or overlay with the escape key, or even submit a form with Enter.
But how do you do it and where do you start?
You can easily issue a key press by using the send_keys command.
Alternatively, you can also issue a key press without finding the element first,
Actions builder = new Actions(driver);