Click on “html” to make User Interactions more reliable

I have been lucky over the years that when I put out some information into the world, and I get to learn from the people who consume that information.

I received a lot of good feedback from readers of “Selenium Simplified” about what they found easy to understand, and what they didn’t, and that all helped with future editions and when I was constructing the online course.

And I get to learn from the people on the courseĀ itself.

I’ve always found Advanced User Interactions in WebDriver intermittent to use.

Recently Kent Wood, one of the people taking the online course wrestled this particular bug bear to the ground using a method I haven’t seen before, but Kent managed to find from trawling the internet.

To put focus on to the page, before issuing any user interaction commands, click on the “html”.

Seems simple, but I hadn’t used this before.

driver.findElement(By.tagName("html")).click();

Kent describes it on his blog:

Thanks Kent.

This entry was posted in WebDriver. Bookmark the permalink.

2 Responses to Click on “html” to make User Interactions more reliable

  1. KWood says:

    Thanks to you, Alan!

    -Kent

Leave a Reply

Your email address will not be published. Required fields are marked *