.visible? returns false for an element that should be visible

154 views
Skip to first unread message

Jesse Clark

unread,
Mar 22, 2013, 4:44:51 PM3/22/13
to capybar...@googlegroups.com
I am using the latest Capybara (2.0.2), Capybara-Webkit (0.14.2), and Qt (4.8.4).

I have a form which gets displayed in a Twitter Bootstrap modal dialog after the user clicks a link. In my integration test I am loading the page, checking that the modal form is not visible, clicking the link, and then attempting to assert that the form is visible.

The form #eligibility_question is added to the DOM and made visible as a result of an ajax call. It can be found:

(rdb:1) nq_modal = find '#eligibility_question'

#<Capybara::Element tag="form" path="/html/body[@id='users_matches']/div[2]/div[@id='content']/div[@id='seach_results']/div[1]/div[@id='next_question']/form[@id='eligibility_question']">

But is not visible:

(rdb:1) nq_modal.visible?

false

However, if I search for the xpath used by the default implementation of visible? in Capybara, no hidden elements are found:

(rdb:1) find(:xpath, ".//form[@id='eligibility_question']/ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or name()='script' or name()='head']")

Capybara::ElementNotFound Exception: Unable to find xpath ".//form[@id='eligibility_question']/ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or name()='script' or name()='head']"

And if I run the test using selenium instead of webkit, I see the form get displayed and the tests pass. The desired behavior is also observed running the app in a regular browser.

I am a little bit at a loss here and would appreciate any insight...

-Jesse

Joe Ferris

unread,
Mar 22, 2013, 5:18:01 PM3/22/13
to capybar...@googlegroups.com
Can you paste the scenario and the failure you're getting when running the tests?

-Joe
--
You received this message because you are subscribed to the Google Groups "capybara-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capybara-webk...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages