Skip to content

docs(context): note that wait_for_new_page misses pages opened by a modifier or middle click - #712

Merged
route merged 1 commit into
mainfrom
docs/new-page-without-opener
Nov 20, 2026
Merged

route merged 1 commit into
mainfrom
docs/new-page-without-opener

Conversation

@route

@route route commented Nov 20, 2026

Copy link
Copy Markdown
Member

What

Documents which opened pages wait_for_new_page and wait_for_new_page! return, in docs/3-navigation.md and in the YARD of Context#wait_for_new_page.

Why

Both match a new page target by its opener id. Chrome only sets it for a page another page opened. Checked on Chrome 157 against the raw Target.getTargets output:

How the page is opened openerId
window.open, with or without noopener set
click on a target="_blank" link, with or without rel="noopener" set
Cmd or Shift click on a link not set
middle click on a link not set

So a page the user opens from a link is not returned, and pages(&:opener_id) leaves it out too. The docs now say so and show how to find such a page:

known = browser.targets.keys
browser.at_css("a").click(keys: [:ctrl]) # :meta on macOS
browser.pages { |t| !known.include?(t.id) } # => [#<Ferrum::Page>]

Docs only, no behavior change.

@route
route merged commit 15bd08e into main Nov 20, 2026
7 checks passed
@route
route deleted the docs/new-page-without-opener branch November 20, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant