feat: Adds wait_until to go_to #199
Open
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.
Adds
wait_until
option to tab'sgo_to
methos to control when the navigation is considered complete.The available wait_until options are:
'load' (default): Waits until the load event is fired. This event signifies that the entire page, including all dependent resources like stylesheets, scripts, iframes, and images, has finished loading.
'domcontentloaded': Waits until the DOMContentLoaded event is fired. This event occurs when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, or subframes to finish loading.
Pull Request
Description
Changes the current behavior of
tab.go_to
to not only wait fordocument.readyState
. Instead allow users to specify the event they want to wait for. This PR adds an additional argumentwait_until
where the user can specify to wait untilPageEvent.LOAD_EVENT_FIRED
orPageEvent.DOM_CONTENT_EVENT_FIRED
is fired.Related Issue(s)
#194
Type of Change
How Has This Been Tested?
Updated browser tests and ensured test pass with
poetry run task test
Testing Checklist
Implementation Details
Created a asynccontextmaanger to handle pageload and dom event load pageevents. Quite similar to feature requested in #130
Making the wait_until public will address Issue 130 too.
API Changes
Additional optional
wait_until
input argument fortab.go_to
It accepts two options with the default been "load" to not change current behavior
Checklist before requesting a review
poetry run task lint
and fixed any issuespoetry run task test
and all tests pass