Repository navigation
feat(driver): open a window instead of a tab with open_new_window(:window) - #384
Merged
Merged
Conversation
…ndow) Capybara passes the kind only to a driver whose open_new_window takes an argument, so :window opened a tab. It now calls create_target(new_window: true). Ferrum 0.21 doesn't take new_window: yet, so Cuprite prepends rubycdp/ferrum#733's create_target to Ferrum::Context unless Ferrum's already takes it. A kind other than :tab and :window raises ArgumentError.
route
force-pushed
the
feat/open-new-window-kind
branch
from
November 25, 2026 10:44
3ddd034 to
263791c
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.
Session#open_new_window(kind = :tab)passeskindonly to a driver whoseopen_new_windowtakes an argument. Cuprite's took none, soopen_new_window(:window)opened a tab.Driver#open_new_window(kind = :tab)passes the kind toBrowser#open_new_window, which callsdefault_context.create_target(new_window: kind == :window). Any other kind raisesArgumentError, as Selenium does.create_targetdoesn't takenew_window:yet. feat(context): open a window instead of a tab with new_window: ferrum#733 adds it, but that isn't released.lib/capybara/cuprite/context.rbprepends #733's version of the method toFerrum::ContextasFerrum::Context::NewWindow. It waits on the target the way Ferrum does, with no polling. The prepend is skipped when Ferrum's owncreate_targetalready takesnew_window:, so after the Ferrum release the file switches itself off and can be deleted.Driver#open_new_window. One checks that a tab shares the current window'swindow_id, one that:windowgets its own, and one covers theArgumentError.