Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: mark optional properties/arguments explicitly with "?" (#13369)

Dmitry Gozmanc68f57d2d0cb
diff --git a/docs/src/api/class-androiddevice.md b/docs/src/api/class-androiddevice.md
index 560e225c06..bd7e607784 100644
--- a/docs/src/api/class-androiddevice.md
+++ b/docs/src/api/class-androiddevice.md
@@ -344,9 +344,9 @@ Waits for event to fire and passes its value into the predicate function. Return
### param: AndroidDevice.waitForEvent.event = %%-wait-for-event-event-%%
### param: AndroidDevice.waitForEvent.optionsOrPredicate
-- `optionsOrPredicate` <[function]|[Object]>
+- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve.
- - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to
+ - `timeout` ?<[float]> maximum 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: AndroidDevice.setDefaultTimeout`].
Either a predicate that receives an event or an options object. Optional.
diff --git a/docs/src/api/class-browser.md b/docs/src/api/class-browser.md
index 5912889296..4b7d3141e8 100644
--- a/docs/src/api/class-browser.md
+++ b/docs/src/api/class-browser.md
@@ -271,7 +271,7 @@ browser.stop_tracing()
```
### param: Browser.startTracing.page
-- `page` <[Page]>
+- `page` ?<[Page]>
Optional, if specified, tracing includes screenshots of the given page.
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index 660de17f9e..2d770f86d2 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -218,13 +218,13 @@ await context.AddCookiesAsync(new[] { cookie1, cookie2 });
- `cookies` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- - `url` <[string]> either url or domain / path are required. Optional.
- - `domain` <[string]> either url or domain / path are required Optional.
- - `path` <[string]> either url or domain / path are required Optional.
- - `expires` <[float]> Unix time in seconds. Optional.
- - `httpOnly` <[boolean]> Optional.
- - `secure` <[boolean]> Optional.
- - `sameSite` <[SameSiteAttribute]<"Strict"|"Lax"|"None">> Optional.
+ - `url` ?<[string]> either url or domain / path are required. Optional.
+ - `domain` ?<[string]> either url or domain / path are required Optional.
+ - `path` ?<[string]> either url or domain / path are required Optional.
+ - `expires` ?<[float]> Unix time in seconds. Optional.
+ - `httpOnly` ?<[boolean]> Optional.
+ - `secure` ?<[boolean]> Optional.
+ - `sameSite` ?<[SameSiteAttribute]<"Strict"|"Lax"|"None">> Optional.
## async method: BrowserContext.addInitScript
@@ -277,9 +277,9 @@ The order of evaluation of multiple scripts installed via [`method: BrowserConte
### param: BrowserContext.addInitScript.script
* langs: js
- `script` <[function]|[string]|[Object]>
- - `path` <[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
+ - `path` ?<[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
current working directory. Optional.
- - `content` <[string]> Raw script content. Optional.
+ - `content` ?<[string]> Raw script content. Optional.
Script to be evaluated in all pages in the browser context.
@@ -291,7 +291,7 @@ Script to be evaluated in all pages in the browser context.
### param: BrowserContext.addInitScript.arg
* langs: js
-- `arg` <[Serializable]>
+- `arg` ?<[Serializable]>
Optional argument to pass to [`param: script`] (only supported when passing a function).
@@ -378,7 +378,7 @@ If no URLs are specified, this method returns all cookies. If URLs are specified
are returned.
### param: BrowserContext.cookies.urls
-- `urls` <[string]|[Array]<[string]>>
+- `urls` ?<[string]|[Array]<[string]>>
Optional list of URLs.
@@ -1127,7 +1127,7 @@ its geolocation.
- `geolocation` <[null]|[Object]>
- `latitude` <[float]> Latitude between -90 and 90.
- `longitude` <[float]> Longitude between -180 and 180.
- - `accuracy` <[float]> Non-negative accuracy value. Defaults to `0`.
+ - `accuracy` ?<[float]> Non-negative accuracy value. Defaults to `0`.
## async method: BrowserContext.setHTTPCredentials
* langs: js
@@ -1187,13 +1187,13 @@ A glob pattern, regex pattern or predicate receiving [URL] used to register a ro
### param: BrowserContext.unroute.handler
* langs: js, python
-- `handler` <[function]\([Route], [Request]\)>
+- `handler` ?<[function]\([Route], [Request]\)>
Optional handler function used to register a routing with [`method: BrowserContext.route`].
### param: BrowserContext.unroute.handler
* langs: csharp, java
-- `handler` <[function]\([Route]\)>
+- `handler` ?<[function]\([Route]\)>
Optional handler function used to register a routing with [`method: BrowserContext.route`].
@@ -1242,9 +1242,9 @@ Event name, same one would pass into `browserContext.on(event)`.
### param: BrowserContext.waitForEvent.optionsOrPredicate
* langs: js
-- `optionsOrPredicate` <[function]|[Object]>
+- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve.
- - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to
+ - `timeout` ?<[float]> maximum 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`].
Either a predicate that receives an event or an options object. Optional.
diff --git a/docs/src/api/class-cdpsession.md b/docs/src/api/class-cdpsession.md
index 8f9943cd79..b690b7b4f0 100644
--- a/docs/src/api/class-cdpsession.md
+++ b/docs/src/api/class-cdpsession.md
@@ -56,9 +56,9 @@ send messages.
### param: CDPSession.send.method
- `method` <[string]>
-protocol method name
+Protocol method name.
### param: CDPSession.send.params
-- `params` <[Object]>
+- `params` ?<[Object]>
-Optional method parameters
+Optional method parameters.
diff --git a/docs/src/api/class-coverage.md b/docs/src/api/class-coverage.md
index 4aeaf2ec6a..679c7dae30 100644
--- a/docs/src/api/class-coverage.md
+++ b/docs/src/api/class-coverage.md
@@ -61,7 +61,7 @@ Whether anonymous scripts generated by the page should be reported. Defaults to
## async method: Coverage.stopCSSCoverage
- returns: <[Array]<[Object]>>
- `url` <[string]> StyleSheet URL
- - `text` <[string]> StyleSheet content, if available.
+ - `text` ?<[string]> StyleSheet content, if available.
- `ranges` <[Array]<[Object]>> StyleSheet ranges that were used. Ranges are sorted and non-overlapping.
- `start` <[int]> A start offset in text, inclusive
- `end` <[int]> An end offset in text, exclusive
@@ -76,7 +76,7 @@ CSS Coverage doesn't include dynamically injected style tags without sourceURLs.
- returns: <[Array]<[Object]>>
- `url` <[string]> Script URL
- `scriptId` <[string]> Script ID
- - `source` <[string]> Script content, if applicable.
+ - `source` ?<[string]> Script content, if applicable.
- `functions` <[Array]<[Object]>> V8-specific coverage format.
- `functionName` <[string]>
- `isBlockCoverage` <[boolean]>
diff --git a/docs/src/api/class-dialog.md b/docs/src/api/class-dialog.md
index 2915851d15..55bb757611 100644
--- a/docs/src/api/class-dialog.md
+++ b/docs/src/api/class-dialog.md
@@ -113,7 +113,7 @@ When listener is present, it **must** either [`method: Dialog.accept`] or [`meth
Returns when the dialog has been accepted.
### param: Dialog.accept.promptText
-- `promptText` <[string]>
+- `promptText` ?<[string]>
A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.
diff --git a/docs/src/api/class-electronapplication.md b/docs/src/api/class-electronapplication.md
index c3df783c9a..80f25302fa 100644
--- a/docs/src/api/class-electronapplication.md
+++ b/docs/src/api/class-electronapplication.md
@@ -79,7 +79,7 @@ some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infini
### param: ElectronApplication.evaluate.expression = %%-evaluate-expression-%%
### param: ElectronApplication.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -96,7 +96,9 @@ If the function passed to the [`method: ElectronApplication.evaluateHandle`] ret
### param: ElectronApplication.evaluateHandle.expression = %%-evaluate-expression-%%
### param: ElectronApplication.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
+
+Optional argument to pass to [`param: expression`].
## async method: ElectronApplication.firstWindow
- returns: <[Page]>
@@ -133,9 +135,9 @@ const [window] = await Promise.all([
### param: ElectronApplication.waitForEvent.optionsOrPredicate
* langs: js
-- `optionsOrPredicate` <[function]|[Object]>
+- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve.
- - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to
+ - `timeout` ?<[float]> maximum 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`].
Either a predicate that receives an event or an options object. Optional.
diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md
index 25805e742c..b40d48bd2f 100644
--- a/docs/src/api/class-elementhandle.md
+++ b/docs/src/api/class-elementhandle.md
@@ -330,7 +330,7 @@ await elementHandle.DispatchEventAsync("dragstart", new Dictionary<string, objec
DOM event type: `"click"`, `"dragstart"`, etc.
### param: ElementHandle.dispatchEvent.eventInit
-- `eventInit` <[EvaluationArgument]>
+- `eventInit` ?<[EvaluationArgument]>
Optional event-specific initialization properties.
@@ -386,7 +386,7 @@ Assert.AreEqual("10", await tweetHandle.EvalOnSelectorAsync(".retweets", "node =
### param: ElementHandle.evalOnSelector.expression = %%-evaluate-expression-%%
### param: ElementHandle.evalOnSelector.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -444,7 +444,7 @@ Assert.AreEqual(new [] { "Hello!", "Hi!" }, await feedHandle.EvalOnSelectorAllAs
### param: ElementHandle.evalOnSelectorAll.expression = %%-evaluate-expression-%%
### param: ElementHandle.evalOnSelectorAll.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/class-error.md b/docs/src/api/class-error.md
index 8e797a4add..4f173dada4 100644
--- a/docs/src/api/class-error.md
+++ b/docs/src/api/class-error.md
@@ -16,11 +16,11 @@ inherit from this class.
Message of the error.
## property: Error.name
-- returns: <[str]>
+- returns: ?<[str]>
Name of the error which got thrown inside the browser. Optional.
## property: Error.stack
-- returns: <[str]>
+- returns: ?<[str]>
Stack of the error which got thrown inside the browser. Optional.
diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md
index 54beea5ea6..0eb9bb7fe4 100644
--- a/docs/src/api/class-frame.md
+++ b/docs/src/api/class-frame.md
@@ -352,7 +352,7 @@ await frame.DispatchEventAsync("#source", "dragstart", new { dataTransfer });
DOM event type: `"click"`, `"dragstart"`, etc.
### param: Frame.dispatchEvent.eventInit
-- `eventInit` <[EvaluationArgument]>
+- `eventInit` ?<[EvaluationArgument]>
Optional event-specific initialization properties.
@@ -430,7 +430,7 @@ var html = await frame.EvalOnSelectorAsync(".main-container", "(e, suffix) => e.
### param: Frame.evalOnSelector.selector = %%-query-selector-%%
### param: Frame.evalOnSelector.expression = %%-evaluate-expression-%%
### param: Frame.evalOnSelector.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -481,7 +481,7 @@ var divsCount = await frame.EvalOnSelectorAllAsync<bool>("div", "(divs, min) =>
### param: Frame.evalOnSelectorAll.expression = %%-evaluate-expression-%%
### param: Frame.evalOnSelectorAll.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -587,7 +587,7 @@ await bodyHandle.DisposeAsync();
### param: Frame.evaluate.expression = %%-evaluate-expression-%%
### param: Frame.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -689,7 +689,7 @@ await resultHandle.DisposeAsync();
### param: Frame.evaluateHandle.expression = %%-evaluate-expression-%%
### param: Frame.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -1445,7 +1445,7 @@ await page.MainFrame.WaitForFunctionAsync("selector => !!document.querySelector(
### param: Frame.waitForFunction.expression = %%-evaluate-expression-%%
### param: Frame.waitForFunction.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/class-jshandle.md b/docs/src/api/class-jshandle.md
index 026166fda3..3f56c2d6e5 100644
--- a/docs/src/api/class-jshandle.md
+++ b/docs/src/api/class-jshandle.md
@@ -83,7 +83,7 @@ Assert.AreEqual("10 retweets", await tweetHandle.EvaluateAsync("node => node.inn
### param: JSHandle.evaluate.expression = %%-evaluate-expression-%%
### param: JSHandle.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -104,7 +104,7 @@ See [`method: Page.evaluateHandle`] for more details.
### param: JSHandle.evaluateHandle.expression = %%-evaluate-expression-%%
### param: JSHandle.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md
index 7bd9b3abe7..ce4d18affd 100644
--- a/docs/src/api/class-locator.md
+++ b/docs/src/api/class-locator.md
@@ -223,7 +223,7 @@ await element.DispatchEventAsync("dragstart", new Dictionary<string, object>
DOM event type: `"click"`, `"dragstart"`, etc.
### param: Locator.dispatchEvent.eventInit
-- `eventInit` <[EvaluationArgument]>
+- `eventInit` ?<[EvaluationArgument]>
Optional event-specific initialization properties.
@@ -294,7 +294,7 @@ Assert.AreEqual("10 retweets", await tweets.EvaluateAsync("node => node.innerTex
### param: Locator.evaluate.expression = %%-evaluate-expression-%%
### param: Locator.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -339,7 +339,7 @@ var divsCount = await elements.EvaluateAll<bool>("(divs, min) => divs.length >=
### param: Locator.evaluateAll.expression = %%-evaluate-expression-%%
### param: Locator.evaluateAll.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -361,7 +361,7 @@ See [`method: Page.evaluateHandle`] for more details.
### param: Locator.evaluateHandle.expression = %%-evaluate-expression-%%
### param: Locator.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/class-logger.md b/docs/src/api/class-logger.md
index 159ae99fa0..d7be810a21 100644
--- a/docs/src/api/class-logger.md
+++ b/docs/src/api/class-logger.md
@@ -52,6 +52,6 @@ message arguments
### param: Logger.log.hints
- `hints` <[Object]>
- - `color` <[string]> Optional preferred logger color.
+ - `color` ?<[string]> Optional preferred logger color.
optional formatting hints
diff --git a/docs/src/api/class-mouse.md b/docs/src/api/class-mouse.md
index 31e7009b50..da0d41dff1 100644
--- a/docs/src/api/class-mouse.md
+++ b/docs/src/api/class-mouse.md
@@ -111,7 +111,7 @@ Dispatches a `mousemove` event.
### option: Mouse.move.steps
- `steps` <[int]>
-defaults to 1. Sends intermediate `mousemove` events.
+Defaults to 1. Sends intermediate `mousemove` events.
## async method: Mouse.up
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 26f35e2c5c..9bcf7e1ba5 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -587,9 +587,9 @@ The order of evaluation of multiple scripts installed via [`method: BrowserConte
### param: Page.addInitScript.script
* langs: js
- `script` <[function]|[string]|[Object]>
- - `path` <[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
+ - `path` ?<[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
current working directory. Optional.
- - `content` <[string]> Raw script content. Optional.
+ - `content` ?<[string]> Raw script content. Optional.
Script to be evaluated in the page.
@@ -601,7 +601,7 @@ Script to be evaluated in all pages in the browser context.
### param: Page.addInitScript.arg
* langs: js
-- `arg` <[Serializable]>
+- `arg` ?<[Serializable]>
Optional argument to pass to [`param: script`] (only supported when passing a function).
@@ -874,7 +874,7 @@ await page.DispatchEventAsync("#source", "dragstart", new { dataTransfer });
DOM event type: `"click"`, `"dragstart"`, etc.
### param: Page.dispatchEvent.eventInit
-- `eventInit` <[EvaluationArgument]>
+- `eventInit` ?<[EvaluationArgument]>
Optional event-specific initialization properties.
@@ -1155,7 +1155,7 @@ Shortcut for main frame's [`method: Frame.evalOnSelector`].
### param: Page.evalOnSelector.selector = %%-query-selector-%%
### param: Page.evalOnSelector.expression = %%-evaluate-expression-%%
### param: Page.evalOnSelector.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -1202,7 +1202,7 @@ var divsCount = await page.EvalOnSelectorAllAsync<bool>("div", "(divs, min) => d
### param: Page.evalOnSelectorAll.selector = %%-query-selector-%%
### param: Page.evalOnSelectorAll.expression = %%-evaluate-expression-%%
### param: Page.evalOnSelectorAll.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -1314,7 +1314,7 @@ Shortcut for main frame's [`method: Frame.evaluate`].
### param: Page.evaluate.expression = %%-evaluate-expression-%%
### param: Page.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -1415,7 +1415,7 @@ await resultHandle.DisposeAsync();
### param: Page.evaluateHandle.expression = %%-evaluate-expression-%%
### param: Page.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -1909,8 +1909,8 @@ var frame = page.FrameByUrl(".*domain.*");
### param: Page.frame.frameSelector
* langs: js
- `frameSelector` <[string]|[Object]>
- - `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.
- - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving
+ - `name` ?<[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.
+ - `url` ?<[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving
frame's `url` as a [URL] object. Optional.
Frame name or other frame lookup options.
@@ -2387,20 +2387,20 @@ Paper height, accepts values labeled with units.
### option: Page.pdf.margin
* langs: js, python
- `margin` <[Object]>
- - `top` <[string]|[float]> Top margin, accepts values labeled with units. Defaults to `0`.
- - `right` <[string]|[float]> Right margin, accepts values labeled with units. Defaults to `0`.
- - `bottom` <[string]|[float]> Bottom margin, accepts values labeled with units. Defaults to `0`.
- - `left` <[string]|[float]> Left margin, accepts values labeled with units. Defaults to `0`.
+ - `top` ?<[string]|[float]> Top margin, accepts values labeled with units. Defaults to `0`.
+ - `right` ?<[string]|[float]> Right margin, accepts values labeled with units. Defaults to `0`.
+ - `bottom` ?<[string]|[float]> Bottom margin, accepts values labeled with units. Defaults to `0`.
+ - `left` ?<[string]|[float]> Left margin, accepts values labeled with units. Defaults to `0`.
Paper margins, defaults to none.
### option: Page.pdf.margin
* langs: csharp, java
- `margin` <[Object]>
- - `top` <[string]> Top margin, accepts values labeled with units. Defaults to `0`.
- - `right` <[string]> Right margin, accepts values labeled with units. Defaults to `0`.
- - `bottom` <[string]> Bottom margin, accepts values labeled with units. Defaults to `0`.
- - `left` <[string]> Left margin, accepts values labeled with units. Defaults to `0`.
+ - `top` ?<[string]> Top margin, accepts values labeled with units. Defaults to `0`.
+ - `right` ?<[string]> Right margin, accepts values labeled with units. Defaults to `0`.
+ - `bottom` ?<[string]> Bottom margin, accepts values labeled with units. Defaults to `0`.
+ - `left` ?<[string]> Left margin, accepts values labeled with units. Defaults to `0`.
Paper margins, defaults to none.
@@ -3103,13 +3103,13 @@ A glob pattern, regex pattern or predicate receiving [URL] to match while routin
### param: Page.unroute.handler
* langs: js, python
-- `handler` <[function]\([Route], [Request]\)>
+- `handler` ?<[function]\([Route], [Request]\)>
Optional handler function to route the request.
### param: Page.unroute.handler
* langs: csharp, java
-- `handler` <[function]\([Route]\)>
+- `handler` ?<[function]\([Route]\)>
Optional handler function to route the request.
@@ -3205,9 +3205,9 @@ frame = event_info.value
### param: Page.waitForEvent.optionsOrPredicate
* langs: js
-- `optionsOrPredicate` <[function]|[Object]>
+- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve.
- - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to
+ - `timeout` ?<[float]> maximum 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`].
Either a predicate that receives an event or an options object. Optional.
@@ -3348,7 +3348,7 @@ Shortcut for main frame's [`method: Frame.waitForFunction`].
### param: Page.waitForFunction.expression = %%-evaluate-expression-%%
### param: Page.waitForFunction.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/class-response.md b/docs/src/api/class-response.md
index 6dd0c7da4c..5ff51e6098 100644
--- a/docs/src/api/class-response.md
+++ b/docs/src/api/class-response.md
@@ -84,14 +84,14 @@ Returns the matching [Request] object.
## async method: Response.securityDetails
- returns: <[null]|[Object]>
- - `issuer` <[string]> Common Name component of the Issuer field.
+ - `issuer` ?<[string]> Common Name component of the Issuer field.
from the certificate. This should only be used for informational purposes. Optional.
- - `protocol` <[string]> The specific TLS protocol used. (e.g. `TLS 1.3`). Optional.
- - `subjectName` <[string]> Common Name component of the Subject
+ - `protocol` ?<[string]> The specific TLS protocol used. (e.g. `TLS 1.3`). Optional.
+ - `subjectName` ?<[string]> Common Name component of the Subject
field from the certificate. This should only be used for informational purposes. Optional.
- - `validFrom` <[float]> Unix timestamp (in seconds) specifying
+ - `validFrom` ?<[float]> Unix timestamp (in seconds) specifying
when this cert becomes valid. Optional.
- - `validTo` <[float]> Unix timestamp (in seconds) specifying
+ - `validTo` ?<[float]> Unix timestamp (in seconds) specifying
when this cert becomes invalid. Optional.
Returns SSL and other security information.
diff --git a/docs/src/api/class-route.md b/docs/src/api/class-route.md
index 61dd9e3ad4..d1002c5da1 100644
--- a/docs/src/api/class-route.md
+++ b/docs/src/api/class-route.md
@@ -8,7 +8,7 @@ allows to handle the route.
Aborts the route's request.
### param: Route.abort.errorCode
-- `errorCode` <[string]>
+- `errorCode` ?<[string]>
Optional error code. Defaults to `failed`, could be one of the following:
* `'aborted'` - An operation was aborted (due to user action)
@@ -154,7 +154,7 @@ page.route("**/*", lambda route: route.fulfill(
```csharp
await page.RouteAsync("**/*", route => route.FulfillAsync(
status: 404,
- contentType: "text/plain",
+ contentType: "text/plain",
body: "Not Found!"));
```
diff --git a/docs/src/api/class-selectors.md b/docs/src/api/class-selectors.md
index 37d5c5c78b..60332f867e 100644
--- a/docs/src/api/class-selectors.md
+++ b/docs/src/api/class-selectors.md
@@ -176,9 +176,9 @@ contain `[a-zA-Z0-9_]` characters.
### param: Selectors.register.script
* langs: js
- `script` <[function]|[string]|[Object]>
- - `path` <[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
+ - `path` ?<[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the
current working directory. Optional.
- - `content` <[string]> Raw script content. Optional.
+ - `content` ?<[string]> Raw script content. Optional.
Script that evaluates to a selector engine instance.
diff --git a/docs/src/api/class-websocket.md b/docs/src/api/class-websocket.md
index 26e31799c8..13a3e5e071 100644
--- a/docs/src/api/class-websocket.md
+++ b/docs/src/api/class-websocket.md
@@ -57,9 +57,9 @@ Event name, same one would pass into `webSocket.on(event)`.
### param: WebSocket.waitForEvent.optionsOrPredicate
* langs: js
-- `optionsOrPredicate` <[function]|[Object]>
+- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve.
- - `timeout` <[float]> maximum 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`].
+ - `timeout` ?<[float]> maximum 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`].
Either a predicate that receives an event or an options object. Optional.
diff --git a/docs/src/api/class-worker.md b/docs/src/api/class-worker.md
index 121c1c8103..c29bf21999 100644
--- a/docs/src/api/class-worker.md
+++ b/docs/src/api/class-worker.md
@@ -70,7 +70,7 @@ additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`,
### param: Worker.evaluate.expression = %%-evaluate-expression-%%
### param: Worker.evaluate.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
@@ -89,7 +89,7 @@ the promise to resolve and return its value.
### param: Worker.evaluateHandle.expression = %%-evaluate-expression-%%
### param: Worker.evaluateHandle.arg
-- `arg` <[EvaluationArgument]>
+- `arg` ?<[EvaluationArgument]>
Optional argument to pass to [`param: expression`].
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 2b0f77a357..cf58f584d8 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -186,10 +186,10 @@ Dangerous option; use with care. Defaults to `false`.
- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example
`http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP
proxy.
- - `bypass` <[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org,
+ - `bypass` ?<[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org,
.domain.com"`.
- - `username` <[string]> Optional username to use if HTTP proxy requires authentication.
- - `password` <[string]> Optional password to use if HTTP proxy requires authentication.
+ - `username` ?<[string]> Optional username to use if HTTP proxy requires authentication.
+ - `password` ?<[string]> Optional password to use if HTTP proxy requires authentication.
Network proxy settings.
@@ -456,7 +456,7 @@ for a list of supported timezone IDs.
- `geolocation` <[Object]>
- `latitude` <[float]> Latitude between -90 and 90.
- `longitude` <[float]> Longitude between -180 and 180.
- - `accuracy` <[float]> Non-negative accuracy value. Defaults to `0`.
+ - `accuracy` ?<[float]> Non-negative accuracy value. Defaults to `0`.
## context-option-locale
- `locale` <[string]>
@@ -532,7 +532,7 @@ Logger sink for Playwright logging.
## context-option-recordhar
* langs: js
- `recordHar` <[Object]>
- - `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to
+ - `omitContent` ?<[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to
`false`.
- `path` <[path]> Path on the filesystem to write the HAR file to.
@@ -560,7 +560,7 @@ Optional setting to control whether to omit request content from the HAR. Defaul
* langs: js
- `recordVideo` <[Object]>
- `dir` <[path]> Path to the directory to put videos into.
- - `size` <[Object]> Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport`
+ - `size` ?<[Object]> Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport`
scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450.
Actual picture of each page will be scaled down if necessary to fit the specified size.
- `width` <[int]> Video frame width.
@@ -594,9 +594,9 @@ Actual picture of each page will be scaled down if necessary to fit the specifie
- `proxy` <[Object]>
- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example
`http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
- - `bypass` <[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
- - `username` <[string]> Optional username to use if HTTP proxy requires authentication.
- - `password` <[string]> Optional password to use if HTTP proxy requires authentication.
+ - `bypass` ?<[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
+ - `username` ?<[string]> Optional username to use if HTTP proxy requires authentication.
+ - `password` ?<[string]> Optional password to use if HTTP proxy requires authentication.
Network proxy settings to use with this context.
@@ -616,9 +616,9 @@ See [Locator] to learn more about the strict mode.
## select-options-values
* langs: java, js, csharp
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>>
- - `value` <[string]> Matches by `option.value`. Optional.
- - `label` <[string]> Matches by `option.label`. Optional.
- - `index` <[int]> Matches by the index. Optional.
+ - `value` ?<[string]> Matches by `option.value`. Optional.
+ - `label` ?<[string]> Matches by `option.label`. Optional.
+ - `index` ?<[int]> Matches by the index. Optional.
Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the
first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option
@@ -638,7 +638,7 @@ equal to the string.
Event name, same one typically passed into `*.on(event)`.
## wait-for-load-state-state
-- `state` <[LoadState]<"load"|"domcontentloaded"|"networkidle">>
+- `state` ?<[LoadState]<"load"|"domcontentloaded"|"networkidle">>
Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the
method resolves immediately. Can be one of:
@@ -660,26 +660,26 @@ Action that triggers the event.
## python-select-options-element
* langs: python
-- `element` <[ElementHandle]|[Array]<[ElementHandle]>>
+- `element` ?<[ElementHandle]|[Array]<[ElementHandle]>>
Option elements to select. Optional.
## python-select-options-index
* langs: python
-- `index` <[int]|[Array]<[int]>>
+- `index` ?<[int]|[Array]<[int]>>
Options to select by index. Optional.
## python-select-options-value
* langs: python
-- `value` <[string]|[Array]<[string]>>
+- `value` ?<[string]|[Array]<[string]>>
Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise
only the first option matching one of the passed options is selected. Optional.
## python-select-options-label
* langs: python
-- `label` <[string]|[Array]<[string]>>
+- `label` ?<[string]|[Array]<[string]>>
Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise
only the first option matching one of the passed options is selected. Optional.
diff --git a/docs/src/api/python.md b/docs/src/api/python.md
index 88ab4b7517..b5be61be92 100644
--- a/docs/src/api/python.md
+++ b/docs/src/api/python.md
@@ -19,26 +19,26 @@ Terminates this instance of Playwright in case it was created bypassing the Pyth
### param: BrowserContext.addInitScript.path
* langs: python
-- `path` <[path]>
+- `path` ?<[path]>
Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
### param: BrowserContext.addInitScript.script
* langs: python
-- `script` <[string]>
+- `script` ?<[string]>
Script to be evaluated in all pages in the browser context. Optional.
### param: Page.addInitScript.path
* langs: python
-- `path` <[path]>
+- `path` ?<[path]>
Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
### param: Page.addInitScript.script
* langs: python
-- `script` <[string]>
+- `script` ?<[string]>
Script to be evaluated in all pages in the browser context. Optional.
@@ -64,13 +64,13 @@ Script to be evaluated in all pages in the browser context. Optional.
### option: Page.frame.name
* langs: python
-- `name` <[string]>
+- `name` ?<[string]>
Frame name specified in the `iframe`'s `name` attribute. Optional.
### option: Page.frame.url
* langs: python
-- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
+- `url` ?<[string]|[RegExp]|[function]\([URL]\):[boolean]>
A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.
diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md
index c4370694d7..0fb762078a 100644
--- a/docs/src/test-api/class-test.md
+++ b/docs/src/test-api/class-test.md
@@ -680,7 +680,7 @@ test('fail in WebKit', async ({ page, browserName }) => {
Test is marked as "should fail" when the condition is `true`.
### param: Test.fail#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -721,7 +721,7 @@ test('fail in WebKit 2', async ({ page }) => {
A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as "should fail" when the return value is `true`.
### param: Test.fail#3.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -838,7 +838,7 @@ test('broken in WebKit', async ({ page, browserName }) => {
Test is marked as "fixme" when the condition is `true`.
### param: Test.fixme#3.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -882,7 +882,7 @@ test('broken in WebKit 2', async ({ page }) => {
A function that returns whether to mark as "fixme", based on test fixtures. Test or tests are marked as "fixme" when the return value is `true`.
### param: Test.fixme#4.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -1103,7 +1103,7 @@ test.beforeEach(async ({ page }) => {
A skip condition. Test is skipped when the condition is `true`.
### param: Test.skip#3.description
-- `description` <[void]|[string]>
+- `description` ?<[void]|[string]>
Optional description that will be reflected in a test report.
@@ -1147,7 +1147,7 @@ test('skip in WebKit 2', async ({ page }) => {
A function that returns whether to skip, based on test fixtures. Test or tests are skipped when the return value is `true`.
### param: Test.skip#4.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -1203,7 +1203,7 @@ test('slow in WebKit', async ({ page, browserName }) => {
Test is marked as "slow" when the condition is `true`.
### param: Test.slow#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -1244,7 +1244,7 @@ test('fail in WebKit 2', async ({ page }) => {
A function that returns whether to mark as "slow", based on test fixtures. Test or tests are marked as "slow" when the return value is `true`.
### param: Test.slow#3.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md
index a4ecfac189..21da89b2ab 100644
--- a/docs/src/test-api/class-testconfig.md
+++ b/docs/src/test-api/class-testconfig.md
@@ -37,9 +37,9 @@ export default config;
- type: <[Object]>
- `timeout` <[int]> Default timeout for async expect matchers in milliseconds, defaults to 5000ms.
- `toMatchSnapshot` <[Object]>
- - `threshold` <[float]> an acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the same pixel in compared images, between zero (strict) and one (lax). Defaults to `0.2`.
- - `maxDiffPixels` <[int]> an acceptable amount of pixels that could be different, unset by default.
- - `maxDiffPixelRatio` <[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default.
+ - `threshold` ?<[float]> an acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the same pixel in compared images, between zero (strict) and one (lax). Defaults to `0.2`.
+ - `maxDiffPixels` ?<[int]> an acceptable amount of pixels that could be different, unset by default.
+ - `maxDiffPixelRatio` ?<[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default.
Configuration for the `expect` assertion library. Learn more about [various timeouts](../test-timeouts.md).
diff --git a/docs/src/test-api/class-testerror.md b/docs/src/test-api/class-testerror.md
index bed490d78d..440d8ec898 100644
--- a/docs/src/test-api/class-testerror.md
+++ b/docs/src/test-api/class-testerror.md
@@ -4,16 +4,16 @@
Information about an error thrown during test execution.
## property: TestError.message
-- type: <[string]>
+- type: ?<[string]>
-Optional error message. Set when [Error] (or its subclass) has been thrown.
+Error message. Set when [Error] (or its subclass) has been thrown.
## property: TestError.stack
-- type: <[string]>
+- type: ?<[string]>
-Optional error stack. Set when [Error] (or its subclass) has been thrown.
+Error stack. Set when [Error] (or its subclass) has been thrown.
## property: TestError.value
-- type: <[string]>
+- type: ?<[string]>
-Optional value that was thrown. Set when anything except the [Error] (or its subclass) has been thrown.
+The value that was thrown. Set when anything except the [Error] (or its subclass) has been thrown.
diff --git a/docs/src/test-api/class-testinfo.md b/docs/src/test-api/class-testinfo.md
index b39e423938..b36d2b9712 100644
--- a/docs/src/test-api/class-testinfo.md
+++ b/docs/src/test-api/class-testinfo.md
@@ -25,7 +25,7 @@ test('basic test', async ({ page }, testInfo) => {
## property: TestInfo.annotations
- type: <[Array]<[Object]>>
- `type` <[string]> Annotation type, for example `'skip'` or `'fail'`.
- - `description` <[string]> Optional description.
+ - `description` ?<[string]> Optional description.
The list of annotations applicable to the current test. Includes annotations from the test, annotations from all [`method: Test.describe`] groups the test belongs to and file-level annotations for the test file.
@@ -35,8 +35,8 @@ Learn more about [test annotations](../test-annotations.md).
- type: <[Array]<[Object]>>
- `name` <[string]> Attachment name.
- `contentType` <[string]> Content type of this attachment to properly present in the report, for example `'application/json'` or `'image/png'`.
- - `path` <[string]> Optional path on the filesystem to the attached file.
- - `body` <[Buffer]> Optional attachment body used instead of a file.
+ - `path` ?<[string]> Optional path on the filesystem to the attached file.
+ - `body` ?<[Buffer]> Optional attachment body used instead of a file.
The list of files or buffers attached to the current test. Some reporters show test attachments.
@@ -128,9 +128,9 @@ The number of milliseconds the test took to finish. Always zero before the test
## property: TestInfo.error
-- type: <[TestError]>
+- type: ?<[TestError]>
-Optional first error thrown during test execution, if any. This is equal to the first
+First error thrown during test execution, if any. This is equal to the first
element in [`property: TestInfo.errors`].
## property: TestInfo.errors
@@ -168,7 +168,7 @@ test.afterEach(async ({}, testInfo) => {
## method: TestInfo.fail#1
-Marks the currently running test as "should fail". Playwright Test runs theis tests and ensures that it is actually failing. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed. This is similar to [`method: Test.fail#1`].
+Marks the currently running test as "should fail". Playwright Test runs this test and ensures that it is actually failing. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed. This is similar to [`method: Test.fail#1`].
## method: TestInfo.fail#2
@@ -180,7 +180,7 @@ Conditionally mark the currently running test as "should fail" with an optional
Test is marked as "should fail" when the condition is `true`.
### param: TestInfo.fail#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -205,7 +205,7 @@ Conditionally mark the currently running test as "fixme" with an optional descri
Test is marked as "fixme" when the condition is `true`.
### param: TestInfo.fixme#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -363,7 +363,7 @@ Conditionally skips the currently running test with an optional description. Thi
A skip condition. Test is skipped when the condition is `true`.
### param: TestInfo.skip#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
@@ -382,7 +382,7 @@ Conditionally mark the currently running test as "slow" with an optional descrip
Test is marked as "slow" when the condition is `true`.
### param: TestInfo.slow#2.description
-- `description` <[string]>
+- `description` ?<[string]>
Optional description that will be reflected in a test report.
diff --git a/docs/src/test-api/class-testoptions.md b/docs/src/test-api/class-testoptions.md
index 4cceddbd24..7c2f3a4201 100644
--- a/docs/src/test-api/class-testoptions.md
+++ b/docs/src/test-api/class-testoptions.md
@@ -113,8 +113,8 @@ Learn more about [various timeouts](../test-timeouts.md).
## property: TestOptions.connectOptions
- type: <[void]|[Object]>
- `wsEndpoint` <[string]> A browser websocket endpoint to connect to.
- - `headers` <[void]|[Object]<[string], [string]>> Additional HTTP headers to be sent with web socket connect request. Optional.
- - `timeout` <[int]> Timeout in milliseconds for the connection to be established. Optional, defaults to no timeout.
+ - `headers` ?<[void]|[Object]<[string], [string]>> Additional HTTP headers to be sent with web socket connect request. Optional.
+ - `timeout` ?<[int]> Timeout in milliseconds for the connection to be established. Optional, defaults to no timeout.
When connect options are specified, default [`property: Fixtures.browser`], [`property: Fixtures.context`] and [`property: Fixtures.page`] use the remote browser instead of launching a browser locally, and any launch options like [`property: TestOptions.headless`] or [`property: TestOptions.channel`] are ignored.
@@ -180,9 +180,9 @@ Learn more about [automatic screenshots](../test-configuration.md#automatic-scre
## property: TestOptions.trace
- type: <[Object]|[TraceMode]<"off"|"on"|"retain-on-failure"|"on-first-retry">>
- `mode` <[TraceMode]<"off"|"on"|"retain-on-failure"|"on-first-retry">> Trace recording mode.
- - `screenshots` <[boolean]> Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview. Defaults to true. Optional.
- - `snapshots` <[boolean]> Whether to capture DOM snapshot on every action. Defaults to true. Optional.
- - `sources` <[boolean]> Whether to include source files for trace actions. Defaults to true. Optional.
+ - `screenshots` ?<[boolean]> Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview. Defaults to true. Optional.
+ - `snapshots` ?<[boolean]> Whether to capture DOM snapshot on every action. Defaults to true. Optional.
+ - `sources` ?<[boolean]> Whether to include source files for trace actions. Defaults to true. Optional.
Whether to record trace for each test. Defaults to `'off'`.
* `'off'`: Do not record trace.
@@ -199,7 +199,7 @@ Learn more about [recording trace](../test-configuration.md#record-test-trace).
## property: TestOptions.video
- type: <[Object]|[VideoMode]<"off"|"on"|"retain-on-failure"|"on-first-retry">>
- `mode` <[VideoMode]<"off"|"on"|"retain-on-failure"|"on-first-retry">> Video recording mode.
- - `size` <[Object]> Size of the recorded video. Optional.
+ - `size` ?<[Object]> Size of the recorded video. Optional.
- `width` <[int]>
- `height` <[int]>
diff --git a/docs/src/test-reporter-api/class-suite.md b/docs/src/test-reporter-api/class-suite.md
index 99630fac00..ddf642bd00 100644
--- a/docs/src/test-reporter-api/class-suite.md
+++ b/docs/src/test-reporter-api/class-suite.md
@@ -25,17 +25,17 @@ Reporter is given a root suite in the [`method: Reporter.onBegin`] method.
Returns the list of all test cases in this suite and its descendants, as opposite to [`property: Suite.tests`].
## property: Suite.location
-- type: <[Location]>
+- type: ?<[Location]>
-Optional location in the source where the suite is defined. Missing for root and project suites.
+Location in the source where the suite is defined. Missing for root and project suites.
## property: Suite.parent
-- type: <[Suite]>
+- type: ?<[Suite]>
-Optional parent suite, missing for the root suite.
+Parent suite, missing for the root suite.
## method: Suite.project
-- returns: <[void]|[TestProject]>
+- returns: ?<[TestProject]>
Configuration of the project this suite belongs to, or [void] for the root suite.
diff --git a/docs/src/test-reporter-api/class-testcase.md b/docs/src/test-reporter-api/class-testcase.md
index 17111f0b30..e53ea1a22e 100644
--- a/docs/src/test-reporter-api/class-testcase.md
+++ b/docs/src/test-reporter-api/class-testcase.md
@@ -6,7 +6,7 @@
## property: TestCase.annotations
- type: <[Array]<[Object]>>
- `type` <[string]> Annotation type, for example `'skip'` or `'fail'`.
- - `description` <[string]> Optional description.
+ - `description` ?<[string]> Optional description.
The list of annotations applicable to the current test. Includes annotations from the test, annotations from all [`method: Test.describe`] groups the test belongs to and file-level annotations for the test file.
diff --git a/docs/src/test-reporter-api/class-testresult.md b/docs/src/test-reporter-api/class-testresult.md
index 27b2636386..ea4274ab9e 100644
--- a/docs/src/test-reporter-api/class-testresult.md
+++ b/docs/src/test-reporter-api/class-testresult.md
@@ -7,8 +7,8 @@ A result of a single [TestCase] run.
- type: <[Array]<[Object]>>
- `name` <[string]> Attachment name.
- `contentType` <[string]> Content type of this attachment to properly present in the report, for example `'application/json'` or `'image/png'`.
- - `path` <[string]> Optional path on the filesystem to the attached file.
- - `body` <[Buffer]> Optional attachment body used instead of a file.
+ - `path` ?<[string]> Optional path on the filesystem to the attached file.
+ - `body` ?<[Buffer]> Optional attachment body used instead of a file.
The list of files or buffers attached during the test execution through [`property: TestInfo.attachments`].
@@ -18,9 +18,9 @@ The list of files or buffers attached during the test execution through [`proper
Running time in milliseconds.
## property: TestResult.error
-- type: <[TestError]>
+- type: ?<[TestError]>
-Optional first error thrown during test execution, if any. This is equal to the first
+First error thrown during test execution, if any. This is equal to the first
element in [`property: TestResult.errors`].
## property: TestResult.errors
diff --git a/docs/src/test-reporter-api/class-teststep.md b/docs/src/test-reporter-api/class-teststep.md
index 3075415d7d..78f8a72f36 100644
--- a/docs/src/test-reporter-api/class-teststep.md
+++ b/docs/src/test-reporter-api/class-teststep.md
@@ -18,19 +18,19 @@ Step category to differentiate steps with different origin and verbosity. Built-
Running time in milliseconds.
## property: TestStep.location
-- type: <[Location]>
+- type: ?<[Location]>
Optional location in the source where the step is defined.
## property: TestStep.error
-- type: <[TestError]>
+- type: ?<[TestError]>
-Optional error thrown during the step execution, if any.
+Error thrown during the step execution, if any.
## property: TestStep.parent
-- type: <[TestStep]>
+- type: ?<[TestStep]>
-Optional parent step, if any.
+Parent step, if any.
## property: TestStep.startTime
- type: <[Date]>
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 335cf41546..679db9f08f 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -10566,8 +10566,8 @@ export interface CDPSession {
removeListener: <T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void) => this;
once: <T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void) => this;
/**
- * @param method protocol method name
- * @param params Optional method parameters
+ * @param method Protocol method name.
+ * @param params Optional method parameters.
*/
send<T extends keyof Protocol.CommandParameters>(
method: T,
@@ -10672,17 +10672,7 @@ export interface Accessibility {
*
* @param options
*/
- snapshot(options?: {
- /**
- * Prune uninteresting nodes from the tree. Defaults to `true`.
- */
- interestingOnly?: boolean;
-
- /**
- * The root DOM element for the snapshot. Defaults to the whole page.
- */
- root?: ElementHandle;
- }): Promise<null|AccessibilityNode>;
+ snapshot(options?: AccessibilitySnapshotOptions): Promise<null|AccessibilityNode>;
}
type AccessibilityNode = {
@@ -10801,18 +10791,18 @@ export interface ElectronApplication {
* The only difference between
* [electronApplication.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate)
* and
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* is that
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* returns [JSHandle].
*
* If the function passed to the
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* returns a [Promise], then
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* would wait for the promise to resolve and return its value.
* @param pageFunction Function to be evaluated in the worker context.
- * @param arg
+ * @param arg Optional argument to pass to `pageFunction`.
*/
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<ElectronType, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
/**
@@ -10821,18 +10811,18 @@ export interface ElectronApplication {
* The only difference between
* [electronApplication.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate)
* and
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* is that
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* returns [JSHandle].
*
* If the function passed to the
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* returns a [Promise], then
- * [electronApplication.evaluateHandle(pageFunction, arg)](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
+ * [electronApplication.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-electronapplication#electron-application-evaluate-handle)
* would wait for the promise to resolve and return its value.
* @param pageFunction Function to be evaluated in the worker context.
- * @param arg
+ * @param arg Optional argument to pass to `pageFunction`.
*/
evaluateHandle<R>(pageFunction: PageFunctionOn<ElectronType, void, R>, arg?: any): Promise<SmartHandle<R>>;
/**
@@ -14178,7 +14168,7 @@ export interface Mouse {
*/
move(x: number, y: number, options?: {
/**
- * defaults to 1. Sends intermediate `mousemove` events.
+ * Defaults to 1. Sends intermediate `mousemove` events.
*/
steps?: number;
}): Promise<void>;
@@ -15545,6 +15535,18 @@ export interface Geolocation {
accuracy?: number;
}
+interface AccessibilitySnapshotOptions {
+ /**
+ * Prune uninteresting nodes from the tree. Defaults to `true`.
+ */
+ interestingOnly?: boolean;
+
+ /**
+ * The root DOM element for the snapshot. Defaults to the whole page.
+ */
+ root?: ElementHandle;
+}
+
export interface LaunchOptions {
/**
* Additional arguments to pass to the browser instance. The list of Chromium flags can be found
diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts
index ce1b9dc010..a9ebbab961 100644
--- a/packages/playwright-test/types/test.d.ts
+++ b/packages/playwright-test/types/test.d.ts
@@ -1384,7 +1384,7 @@ export interface TestInfo {
duration: number;
/**
- * Optional first error thrown during test execution, if any. This is equal to the first element in
+ * First error thrown during test execution, if any. This is equal to the first element in
* [testInfo.errors](https://playwright.dev/docs/api/class-testinfo#test-info-errors).
*/
error?: TestError;
@@ -1395,7 +1395,7 @@ export interface TestInfo {
errors: Array<TestError>;
/**
- * Marks the currently running test as "should fail". Playwright Test runs theis tests and ensures that it is actually
+ * Marks the currently running test as "should fail". Playwright Test runs this test and ensures that it is actually
* failing. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
* This is similar to [test.fail()](https://playwright.dev/docs/api/class-test#test-fail-1).
*/
@@ -2832,17 +2832,17 @@ export {};
*/
export interface TestError {
/**
- * Optional error message. Set when [Error] (or its subclass) has been thrown.
+ * Error message. Set when [Error] (or its subclass) has been thrown.
*/
message?: string;
/**
- * Optional error stack. Set when [Error] (or its subclass) has been thrown.
+ * Error stack. Set when [Error] (or its subclass) has been thrown.
*/
stack?: string;
/**
- * Optional value that was thrown. Set when anything except the [Error] (or its subclass) has been thrown.
+ * The value that was thrown. Set when anything except the [Error] (or its subclass) has been thrown.
*/
value?: string;
}
diff --git a/packages/playwright-test/types/testReporter.d.ts b/packages/playwright-test/types/testReporter.d.ts
index 74a0ed6ea6..4580d552d4 100644
--- a/packages/playwright-test/types/testReporter.d.ts
+++ b/packages/playwright-test/types/testReporter.d.ts
@@ -50,12 +50,12 @@ export interface Suite {
allTests(): Array<TestCase>;
/**
- * Optional location in the source where the suite is defined. Missing for root and project suites.
+ * Location in the source where the suite is defined. Missing for root and project suites.
*/
location?: Location;
/**
- * Optional parent suite, missing for the root suite.
+ * Parent suite, missing for the root suite.
*/
parent?: Suite;
@@ -229,7 +229,7 @@ export interface TestResult {
duration: number;
/**
- * Optional first error thrown during test execution, if any. This is equal to the first element in
+ * First error thrown during test execution, if any. This is equal to the first element in
* [testResult.errors](https://playwright.dev/docs/api/class-testresult#test-result-errors).
*/
error?: TestError;
@@ -472,12 +472,12 @@ export interface TestStep {
location?: Location;
/**
- * Optional error thrown during the step execution, if any.
+ * Error thrown during the step execution, if any.
*/
error?: TestError;
/**
- * Optional parent step, if any.
+ * Parent step, if any.
*/
parent?: TestStep;
diff --git a/utils/doclint/api_parser.js b/utils/doclint/api_parser.js
index ff5d3bb26c..4eb54ba168 100644
--- a/utils/doclint/api_parser.js
+++ b/utils/doclint/api_parser.js
@@ -88,9 +88,13 @@ class ApiParser {
throw new Error('Invalid member: ' + spec.text);
const name = match[3];
let returnType = null;
+ let optional = false;
for (const item of spec.children || []) {
- if (item.type === 'li' && item.liType === 'default')
- returnType = this.parseType(item);
+ if (item.type === 'li' && item.liType === 'default') {
+ const parsed = this.parseType(item);;
+ returnType = parsed.type;
+ optional = parsed.optional;
+ }
}
if (!returnType)
returnType = new Documentation.Type('void');
@@ -100,7 +104,7 @@ class ApiParser {
if (match[1] === 'event')
member = Documentation.Member.createEvent(extractLangs(spec), name, returnType, comments);
if (match[1] === 'property')
- member = Documentation.Member.createProperty(extractLangs(spec), name, returnType, comments, guessRequired(md.render(comments)));
+ member = Documentation.Member.createProperty(extractLangs(spec), name, returnType, comments, !optional);
if (match[1] === 'method' || match[1] === 'async method') {
member = Documentation.Member.createMethod(extractLangs(spec), name, [], returnType, comments);
if (match[1] === 'async method')
@@ -176,14 +180,18 @@ class ApiParser {
parseProperty(spec) {
const param = childrenWithoutProperties(spec)[0];
const text = param.text;
- const name = text.substring(0, text.indexOf('<')).replace(/\`/g, '').trim();
+ let typeStart = text.indexOf('<');
+ if (text[typeStart - 1] === '?')
+ typeStart--;
+ const name = text.substring(0, typeStart).replace(/\`/g, '').trim();
const comments = extractComments(spec);
- return Documentation.Member.createProperty(extractLangs(spec), name, this.parseType(param), comments, guessRequired(md.render(comments)));
+ const { type, optional } = this.parseType(param);
+ return Documentation.Member.createProperty(extractLangs(spec), name, type, comments, !optional);
}
/**
* @param {MarkdownNode=} spec
- * @return {Documentation.Type}
+ * @return {{ type: Documentation.Type, optional: boolean }}
*/
parseType(spec) {
const arg = parseVariable(spec.text);
@@ -191,15 +199,17 @@ class ApiParser {
for (const child of spec.children || []) {
const { name, text } = parseVariable(child.text);
const comments = /** @type {MarkdownNode[]} */ ([{ type: 'text', text }]);
- properties.push(Documentation.Member.createProperty({}, name, this.parseType(child), comments, guessRequired(text)));
+ const childType = this.parseType(child);
+ properties.push(Documentation.Member.createProperty({}, name, childType.type, comments, !childType.optional));
}
- return Documentation.Type.parse(arg.type, properties);
+ const type = Documentation.Type.parse(arg.type, properties);
+ return { type, optional: arg.optional };
}
}
/**
* @param {string} line
- * @returns {{ name: string, type: string, text: string }}
+ * @returns {{ name: string, type: string, text: string, optional: boolean }}
*/
function parseVariable(line) {
let match = line.match(/^`([^`]+)` (.*)/);
@@ -212,7 +222,12 @@ function parseVariable(line) {
if (!match)
throw new Error('Invalid argument: ' + line);
const name = match[1];
- const remainder = match[2];
+ let remainder = match[2];
+ let optional = false;
+ if (remainder.startsWith('?')) {
+ optional = true;
+ remainder = remainder.substring(1);
+ }
if (!remainder.startsWith('<'))
throw new Error(`Bad argument: "${name}" in "${line}"`);
let depth = 0;
@@ -223,7 +238,7 @@ function parseVariable(line) {
if (c === '>')
--depth;
if (depth === 0)
- return { name, type: remainder.substring(1, i), text: remainder.substring(i + 2) };
+ return { name, type: remainder.substring(1, i), text: remainder.substring(i + 2), optional };
}
throw new Error('Should not be reached');
}
@@ -294,26 +309,6 @@ function extractComments(item) {
});
}
-/**
- * @param {string} comment
- */
-function guessRequired(comment) {
- let required = true;
- if (comment.toLowerCase().includes('defaults to '))
- required = false;
- if (comment.startsWith('Optional'))
- required = false;
- if (comment.endsWith('Optional.'))
- required = false;
- if (comment.toLowerCase().includes('if set'))
- required = false;
- if (comment.toLowerCase().includes('if applicable'))
- required = false;
- if (comment.toLowerCase().includes('if available'))
- required = false;
- return required;
-}
-
/**
* @param {string} apiDir
* @param {string=} paramsPath
diff --git a/utils/generate_types/overrides.d.ts b/utils/generate_types/overrides.d.ts
index 9a4cc72041..66b4b9b5d5 100644
--- a/utils/generate_types/overrides.d.ts
+++ b/utils/generate_types/overrides.d.ts
@@ -200,17 +200,7 @@ class TimeoutError extends Error {}
}
export interface Accessibility {
- snapshot(options?: {
- /**
- * Prune uninteresting nodes from the tree. Defaults to `true`.
- */
- interestingOnly?: boolean;
-
- /**
- * The root DOM element for the snapshot. Defaults to the whole page.
- */
- root?: ElementHandle;
- }): Promise<null|AccessibilityNode>;
+ snapshot(options?: AccessibilitySnapshotOptions): Promise<null|AccessibilityNode>;
}
type AccessibilityNode = {