Answer the question
In order to leave comments, you need to log in
Capybara: why doesn't the :visible option work?
Please help me figure out why Capybara always finds the email field regardless of the visible value.
There is a page with the following field on the form:
<label>
<input type="email" name="email" class="hide" placeholder="Email">
</label>
.hide {
display: none !important;
}
<br>
page.must_have_field('email', :type => 'email', :visible => false)<br>
check('Send by email')<br>
page.must_have_field('email', :type => 'email', :visible => true)<br>
Answer the question
In order to leave comments, you need to log in
The error was that I configured the driver for Capybara incorrectly.
Instead
of Capybara.default_driver = :poltergeist
I had
Capybara.javascript_driver = :poltergeist
I learned that I was working with a default driver that doesn't look for hidden elements correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question