Eduardo Fabricio Eduardo Fabricio - 4 months ago 21
jQuery Question

Element after and WebDriverException: unknown error: cannot focus element

My javascript line:


My webdriver code line:

wait.until(ExpectedConditions.visibilityOfElementLocated("name"))).sendKeys("Some Name");

When I run the test it throws the following exception:

WebDriverException: unknown error: cannot focus element

So, I have been searching for a solution. There are some issues reported in chromium google code site. There are a lot of suggestions about using
. But it doesn't seem a better solution for me, because it could make a browser dependent code.


After some hours I finally found a solution by using Actions without JavascriptExecuter:

Actions actions = new Actions(driver);
actions.sendKeys("Some Name");;

Well, it worked for me. However, is this way the better solution ?