cucumber - Capybara exclude a div in search? -


is there way tell capybara ignore div when searching page.

something

page.assert_no_selector('a', :unless => '.an-excused-class a') 

alternatively, there way in specific step tell capybara not count hidden elements. i've seen ways globally, that's not want.

tia

  1. there no way in capybaras default assertions tell ignore elements match selector.

  2. by default capybara won't find hidden elements, if have overridden changing capybara.ignore_hidden_elements option can specify :visible option in assertion

    page.assert_no_selector('a', visible: true)

the visible option can take number of values:

  • true or :visible => find visible elements
  • false or :all => find elements no matter visibility
  • :hidden => find non-visible elements

Comments