Capybara: Elements rendered on the page, but outside the view cannot always be found

Created on 1 Sep 2018  路  5Comments  路  Source: teamcapybara/capybara

Meta

Capybara Version: 2.13.0

Driver Information (and browser if relevant): selenium-webdriver (3.11.0) with Chrome (67.0.3396.99)

Expected Behavior

Elements rendered on the page can always be found.

Actual Behavior

Elements rendered on the page, but not necessarily in the view are not found. Both has_content?("foo") and find("foo") fail to find element "foo", even though the .html screenshot clearly has element "foo" on the page. I have not tried other functions. The .png screenshot does not show element "foo" as the Chrome view isn't expanded enough to contain it. When running the tests with Chrome (not headless), if I expand the Chrome view until element "foo" is fully within the view, the element is immediately found.

Steps to reproduce

This only happens ~50% of the time and cannot be reliably reproduced in any way.

Need Info

All 5 comments

This is an unactionable report. If it happens 50% of the time - provide some HTML it happens with and we can run it multiple times. has_content?("foo") and find("foo") do different things (one looks for text content, the other for a <foo> element) so not really sure why you'd be using both to find element "foo". If you provide at least some HTML (and the code you're running against it) that exhibits this behavior we'll look into it, otherwise I'll close this.

Note: 2.13.0 was released 18 months ago -- anything you provide will be tested against the current release version - time to update.

It's most certainly actionable, you just don't want to investigate it. has_content?("foo") and find("foo") do different things, you're right. And those differences have nothing to do with whether the element you're trying to find is off the page or not. Since I can't legally show you the code that is running and I can't reliably reproduce it anyway, I'd suggest you look at how you handle the view vs the page, since you're clearly doing it wrong. Obviously there's an enormous oversight that hasn't been considered. You can ignore it and close the issue, but that just means your project is defunct since it can't handle elements outside of the view which any reasonable engineer would expect.

@kevin-andrews The Capybara test suite is quite large and a lot of the tests deal with content outside the viewport without issue. Additionally Capybara doesn't really do anything with regard to the "view vs the page" that's all handled by chromedriver. You're the only person complaining about one of the core features of Capybara, which should tell you something. It's either your code, something rare in your page, or the fact that you're using an 18 month old version with an up to date version of Chrome. There would be no way for me to find this without an example showing the issue, however you're too good to put in your own time to produce that. The fact that you've paid nothing for Capybara and are coming across as a ridiculously self-entitled <insert choice of term> tells me everything needed to be known.

No one is forcing you to use Capybara, so please stop using it.

@twalpole Trust me, if I could choose to not use your 'software', I wouldn't. And your toxic responses are why I won't contribute to OSS monetarily, and nor will I do all the legwork to make your software better. I hope one day you're passionate about what you do enough to make it worthy for the world to use.

FYI, reporting this was pure courtesy. I worked around it before I even created the issue. In the future, I'd suggest you say "We believe this is a problem with chromedriver" and pretend you spent any time investigating so you don't sound so toxic and push people away from helping your project.

@kevin-andrews It's simple -- remove Capybara from your Gemfile and you've chosen not to use it - done.

You won't contribute to OSS monetarily, are not willing to do any "legwork" to help - but want to use all the work of people who were willing, so you're a freeloader as well as self-entitled.

We can't say "we believe this is a problem with chromedriver" - we have no idea what the issue (if one exists) actually is because you won't provide a way to reproduce it, and since no one else has filed an issue about it you appear to be the only person suffering from it. I don't believe you worked around any issue, but if you had before filing this issue then presumably you actually figured out what's causing it and still weren't able to provide a reproducible test case?. That's even worse.

Next time I suggest you go look at past issues and the speed of resolution on any project before accusing people of not wanting to look into problems. You were at no point trying to help the project (as evidenced by you not wanting to do any looking into the claimed issue) and are not wanted as a user of Capybara.

Capybara, as you stated, is obviously "defunct" (despite the continuous updating, feature additions, etc) , you are not wanted as a user, and you are not actually willing to do anything to help reproduce "issues" you want fixed - so just stop using it.

Was this page helpful?
0 / 5 - 0 ratings