Read more

Clicking issues with chromedriver

Natalie Zeumann
June 19, 2017Software engineer at makandra GmbH

ChromeDriver clicking works by simulating a mouse click in the middle of the element's first client rect (or bounding client rect if it doesn't have a first client rect). ( Clicking issues Show archive.org snapshot )

So if you are trying to click on an element, chromedriver tries to click at the position where it first finds that element.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

This can lead to some problems and unexpected behavior like:

  • Element is not clickable at point ... erros
  • Another element which is now located at this position receives the click

A step which finds and clicks the desired link via javascript may solve the problem:

When(/^I search and click on "([^"]*)"$/) do |text|
  page.execute_script("$(\":contains('#{text}'):not(:has(:contains('#{text}')))\").click()")
end

Note:

  • "Clicking" via JavaScript might click elements which are actually not clickable, e.g. because a modal overlay covers them. Use with caution.
  • spreewald Show archive.org snapshot steps cause this error, too. You may need to override the according steps or write a custom step like above.

The bug Show archive.org snapshot seemed to appear in chromedriver versions > 2.12

Posted by Natalie Zeumann to makandra dev (2017-06-19 16:21)