Repository navigation
feat(popups): add BrowserContext.evaluateOnNewDocument - #1136
Merged
Dmitry Gozman (dgozman) merged 1 commit intoFeb 28, 2020
Merged
Conversation
Dmitry Gozman (dgozman)
requested a review
from Andrey Lushnikov (aslushnikov)
February 27, 2020 15:54
Yury Semikhatsky (yury-s)
approved these changes
Feb 27, 2020
| - returns: <[Promise]> | ||
|
|
||
| Adds a function which would be invoked in one of the following scenarios: | ||
| - whenever the page is navigated |
There was a problem hiding this comment.
whenever a page is created in the context or navigated
|
|
||
| Adds a function which would be invoked in one of the following scenarios: | ||
| - whenever the page is navigated | ||
| - whenever the child frame is attached or navigated. In this case, the function is invoked in the context of the newly attached frame |
There was a problem hiding this comment.
whenever a child frame is attached or navigated in a page in the browser context
| // preload.js | ||
|
|
||
| // overwrite the `languages` property to use a custom getter | ||
| Object.defineProperty(navigator, "languages", { |
There was a problem hiding this comment.
We have a better support for overriding locale, so maybe rewrite the example to use aforementioned Math.random ?
| await page.evaluateOnNewDocument(preloadFile); | ||
| ``` | ||
|
|
||
| > **NOTE** The order of evaluation of multiple scripts installed via [browserContext.evaluateOnNewDocument(pageFunction[, ...args])](#browsercontextevaluateonnewdocumentpagefunction-args) and [page.evaluateOnNewDocument(pageFunction[, ...args])](#pageevaluateonnewdocumentpagefunction-args) is not defined. |
There was a problem hiding this comment.
Can we make it deterministic, is it chromium backend limitation?
Debbie O'Brien (debs-obrien)
pushed a commit
to debs-obrien/playwright
that referenced
this pull request
Jun 10, 2025
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.
No description provided.