capybara: page.should have_no_content doesn't work correctly for display:none element
问题 I would like to use page.should have_no_content to check if the page doesn't display the label to user, here what it is in HTML: <li id="account_input" style="display: none;"> <label for="account_name">My Account</label> ... </li> So when I use page.should have_no_content("My Account"), it returns false instead of true. 回答1: You could use this statement find('#account_input').should_not be_visible 回答2: I found a solution using: Then /^"([^\"]+)" should not be visible$/ do |text| paths = [ "//