Posted over 1 year ago. Visible to the public.

Clicking issues with chromedriver

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)

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

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:

Copy
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 steps cause this error, too. You may need to override the according steps or write a custom step like above.

The bug seemed to appear in chromedriver versions > 2.12

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Natalie Krehan
Last edit:
8 months ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Natalie Krehan to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more