Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.7k points)

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 for using JavaScriptExecutor. But it doesn't seem a better solution for me, because it could make a browser-dependent code.

1 Answer

0 votes
by (62.9k points)

The solution is to use Actions without JavascriptExecuter:

Actions actions = new Actions(driver);



I hope it works for you!

Browse Categories