Fix driver node frame switching#312
Open
myabc wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes driver-level frame switching so Capybara::Cuprite::Driver#switch_to_frame can accept a Capybara::Cuprite::Node (not only wrapped Capybara::Node::Element), and adds a regression spec covering that usage.
Changes:
- Extend
Driver#switch_to_frameto extractframeIdfromCapybara::Cuprite::Node#description. - Add a feature spec that switches to an iframe using a driver-returned node and validates the frame URL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spec/features/session_spec.rb | Adds a regression spec for switching into a frame using a driver node. |
| lib/capybara/cuprite/driver.rb | Allows switch_to_frame to accept Capybara::Cuprite::Node and derive the frameId handle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Driver-level frame traversal can pass `Capybara::Cuprite::Node`. Resolve its `frameId` before switching so the frame stack stays valid.
7bf0c65 to
ac3e49e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Driver#switch_to_frameto acceptCapybara::Cuprite::NodeRoot Cause
Driver-level frame traversal can pass a
Capybara::Cuprite::Node, butswitch_to_frameonly extractedframeIdfrom wrappedCapybara::Node::Elementinstances. Direct driver nodes therefore pushed anilframe handle and left the frame stack invalid.Impact
Libraries that work below Capybara session DSL can now switch into iframe nodes returned by Cuprite driver APIs without losing context.
This change is needed to fully support Cuprite/Ferrum in another library: dequelabs/axe-core-gems#509
Validation
bundle exec rspec spec/features/session_spec.rb -e "frame support"bundle exec rspec spec/features/driver_spec.rb:1637git diff --check HEAD~1..HEAD