Repository navigation
Conversation
…and friends Waits split by mechanism. await_* runs a block and waits for the event it triggers, wait_* polls a check. Every one returns what it waited for or nil on timeout, and a bang version raises TimeoutError. - await_navigation(watch:) replaces wait_for_navigation and wait_for_reload, context.await_page replaces wait_for_new_page, page.await_download replaces downloads.wait and returns the download the block started - wait_css/wait_xpath replace wait_for_selector, network.wait_idle replaces wait_for_idle, node.wait_still replaces wait_for_stop_moving, page.wait_until polls any block - go_to!, refresh!, back! and forward! raise NavigationTimeoutError, the plain ones return nil; on_timeout: is gone - click(navigation_wait:) replaces wait:, false skips the wait - navigation moves to Page::Navigation; back on the first history entry no longer reloads the page - released names stay as deprecated shims until 0.22
route
force-pushed
the
ref/timeouts-and-wait-results
branch
from
November 23, 2026 08:43
d0931cb to
912e6ba
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.
The wait methods grew one at a time: positional timeouts with different hardcoded defaults, and different results on timeout (
false,nil, raising, or nothing useful). This splits them by mechanism and gives them one naming and return convention.await_*runs a block and waits for the event the block triggers:page.await_navigation { },context.await_page { },page.await_download { }.wait_*polls a check:wait_css,wait_xpath,network.wait_idle,node.wait_stillandpage.wait_until { }.Every one takes
timeout:as a keyword (the page timeout by default, 5 seconds for downloads) and returns what it waited for, ornilon timeout. The!version raisesTimeoutErrorinstead.Navigation follows the same rule.
go_to!,refresh!,back!andforward!raiseNavigationTimeoutError. The plain versions returnnil, andon_timeout:is gone. For code that may or may not navigate,await_navigation(watch: seconds) { }returnstruewhen nothing starts within that window. The click keyword is nownavigation_wait:, andfalseskips the wait. Navigation moves intoPage::Navigation, andbackon the first history entry no longer reloads the page.Released names keep working as deprecated shims until 0.22:
wait_for_navigation(!),wait_for_reload,wait_for_selector,network.wait_for_idle(!),downloads.wait,node.wait_for_stop_moving, positionalidle?(n)andclick(wait:).Breaking:
refresh,backandforwardreturnnilinstead of raisingTimeoutErrorwhen the page doesn't load in time, and they returntrueinstead of the raw CDP result.