capybara: MWEB: Clicking is not clicking on the correct elements, even though it has the exact element. New to Chrome 67.
Meta
(Updated these since initial posting) Capybara Version: 3.0.0 Cucumber 2.4.0 Driver Information (and browser if relevant): selenium-webdriver (3.12.0) Chrome 67 with chromedriver 2.39
Expected Behavior
Clicking to work as on chrome 66.
Actual Behavior
I am using chrome with mobile emulation. Nothing changed except for chrome autoupdated from 66 to 67. Now click is completely off on chrome 67. I tried the .click, click_on, .send_keys(:enter). Nothing seems to want to click the correct element besides manually clicking it. Click in automation still works perfectly on desktop. I actually think this may be a chrome bug, but I wanted to check here first.
Here is our site if you want to take a look at it -> https://www.shopstyleqa.com/
Code
Given(/^I click the login button$/) do
el= find("ss-button", :text=>"Log In")
puts el.inspect #this is to check the correct element is found
el.click
end
Given(/^the login modal appears on mweb$/) do
find("ss-auth-form", :visible=>:all)
...
end
Output
And I click the login button
#<Capybara::Node::Element tag="ss-button" path="/html/body/app-root/ss-reframe-header/div[1]/div[2]/div[1]/ss-auth-buttons/div/div/ss-button[2]">
And the login modal appears on mweb
Unable to find css "ss-auth-form"
...
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (9 by maintainers)
@nils-e Ok I managed to replicate this using the below code
and there’s really nothing Capybara can do about it. It appears to be an incompatibility between the current version of
chromedriverand Chrome 67 for any elements inside an absolutely positioned element. If one removes the absolute positioning everything works properly again. Report it to thechromedriverproject and hope they fix it in the next release.@gerrywastaken That workaround can be written more succinctly using a reasonably recent release of Capybara as
However, one should fully understand that by using these workarounds you may no longer necessarily be testing what a user can actually do and it may make your test pointless. Obviously when running into an issue like this one with chromedriver/chrome it may be necessary in order to test anything, but it should only be used for those specific clicks where it is necessary and only until chromedriver/chrome fixes itself.
@nbeloglazov ya i do. There is this link and i keep checking the github repo for chromedriver. The last few comments somewhat confuse me, but I can imagine this bug is hitting a lot of people now as they are being forced to upgrade to Chrome 67 by the autoupdate feature. I am just blocking the update server and i rolled back to chrome 66 for now. https://bugs.chromium.org/p/chromedriver/issues/detail?id=2452