Repository navigation
Conversation
Every URL-loading command (shot, multi, pdf, html, javascript,
accessibility, har and video) now accepts --wait-until, which is passed
through to Playwright's page.goto(). It accepts commit, domcontentloaded,
load (the default) and networkidle.
This helps with single page apps that hold open long-lived connections
(WebSockets, server-sent events) and so never fire the `load` event —
today navigation to those pages hangs until it times out. Passing
--wait-until domcontentloaded lets the shot/recording proceed as soon as
the DOM is ready.
For `multi`, a per-shot `wait_until:` key in the YAML takes precedence
over the CLI default. When the option is unset wait_until is None, which
Playwright treats as its default ("load"), so behaviour is unchanged.
Docs regenerated with cog.
This branch has not been deployed
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.
What
Adds a
--wait-untiloption to every URL-loading command (shot,multi,pdf,html,javascript,accessibility,harandvideo). The value is passed straight through to Playwright'spage.goto(..., wait_until=...)and acceptscommit,domcontentloaded,load(the default) andnetworkidle.Why
shot-scrapercurrently relies on Playwright's defaultwait_until="load". Some single page apps hold open long-lived connections (WebSockets, server-sent events) and never fire theloadevent, so navigation hangs until it hits the timeout even though the page is fully usable. There's no way to change that today short of forking or monkeypatching.With this change:
shot-scraper 'https://my-single-page-app.example/' --wait-until domcontentloadedtakes the shot as soon as the DOM is ready.
Details
wait_until_optiondecorator next to the other option helpers.page.goto()call, including the full storyboard path forvideo(_record_storyboard→_run_storyboard_scene→_run_storyboard_action→_storyboard_goto).multi, a per-shotwait_until:key in the YAML takes precedence over the CLI default (same pattern as the other per-shot keys).wait_untilisNone, which Playwright treats as its default (load), so existing behaviour is unchanged. There's a test assertingpage.gotois still called withwait_until=Nonewhen the flag is omitted.authcommand out, since it's a login-session bootstrap rather than a content fetch — happy to add it if you'd prefer full consistency.Tests & docs
domcontentloaded, and that the value propagates into both theshot/take_shotdict path and the storyboardgotopath (plus theNonedefault).--helpdocs withcog -r docs/*.mdand added a short "Controlling when navigation is considered complete" section toscreenshots.md.All existing tests that pass on
mainin my environment still pass (the pre-existinghar/http.serverfailures are unrelated environment issues and fail identically without this change).📚 Documentation preview 📚: https://shot-scraper--199.org.readthedocs.build/en/199/