Below is simple snippet of code:

@FindBy(className = "element-to-press")
private WebElement elementToPress;

// some other code

Keys move = Keys.ARROW_DOWN;

In Firefox everything works fine.

In Chrome I've got "org.openqa.selenium.WebDriverException: unknown error: cannot focus element" error

Safari does not react for sendKeys()

Also I've tried to use another approach:

Keys move = Keys.ARROW_DOWN;
Actions actions = new Actions(driver);
actions.moveToElement(element).click(); // to focus on element

This code fixed Chrome's "cannot focus element" error, but browser still does not react for Keys.ARROW_DOWN/Keys.ARROW_UP/Keys.ARROW_LEFT/Keys.ARROW_RIGHT events

Safari and Firefox do not react for sendKeys() as well.

I cannot understand what is going on and how I can make my code run for all this browsers.


  • OS X 10.9.5

  • Latest version of Chrome/Safari/Firefox

  • Selenium version 2.44.0


Madhan has found an universal solution here

closed as off-topic by IAmMilinPatel, Niels van Reijmersdal, Kate Paulk, Dhiman, Peter M. Jan 26 '16 at 18:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development unrelated to testing are off-topic here, but can be asked on Stack Overflow." – IAmMilinPatel, Niels van Reijmersdal, Kate Paulk, Dhiman, Peter M.
If this question can be reworded to fit the rules in the help center, please edit the question.