Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: annotate evaluate(pageFunction) js-specific (#4954)
Pavel Feldmanb7e0b1b393c6
diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.mdindex 223fa7aa5e..ba643d7fdf 100644--- a/docs/src/api/class-elementhandle.md+++ b/docs/src/api/class-elementhandle.md@@ -66,6 +66,7 @@ expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');### param: ElementHandle.$eval.selector = %%-query-selector-%%### param: ElementHandle.$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Element]\)>Function to be evaluated in browser context@@ -106,6 +107,7 @@ expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).### param: ElementHandle.$$eval.selector = %%-query-selector-%%### param: ElementHandle.$$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Array]<[Element]>\)>Function to be evaluated in browser contextdiff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.mdindex e51f30fe7e..f16872ae80 100644--- a/docs/src/api/class-frame.md+++ b/docs/src/api/class-frame.md@@ -86,6 +86,7 @@ const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + s### param: Frame.$eval.selector = %%-query-selector-%%### param: Frame.$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Element]\)>Function to be evaluated in browser context@@ -118,6 +119,7 @@ const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min,### param: Frame.$$eval.selector = %%-query-selector-%%### param: Frame.$$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Array]<[Element]>\)>Function to be evaluated in browser context@@ -134,12 +136,25 @@ Returns the added tag when the script's onload fires or when the script contentAdds a `<script>` tag into the page with the desired url or content.-### param: Frame.addScriptTag.params-- `params` <[Object]>- - `url` <[string]> URL of a script to be added. Optional.- - `path` <[path]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.- - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.- - `type` <[string]> Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.+### option: Frame.addScriptTag.url+- `url` <[string]>++URL of a script to be added.++### option: Frame.addScriptTag.path+- `path` <[path]>++Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.++### option: Frame.addScriptTag.content+- `content` <[string]>++Raw JavaScript content to be injected into frame.++### option: Frame.addScriptTag.type+- `type` <[string]>++Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.## async method: Frame.addStyleTag- returns: <[ElementHandle]>@@ -149,11 +164,20 @@ Returns the added tag when the stylesheet's onload fires or when the CSS contentAdds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with thecontent.-### param: Frame.addStyleTag.params-- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag. Optional.- - `path` <[path]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.- - `content` <[string]> Raw CSS content to be injected into frame. Optional.+### option: Frame.addStyleTag.url+- `url` <[string]>++URL of the `<link>` tag.++### option: Frame.addStyleTag.path+- `path` <[path]>++Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.++### option: Frame.addStyleTag.content+- `content` <[string]>++Raw CSS content to be injected into frame.## async method: Frame.check@@ -324,6 +348,7 @@ await bodyHandle.dispose();```### param: Frame.evaluate.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in browser context@@ -365,6 +390,7 @@ await resultHandle.dispose();```### param: Frame.evaluateHandle.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in the page context@@ -790,6 +816,7 @@ await frame.waitForFunction(selector => !!document.querySelector(selector), sele```### param: Frame.waitForFunction.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in browser contextdiff --git a/docs/src/api/class-jshandle.md b/docs/src/api/class-jshandle.mdindex c37c7ccd2a..4067698bbd 100644--- a/docs/src/api/class-jshandle.md+++ b/docs/src/api/class-jshandle.md@@ -42,6 +42,7 @@ expect(await tweetHandle.evaluate((node, suffix) => node.innerText, ' retweets')```### param: JSHandle.evaluate.pageFunction+* langs: js- `pageFunction` <[function]>Function to be evaluated in browser context@@ -67,6 +68,7 @@ for the promise to resolve and return its value.See [`method: Page.evaluateHandle`] for more details.### param: JSHandle.evaluateHandle.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluateddiff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.mdindex ea67a9e875..6397d42135 100644--- a/docs/src/api/class-page.md+++ b/docs/src/api/class-page.md@@ -258,6 +258,7 @@ Shortcut for main frame's [`method: Frame.$eval`].### param: Page.$eval.selector = %%-query-selector-%%### param: Page.$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Element]\)>Function to be evaluated in browser context@@ -287,6 +288,7 @@ const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 1### param: Page.$$eval.selector = %%-query-selector-%%### param: Page.$$eval.pageFunction+* langs: js- `pageFunction` <[function]\([Array]<[Element]>\)>Function to be evaluated in browser context@@ -344,12 +346,25 @@ fires or when the script content was injected into frame.Shortcut for main frame's [`method: Frame.addScriptTag`].-### param: Page.addScriptTag.params-- `params` <[Object]>- - `url` <[string]> URL of a script to be added. Optional.- - `path` <[path]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.- - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.- - `type` <[string]> Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.+### option: Page.addScriptTag.url+- `url` <[string]>++URL of a script to be added.++### option: Page.addScriptTag.path+- `path` <[path]>++Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.++### option: Page.addScriptTag.content+- `content` <[string]>++Raw JavaScript content to be injected into frame.++### option: Page.addScriptTag.type+- `type` <[string]>++Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.## async method: Page.addStyleTag- returns: <[ElementHandle]>@@ -359,11 +374,20 @@ content. Returns the added tag when the stylesheet's onload fires or when the CSShortcut for main frame's [`method: Frame.addStyleTag`].-### param: Page.addStyleTag.params-- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag. Optional.- - `path` <[path]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.- - `content` <[string]> Raw CSS content to be injected into frame. Optional.+### option: Page.addStyleTag.url+- `url` <[string]>++URL of the `<link>` tag.++### option: Page.addStyleTag.path+- `path` <[path]>++Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.++### option: Page.addStyleTag.content+- `content` <[string]>++Raw CSS content to be injected into frame.## async method: Page.bringToFront@@ -613,6 +637,7 @@ await bodyHandle.dispose();Shortcut for main frame's [`method: Frame.evaluate`].### param: Page.evaluate.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in the page context@@ -649,6 +674,7 @@ await resultHandle.dispose();```### param: Page.evaluateHandle.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in the page context@@ -1615,6 +1641,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), selecShortcut for main frame's [`method: Frame.waitForFunction`].### param: Page.waitForFunction.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in browser contextdiff --git a/docs/src/api/class-route.md b/docs/src/api/class-route.mdindex 0b21cd3a96..c5d7ddf100 100644--- a/docs/src/api/class-route.md+++ b/docs/src/api/class-route.md@@ -44,14 +44,26 @@ await page.route('**/*', (route, request) => {});```-### param: Route.continue.overrides-- `overrides` <[Object]>- - `url` <[string]> If set changes the request URL. New URL must have same protocol as original one.- - `method` <[string]> If set changes the request method (e.g. GET or POST)- - `postData` <[string]|[Buffer]> If set changes the post data of request- - `headers` <[Object]<[string], [string]>> If set changes the request HTTP headers. Header values will be converted to a string.+### option: Route.continue.url+- `url` <[string]>++If set changes the request URL. New URL must have same protocol as original one.++### option: Route.continue.method+- `method` <[string]>++If set changes the request method (e.g. GET or POST)++### option: Route.continue.postData+- `postData` <[string]|[Buffer]>++If set changes the post data of request++### option: Route.continue.headers+- `headers` <[Object]<[string], [string]>>++If set changes the request HTTP headers. Header values will be converted to a string.-Optional request overrides, can override following properties:## async method: Route.fulfill@@ -75,15 +87,30 @@ An example of serving static file:await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));```-### param: Route.fulfill.response-- `response` <[Object]>- - `status` <[int]> Response status code, defaults to `200`.- - `headers` <[Object]<[string], [string]>> Optional response headers. Header values will be converted to a string.- - `contentType` <[string]> If set, equals to setting `Content-Type` response header.- - `body` <[string]|[Buffer]> Optional response body.- - `path` <[path]> Optional file path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory.+### option: Route.fulfill.status+- `status` <[int]>++Response status code, defaults to `200`.++### option: Route.fulfill.headers+- `headers` <[Object]<[string], [string]>>++Response headers. Header values will be converted to a string.++### option: Route.fulfill.contentType+- `contentType` <[string]>++If set, equals to setting `Content-Type` response header.++### option: Route.fulfill.body+- `body` <[string]|[Buffer]>++Response body.++### option: Route.fulfill.path+- `path` <[path]>-Response that will fulfill this route's request.+File path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory.## method: Route.request- returns: <[Request]>diff --git a/docs/src/api/class-worker.md b/docs/src/api/class-worker.mdindex ef6e3be75d..08cc3fdb84 100644--- a/docs/src/api/class-worker.md+++ b/docs/src/api/class-worker.md@@ -33,6 +33,7 @@ If the function passed to the `worker.evaluate` returns a non-[Serializable] val`-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.### param: Worker.evaluate.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in the worker context@@ -54,6 +55,7 @@ If the function passed to the `worker.evaluateHandle` returns a [Promise], thenthe promise to resolve and return its value.### param: Worker.evaluateHandle.pageFunction+* langs: js- `pageFunction` <[function]|[string]>Function to be evaluated in the page contextdiff --git a/docs/src/api/params.md b/docs/src/api/params.mdindex 5c4661003f..17106edb4f 100644--- a/docs/src/api/params.md+++ b/docs/src/api/params.md@@ -316,6 +316,19 @@ Receives the event data and resolves to truthy value when the waiting should resMaximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`].+## python-evaluate-expression+* langs: python+- `expression` <string>++JavaScript expression to be evaluated in the browser context. If it looks like a function declaration,+it is interpreted as a function. Otherwise, evaluated as an expression.++## python-evaluate-force-expression+* langs: python+- `force_expr` <boolean>++Whether to treat given `expression` as JavaScript evaluate expression, even though it looks like an arrow function.+Optional.## shared-context-params-list- %%-context-option-acceptdownloads-%%diff --git a/docs/src/api/python.md b/docs/src/api/python.mdindex ee4dc404cb..3ee737b909 100644--- a/docs/src/api/python.md+++ b/docs/src/api/python.md@@ -102,3 +102,37 @@ value. Optional.### option: Page.waitForEvent.timeout = %%-python-wait-for-event-timeout-%%### option: WebSocket.waitForEvent.predicate = %%-python-wait-for-event-predicate-%%### option: WebSocket.waitForEvent.timeout = %%-python-wait-for-event-timeout-%%++### param: ElementHandle.$eval.expression = %%-python-evaluate-expression-%%+### param: ElementHandle.$$eval.expression = %%-python-evaluate-expression-%%+### param: Frame.$eval.expression = %%-python-evaluate-expression-%%+### param: Frame.$$eval.expression = %%-python-evaluate-expression-%%+### param: Frame.evaluate.expression = %%-python-evaluate-expression-%%+### param: Frame.evaluateHandle.expression = %%-python-evaluate-expression-%%+### param: Frame.waitForFunction.expression = %%-python-evaluate-expression-%%+### param: JSHandle.evaluate.expression = %%-python-evaluate-expression-%%+### param: JSHandle.evaluateHandle.expression = %%-python-evaluate-expression-%%+### param: Page.$eval.expression = %%-python-evaluate-expression-%%+### param: Page.$$eval.expression = %%-python-evaluate-expression-%%+### param: Page.evaluate.expression = %%-python-evaluate-expression-%%+### param: Page.evaluateHandle.expression = %%-python-evaluate-expression-%%+### param: Page.waitForFunction.expression = %%-python-evaluate-expression-%%+### param: Worker.evaluate.expression = %%-python-evaluate-expression-%%+### param: Worker.evaluateHandle.expression = %%-python-evaluate-expression-%%++### param: ElementHandle.$eval.expression = %%-python-evaluate-force-expression-%%+### param: ElementHandle.$$eval.expression = %%-python-evaluate-force-expression-%%+### param: Frame.$eval.expression = %%-python-evaluate-force-expression-%%+### param: Frame.$$eval.expression = %%-python-evaluate-force-expression-%%+### param: Frame.evaluate.expression = %%-python-evaluate-force-expression-%%+### param: Frame.evaluateHandle.expression = %%-python-evaluate-force-expression-%%+### param: Frame.waitForFunction.expression = %%-python-evaluate-force-expression-%%+### param: JSHandle.evaluate.expression = %%-python-evaluate-force-expression-%%+### param: JSHandle.evaluateHandle.expression = %%-python-evaluate-force-expression-%%+### param: Page.$eval.expression = %%-python-evaluate-force-expression-%%+### param: Page.$$eval.expression = %%-python-evaluate-force-expression-%%+### param: Page.evaluate.expression = %%-python-evaluate-force-expression-%%+### param: Page.evaluateHandle.expression = %%-python-evaluate-force-expression-%%+### param: Page.waitForFunction.expression = %%-python-evaluate-force-expression-%%+### param: Worker.evaluate.expression = %%-python-evaluate-force-expression-%%+### param: Worker.evaluateHandle.expression = %%-python-evaluate-force-expression-%%diff --git a/src/client/frame.ts b/src/client/frame.tsindex a937e92316..3c78f67724 100644--- a/src/client/frame.ts+++ b/src/client/frame.ts@@ -284,9 +284,9 @@ export class Frame extends ChannelOwner<channels.FrameChannel, channels.FrameInireturn this._detached;}- async addScriptTag(params: { url?: string, path?: string, content?: string, type?: string }): Promise<ElementHandle> {+ async addScriptTag(options: { url?: string, path?: string, content?: string, type?: string } = {}): Promise<ElementHandle> {return this._wrapApiCall(this._apiName('addScriptTag'), async () => {- const copy = { ...params };+ const copy = { ...options };if (copy.path) {copy.content = (await fsReadFileAsync(copy.path)).toString();copy.content += '//# sourceURL=' + copy.path.replace(/\n/g, '');@@ -295,9 +295,9 @@ export class Frame extends ChannelOwner<channels.FrameChannel, channels.FrameIni});}- async addStyleTag(params: { url?: string; path?: string; content?: string; }): Promise<ElementHandle> {+ async addStyleTag(options: { url?: string; path?: string; content?: string; } = {}): Promise<ElementHandle> {return this._wrapApiCall(this._apiName('addStyleTag'), async () => {- const copy = { ...params };+ const copy = { ...options };if (copy.path) {copy.content = (await fsReadFileAsync(copy.path)).toString();copy.content += '/*# sourceURL=' + copy.path.replace(/\n/g, '') + '*/';diff --git a/src/client/network.ts b/src/client/network.tsindex e9595b8e0c..990ed99a9f 100644--- a/src/client/network.ts+++ b/src/client/network.ts@@ -185,49 +185,49 @@ export class Route extends ChannelOwner<channels.RouteChannel, channels.RouteIniawait this._channel.abort({ errorCode });}- async fulfill(response: { status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, path?: string }) {+ async fulfill(options: { status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, path?: string } = {}) {let body = '';let isBase64 = false;let length = 0;- if (response.path) {- const buffer = await util.promisify(fs.readFile)(response.path);+ if (options.path) {+ const buffer = await util.promisify(fs.readFile)(options.path);body = buffer.toString('base64');isBase64 = true;length = buffer.length;- } else if (isString(response.body)) {- body = response.body;+ } else if (isString(options.body)) {+ body = options.body;isBase64 = false;length = Buffer.byteLength(body);- } else if (response.body) {- body = response.body.toString('base64');+ } else if (options.body) {+ body = options.body.toString('base64');isBase64 = true;- length = response.body.length;+ length = options.body.length;}const headers: Headers = {};- for (const header of Object.keys(response.headers || {}))- headers[header.toLowerCase()] = String(response.headers![header]);- if (response.contentType)- headers['content-type'] = String(response.contentType);- else if (response.path)- headers['content-type'] = mime.getType(response.path) || 'application/octet-stream';+ for (const header of Object.keys(options.headers || {}))+ headers[header.toLowerCase()] = String(options.headers![header]);+ if (options.contentType)+ headers['content-type'] = String(options.contentType);+ else if (options.path)+ headers['content-type'] = mime.getType(options.path) || 'application/octet-stream';if (length && !('content-length' in headers))headers['content-length'] = String(length);await this._channel.fulfill({- status: response.status || 200,+ status: options.status || 200,headers: headersObjectToArray(headers),body,isBase64});}- async continue(overrides: { url?: string, method?: string, headers?: Headers, postData?: string | Buffer } = {}) {- const postDataBuffer = isString(overrides.postData) ? Buffer.from(overrides.postData, 'utf8') : overrides.postData;+ async continue(options: { url?: string, method?: string, headers?: Headers, postData?: string | Buffer } = {}) {+ const postDataBuffer = isString(options.postData) ? Buffer.from(options.postData, 'utf8') : options.postData;await this._channel.continue({- url: overrides.url,- method: overrides.method,- headers: overrides.headers ? headersObjectToArray(overrides.headers) : undefined,+ url: options.url,+ method: options.method,+ headers: options.headers ? headersObjectToArray(options.headers) : undefined,postData: postDataBuffer ? postDataBuffer.toString('base64') : undefined,});}diff --git a/src/client/page.ts b/src/client/page.tsindex 3c670a030b..86244fbc1a 100644--- a/src/client/page.ts+++ b/src/client/page.ts@@ -296,12 +296,12 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitiareturn this._attributeToPage(() => this._mainFrame.$$(selector));}- async addScriptTag(params: { url?: string; path?: string; content?: string; type?: string; }): Promise<ElementHandle> {- return this._attributeToPage(() => this._mainFrame.addScriptTag(params));+ async addScriptTag(options: { url?: string; path?: string; content?: string; type?: string; } = {}): Promise<ElementHandle> {+ return this._attributeToPage(() => this._mainFrame.addScriptTag(options));}- async addStyleTag(params: { url?: string; path?: string; content?: string; }): Promise<ElementHandle> {- return this._attributeToPage(() => this._mainFrame.addStyleTag(params));+ async addStyleTag(options: { url?: string; path?: string; content?: string; } = {}): Promise<ElementHandle> {+ return this._attributeToPage(() => this._mainFrame.addStyleTag(options));}async exposeFunction(name: string, callback: Function) {@@ -403,7 +403,7 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitia});}- async emulateMedia(params: { media?: 'screen' | 'print' | null, colorScheme?: 'dark' | 'light' | 'no-preference' | null }) {+ async emulateMedia(params: { media?: 'screen' | 'print' | null, colorScheme?: 'dark' | 'light' | 'no-preference' | null } = {}) {return this._wrapApiCall('page.emulateMedia', async () => {await this._channel.emulateMedia({media: params.media === null ? 'null' : params.media,diff --git a/types/types.d.ts b/types/types.d.tsindex cf9e29f7c0..e594c10034 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -1309,30 +1309,30 @@ export interface Page {** Shortcut for main frame's* [frame.addScriptTag(…)](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameaddscripttag).- * @param params+ * @param options*/- addScriptTag(params: {+ addScriptTag(options?: {/**- * URL of a script to be added. Optional.+ * Raw JavaScript content to be injected into frame.*/- url?: string;+ content?: string;/*** Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the- * current working directory. Optional.+ * current working directory.*/path?: string;/**- * Raw JavaScript content to be injected into frame. Optional.+ * Script type. Use 'module' in order to load a Javascript ES6 module. See+ * [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.*/- content?: string;+ type?: string;/**- * Script type. Use 'module' in order to load a Javascript ES6 module. See- * [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.+ * URL of a script to be added.*/- type?: string;+ url?: string;}): Promise<ElementHandle>;/**@@ -1341,24 +1341,24 @@ export interface Page {** Shortcut for main frame's* [frame.addStyleTag(…)](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameaddstyletag).- * @param params+ * @param options*/- addStyleTag(params: {+ addStyleTag(options?: {/**- * URL of the `<link>` tag. Optional.+ * Raw CSS content to be injected into frame.*/- url?: string;+ content?: string;/*** Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the- * current working directory. Optional.+ * current working directory.*/path?: string;/**- * Raw CSS content to be injected into frame. Optional.+ * URL of the `<link>` tag.*/- content?: string;+ url?: string;}): Promise<ElementHandle>;/**@@ -3501,30 +3501,30 @@ export interface Frame {* Returns the added tag when the script's onload fires or when the script content was injected into frame.** Adds a `<script>` tag into the page with the desired url or content.- * @param params+ * @param options*/- addScriptTag(params: {+ addScriptTag(options?: {/**- * URL of a script to be added. Optional.+ * Raw JavaScript content to be injected into frame.*/- url?: string;+ content?: string;/*** Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the- * current working directory. Optional.+ * current working directory.*/path?: string;/**- * Raw JavaScript content to be injected into frame. Optional.+ * Script type. Use 'module' in order to load a Javascript ES6 module. See+ * [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.*/- content?: string;+ type?: string;/**- * Script type. Use 'module' in order to load a Javascript ES6 module. See- * [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.+ * URL of a script to be added.*/- type?: string;+ url?: string;}): Promise<ElementHandle>;/**@@ -3532,24 +3532,24 @@ export interface Frame {** Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the* content.- * @param params+ * @param options*/- addStyleTag(params: {+ addStyleTag(options?: {/**- * URL of the `<link>` tag. Optional.+ * Raw CSS content to be injected into frame.*/- url?: string;+ content?: string;/*** Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the- * current working directory. Optional.+ * current working directory.*/path?: string;/**- * Raw CSS content to be injected into frame. Optional.+ * URL of the `<link>` tag.*/- content?: string;+ url?: string;}): Promise<ElementHandle>;/**@@ -8855,13 +8855,13 @@ export interface Route {* });* ```*- * @param overrides Optional request overrides, can override following properties:+ * @param options*/- continue(overrides?: {+ continue(options?: {/**- * If set changes the request URL. New URL must have same protocol as original one.+ * If set changes the request HTTP headers. Header values will be converted to a string.*/- url?: string;+ headers?: { [key: string]: string; };/*** If set changes the request method (e.g. GET or POST)@@ -8874,9 +8874,9 @@ export interface Route {postData?: string|Buffer;/**- * If set changes the request HTTP headers. Header values will be converted to a string.+ * If set changes the request URL. New URL must have same protocol as original one.*/- headers?: { [key: string]: string; };+ url?: string;}): Promise<void>;/**@@ -8900,18 +8900,13 @@ export interface Route {* await page.route('**\/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));* ```*- * @param response Response that will fulfill this route's request.+ * @param options*/- fulfill(response: {+ fulfill(options?: {/**- * Response status code, defaults to `200`.+ * Response body.*/- status?: number;-- /**- * Optional response headers. Header values will be converted to a string.- */- headers?: { [key: string]: string; };+ body?: string|Buffer;/*** If set, equals to setting `Content-Type` response header.@@ -8919,15 +8914,20 @@ export interface Route {contentType?: string;/**- * Optional response body.+ * Response headers. Header values will be converted to a string.*/- body?: string|Buffer;+ headers?: { [key: string]: string; };/**- * Optional file path to respond with. The content type will be inferred from file extension. If `path` is a relative path,- * then it is resolved relative to the current working directory.+ * File path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it+ * is resolved relative to the current working directory.*/path?: string;++ /**+ * Response status code, defaults to `200`.+ */+ status?: number;}): Promise<void>;/**