-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check Ferrum::NodeNotFoundError to force Capybara reruns #125
base: main
Are you sure you want to change the base?
Conversation
@rogercampos thank you! Hm could we come up with the test somehow? Don't quite understand the issue or the consequences of this addition.. |
A test to assert
Capybara is responsible to manage the retry mechanism when finding nodes or interacting with the page in general. This always happens, when clicking a button but the page is still not loaded, or when the page changes because of JS dom manipulation for example. The underlying driver must communicate this to capybara by using exceptions. Either the https://github.com/teamcapybara/capybara/blob/3.33_stable/lib/capybara/node/base.rb#L56 Cuprite implemented this at the node level, but not in the driver, and Capybara is calling this from I don't know how drivers are supposed to interact with capybara, maybe the fix is someplace else. This is a backtrace example, where you can see the trace between capybara, cuprite and ferrum
|
Also hitting this issue. Thanks @rogercampos for the fix attempt!
Would the following alternative implementation also work? diff --git a/lib/capybara/cuprite/driver.rb b/lib/capybara/cuprite/driver.rb
index 75782be..a8e94cf 100644
--- a/lib/capybara/cuprite/driver.rb
+++ b/lib/capybara/cuprite/driver.rb
@@ -359,7 +359,8 @@ module Capybara::Cuprite
def invalid_element_errors
[Capybara::Cuprite::ObsoleteNode,
Capybara::Cuprite::MouseEventFailed,
- Ferrum::NoExecutionContextError]
+ Ferrum::NoExecutionContextError,
+ Ferrum::NodeNotFoundError]
end
def go_back With the benefit that if wait times out you get the original exception instead of maybe confusing |
I got the same problem. I tried it with the fork https://github.com/parachutehealth/cuprite and think, this is the better choice. |
Thanks for merging! I think this one can closed without merging. |
Hi, @rogercampos can you please check out this PR: #125? |
I realized cuprite is not respecting the wait time on
find
, same as described here:#122
Cuprite defines the following exceptions to be caught by capybara and allow retries:
But some find methods go via
Driver#find
->Browser#find
, not viaNode#find
, soFerrum::NodeNotFoundError
is not rescued and re-raised asCapybara::Cuprite::ObsoleteNode
.I added in this PR a rescue and re-raise also on
Browser#find
, but other solutions are also possible.