-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add waitForURL in frame and page #4920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ankur22
wants to merge
6
commits into
master
Choose a base branch
from
add/waitForUrl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
8b84803
to
2af3f2c
Compare
8 tasks
0e59b82
to
a05d7b7
Compare
82d6e92
to
e651203
Compare
17a3e84
to
8639485
Compare
2a7395a
to
afdd0d8
Compare
6614b61
to
0c0050c
Compare
ff4ae78
to
daa30bb
Compare
The implementation and the behaviour was copied from Playwright.
ankur22
commented
Jul 18, 2025
Comment on lines
+432
to
+438
var val string | ||
switch url.ExportType() { | ||
case reflect.TypeOf(string("")): | ||
val = fmt.Sprintf("'%s'", url.String()) // Strings require quotes | ||
default: // JS Regex, CSS, numbers or booleans | ||
val = url.String() // No quotes | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will refactor this into a helper method once this PR is merged in. There are several other PRs which work with similar/same logic to differentiate between regex and strings.
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?
This adds support for a asked for API from Playwright --
page.waitForURL
. This API does a few things more than the equivalentpage.waitForNavigation({ url: ... })
:page.waitForNavigation({ url: ... })
.Why?
This is a more robust API than
page.waitForNavigation
when a user wants to wait for a specific URL, since it builds onpage.waitForNavigation
to prevent race conditions where a page completes navigation beforepage.waitForNavigation
is setup.It's just another convenient way of waiting for something specific when a navigation occurs, which is especially important when many redirects occur.
Note: It's still recommended that the user wait for specific elements or just work with the locator API which auto waits when the page does navigate to the specified URL.
Example usage:
Checklist
make check
) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
#4385