According to api document...
find will wait for a set amount of time and continuously retry finding the element until either the element is found or the time expires. The length of time find will wait is controlled through Capybara.default_wait_time and defaults to 2 seconds.
You had better not set much time to
For example, if you set 10 seconds to
Capybara.default_wait_time when you want to check the element dose not exist.
Test time can be long. Because Capybara wait to check the element dose not exist in each test.
# in rspec.rb Capybara.default_wait_time = 10 # in feature test expect(page).to have_no_selector(:css, "p a#doesnotexist") # wait 10 seconds
If you need more than 2 seconds(default value in Capybara.default_wait_time) to wait to check you can set
wait option to find instead.
expect(page).to have_selector(:css, "p a#doesnotexist", wait: 3)