How to find invisible element using capybara

Dec 22, 2014

Capybara don’t find invisible element.

page.find("#delete-button")

In this case if #delete-button element has display: hidden or any other invisible style (e.g. visibility: none) ElementNotFound error is occurred.

Solution

You want to find it you should add visible option.

page.find("#delete-button", :visible => :all)

visible (Boolean, Symbol)