-
-
Notifications
You must be signed in to change notification settings - Fork 97
Add support for Node#obscured?
#291
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
Conversation
67761db
to
f7b4a1d
Compare
f7b4a1d
to
d29cde6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything suspicious, but it is not up to me to approve
Nice that you extracted chunk to ferrum
d29cde6
to
ef7fdb2
Compare
Nice work! Let me take a thorough look and I get back to you |
lib/capybara/cuprite/browser.rb
Outdated
|
||
switch_to_frame(:parent) | ||
begin | ||
obscured?(frame_node, x, y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be possible to check it even without switching frames, but not 100%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried removing just this frame switching but it broke the implementation - the original implementation of isObscured
calls document.elementFromPoint(px, py)
(always on the current window
) and doesn't know how to traverse nested frames.
I've gone ahead and reimplemented the nested frame handling in JavaScript - Although I think it'd probably be a bit more concise to use recursion, I've used iteration as that's what's been used elsewhere (e.g. _frameOffset
).
Ports `Capybara::Selenium::Node#obscured?` to Cuprite. N.B. Support for nested iframes is not yet implemented.
Co-authored-by: Ivan Kuchin <tadump+git@gmail.com>
ef7fdb2
to
bc037f6
Compare
Teaches `isObscured` how to traverse nested frames.
Although `Capybara::Selenium::Node#obscured?` accepts `x` and `y` arguments, these parameters do not appear to part of the public Capybara API.
bc037f6
to
91eb89f
Compare
Awesome thanks! |
This PR adds initial support for
Node#obscured?
.Enables the
obscured:
option withCapybara::Node::Finders#all
,Capybara::Node::Finders#find
and the various assertion methods and matchers that support the same options, e.g.Essentially it is a port of
Capybara::Selenium::Node#obscured?
including the injected script (Capybara::Selenium::Node::OBSCURED_OR_OFFSET_SCRIPT
).A couple things to note:
undefined method
execution_id!' for nil` error (details below).Ferrum::Frame
is not aFerrum::Node
- in the Selenium implementation, frames areCapybara::Node::Element
.The code that gets the correspondingiframe
Node
for a given frame is hacky - ideallyFerrum::Frame
would provided a#to_node
node or similar.Ferrum::Frame#node
: feat: AddFrame#frame_element
method ferrum#524 - This PR isn't dependent on the upstream PR being merged, but it could easily be adapted.undefined method `execution_id!' for nil
stack trace