diff --git a/docs/src/api/class-accessibility.md b/docs/src/api/class-accessibility.md index f2c0c03171..6fe8d9ec84 100644 --- a/docs/src/api/class-accessibility.md +++ b/docs/src/api/class-accessibility.md @@ -1,4 +1,5 @@ # class: Accessibility +* since: v1.8 * langs: csharp, js, python The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by @@ -16,6 +17,7 @@ assistive technologies themselves. By default, Playwright tries to approximate t "interesting" nodes of the tree. ## async method: Accessibility.snapshot +* since: v1.8 - returns: <[null]|[Object]> - `role` <[string]> The [role](https://www.w3.org/TR/wai-aria/#usage_intro). - `name` <[string]> A human readable name for the node. @@ -141,19 +143,23 @@ if node: ``` ## async method: Accessibility.snapshot +* since: v1.8 * langs: java - returns: <[null]|[string]> ## async method: Accessibility.snapshot +* since: v1.8 * langs: csharp - returns: <[null]|[JsonElement]> ### option: Accessibility.snapshot.interestingOnly +* since: v1.8 - `interestingOnly` <[boolean]> Prune uninteresting nodes from the tree. Defaults to `true`. ### option: Accessibility.snapshot.root +* since: v1.8 - `root` <[ElementHandle]> The root DOM element for the snapshot. Defaults to the whole page. diff --git a/docs/src/api/class-android.md b/docs/src/api/class-android.md index de668051e2..4a122063a8 100644 --- a/docs/src/api/class-android.md +++ b/docs/src/api/class-android.md @@ -1,4 +1,5 @@ # class: Android +* since: v1.9 * langs: js Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView. @@ -78,30 +79,36 @@ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright ``` ## async method: Android.devices +* since: v1.9 - returns: <[Array]<[AndroidDevice]>> Returns the list of detected Android devices. ### option: Android.devices.host +* since: v1.22 - `host` <[string]> Optional host to establish ADB server connection. Default to `127.0.0.1`. ### option: Android.devices.port +* since: v1.20 - `port` <[int]> Optional port to establish ADB server connection. Default to `5037`. ### option: Android.devices.omitDriverInstall +* since: v1.21 - `omitDriverInstall` <[boolean]> Prevents automatic playwright driver installation on attach. Assumes that the drivers have been installed already. ## method: Android.setDefaultTimeout +* since: v1.9 This setting will change the default maximum time for all the methods accepting [`param: timeout`] option. ### param: Android.setDefaultTimeout.timeout +* since: v1.9 - `timeout` <[float]> Maximum time in milliseconds diff --git a/docs/src/api/class-androiddevice.md b/docs/src/api/class-androiddevice.md index ebca26ad66..837e67f8dc 100644 --- a/docs/src/api/class-androiddevice.md +++ b/docs/src/api/class-androiddevice.md @@ -1,27 +1,33 @@ # class: AndroidDevice +* since: v1.9 * langs: js [AndroidDevice] represents a connected device, either real hardware or emulated. Devices can be obtained using [`method: Android.devices`]. ## event: AndroidDevice.webView +* since: v1.9 - argument: <[AndroidWebView]> Emitted when a new WebView instance is detected. ## async method: AndroidDevice.close +* since: v1.9 Disconnects from the device. ## async method: AndroidDevice.drag +* since: v1.9 Drags the widget defined by [`param: selector`] towards [`param: dest`] point. ### param: AndroidDevice.drag.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to drag. ### param: AndroidDevice.drag.dest +* since: v1.9 - `dest` <[Object]> - `x` <[float]> - `y` <[float]> @@ -29,196 +35,242 @@ Selector to drag. Point to drag to. ### option: AndroidDevice.drag.speed +* since: v1.9 - `speed` <[float]> Optional speed of the drag in pixels per second. ### option: AndroidDevice.drag.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.fill +* since: v1.9 Fills the specific [`param: selector`] input box with [`param: text`]. ### param: AndroidDevice.fill.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to fill. ### param: AndroidDevice.fill.text +* since: v1.9 - `text` <[string]> Text to be filled in the input box. ### option: AndroidDevice.fill.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.fling +* since: v1.9 Flings the widget defined by [`param: selector`] in the specified [`param: direction`]. ### param: AndroidDevice.fling.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to fling. ### param: AndroidDevice.fling.direction +* since: v1.9 - `direction` <[AndroidFlingDirection]<"down"|"up"|"left"|"right">> Fling direction. ### option: AndroidDevice.fling.speed +* since: v1.9 - `speed` <[float]> Optional speed of the fling in pixels per second. ### option: AndroidDevice.fling.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.info +* since: v1.9 - returns: <[AndroidElementInfo]> Returns information about a widget defined by [`param: selector`]. ### param: AndroidDevice.info.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to return information about. ## property: AndroidDevice.input +* since: v1.9 - type: <[AndroidInput]> ## async method: AndroidDevice.installApk +* since: v1.9 Installs an apk on the device. ### param: AndroidDevice.installApk.file +* since: v1.9 - `file` <[string]|[Buffer]> Either a path to the apk file, or apk file content. ### option: AndroidDevice.installApk.args +* since: v1.9 - `args` <[Array]<[string]>> Optional arguments to pass to the `shell:cmd package install` call. Defaults to `-r -t -S`. ## async method: AndroidDevice.launchBrowser +* since: v1.9 - returns: <[BrowserContext]> Launches Chrome browser on the device, and returns its persistent context. ### option: AndroidDevice.launchBrowser.pkg +* since: v1.9 - `command` <[string]> Optional package name to launch instead of default Chrome for Android. -### option: AndroidDevice.launchBrowser.-inline- = %%-shared-context-params-list-%% +### option: AndroidDevice.launchBrowser.-inline- = %%-shared-context-params-list-v1.8-%% +* since: v1.9 ## async method: AndroidDevice.longTap +* since: v1.9 Performs a long tap on the widget defined by [`param: selector`]. ### param: AndroidDevice.longTap.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to tap on. ### option: AndroidDevice.longTap.timeout = %%-android-timeout-%% +* since: v1.9 ## method: AndroidDevice.model +* since: v1.9 - returns: <[string]> Device model. ## async method: AndroidDevice.open +* since: v1.9 - returns: <[AndroidSocket]> Launches a process in the shell on the device and returns a socket to communicate with the launched process. ### param: AndroidDevice.open.command +* since: v1.9 - `command` <[string]> Shell command to execute. ## async method: AndroidDevice.pinchClose +* since: v1.9 Pinches the widget defined by [`param: selector`] in the closing direction. ### param: AndroidDevice.pinchClose.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to pinch close. ### param: AndroidDevice.pinchClose.percent +* since: v1.9 - `percent` <[float]> The size of the pinch as a percentage of the widget's size. ### option: AndroidDevice.pinchClose.speed +* since: v1.9 - `speed` <[float]> Optional speed of the pinch in pixels per second. ### option: AndroidDevice.pinchClose.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.pinchOpen +* since: v1.9 Pinches the widget defined by [`param: selector`] in the open direction. ### param: AndroidDevice.pinchOpen.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to pinch open. ### param: AndroidDevice.pinchOpen.percent +* since: v1.9 - `percent` <[float]> The size of the pinch as a percentage of the widget's size. ### option: AndroidDevice.pinchOpen.speed +* since: v1.9 - `speed` <[float]> Optional speed of the pinch in pixels per second. ### option: AndroidDevice.pinchOpen.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.press +* since: v1.9 Presses the specific [`param: key`] in the widget defined by [`param: selector`]. ### param: AndroidDevice.press.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to press the key in. ### param: AndroidDevice.press.key +* since: v1.9 - `key` <[AndroidKey]> The key to press. ### option: AndroidDevice.press.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.push +* since: v1.9 Copies a file to the device. ### param: AndroidDevice.push.file +* since: v1.9 - `file` <[string]|[Buffer]> Either a path to the file, or file content. ### param: AndroidDevice.push.path +* since: v1.9 - `path` <[string]> Path to the file on the device. ### option: AndroidDevice.push.mode +* since: v1.9 - `mode` <[int]> Optional file mode, defaults to `644` (`rw-r--r--`). ## async method: AndroidDevice.screenshot +* since: v1.9 - returns: <[Buffer]> Returns the buffer with the captured screenshot of the device. ### option: AndroidDevice.screenshot.path +* since: v1.9 - `path` <[path]> The file path to save the image to. If [`option: path`] is a @@ -226,108 +278,132 @@ relative path, then it is resolved relative to the current working directory. If saved to the disk. ## async method: AndroidDevice.scroll +* since: v1.9 Scrolls the widget defined by [`param: selector`] in the specified [`param: direction`]. ### param: AndroidDevice.scroll.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to scroll. ### param: AndroidDevice.scroll.direction +* since: v1.9 - `direction` <[AndroidScrollDirection]<"down"|"up"|"left"|"right">> Scroll direction. ### param: AndroidDevice.scroll.percent +* since: v1.9 - `percent` <[float]> Distance to scroll as a percentage of the widget's size. ### option: AndroidDevice.scroll.speed +* since: v1.9 - `speed` <[float]> Optional speed of the scroll in pixels per second. ### option: AndroidDevice.scroll.timeout = %%-android-timeout-%% +* since: v1.9 ## method: AndroidDevice.serial +* since: v1.9 - returns: <[string]> Device serial number. ## method: AndroidDevice.setDefaultTimeout +* since: v1.9 This setting will change the default maximum time for all the methods accepting [`param: timeout`] option. ### param: AndroidDevice.setDefaultTimeout.timeout +* since: v1.9 - `timeout` <[float]> Maximum time in milliseconds ## async method: AndroidDevice.shell +* since: v1.9 - returns: <[Buffer]> Executes a shell command on the device and returns its output. ### param: AndroidDevice.shell.command +* since: v1.9 - `command` <[string]> Shell command to execute. ## async method: AndroidDevice.swipe +* since: v1.9 Swipes the widget defined by [`param: selector`] in the specified [`param: direction`]. ### param: AndroidDevice.swipe.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to swipe. ### param: AndroidDevice.swipe.direction +* since: v1.9 - `direction` <[AndroidSwipeDirection]<"down"|"up"|"left"|"right">> Swipe direction. ### param: AndroidDevice.swipe.percent +* since: v1.9 - `percent` <[float]> Distance to swipe as a percentage of the widget's size. ### option: AndroidDevice.swipe.speed +* since: v1.9 - `speed` <[float]> Optional speed of the swipe in pixels per second. ### option: AndroidDevice.swipe.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.tap +* since: v1.9 Taps on the widget defined by [`param: selector`]. ### param: AndroidDevice.tap.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to tap on. ### option: AndroidDevice.tap.duration +* since: v1.9 - `duration` <[float]> Optional duration of the tap in milliseconds. ### option: AndroidDevice.tap.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.wait +* since: v1.9 Waits for the specific [`param: selector`] to either appear or disappear, depending on the [`option: state`]. ### param: AndroidDevice.wait.selector +* since: v1.9 - `selector` <[AndroidSelector]> Selector to wait for. ### option: AndroidDevice.wait.state +* since: v1.9 - `state` <[AndroidDeviceState]<"gone">> Optional state. Can be either: @@ -335,15 +411,19 @@ Optional state. Can be either: * `'gone'` - wait for element to not be present. ### option: AndroidDevice.wait.timeout = %%-android-timeout-%% +* since: v1.9 ## async method: AndroidDevice.waitForEvent +* since: v1.9 - returns: <[any]> Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. ### param: AndroidDevice.waitForEvent.event = %%-wait-for-event-event-%% +* since: v1.9 ### param: AndroidDevice.waitForEvent.optionsOrPredicate +* since: v1.9 - `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 @@ -352,18 +432,22 @@ Waits for event to fire and passes its value into the predicate function. Return Either a predicate that receives an event or an options object. Optional. ## async method: AndroidDevice.webView +* since: v1.9 - returns: <[AndroidWebView]> This method waits until [AndroidWebView] matching the [`option: selector`] is opened and returns it. If there is already an open [AndroidWebView] matching the [`option: selector`], returns immediately. ### param: AndroidDevice.webView.selector +* since: v1.9 - `selector` <[Object]> - `pkg` ?<[string]> Optional Package identifier. - `socketName` ?<[string]> Optional webview socket name. ### option: AndroidDevice.webView.timeout = %%-android-timeout-%% +* since: v1.9 ## method: AndroidDevice.webViews +* since: v1.9 - returns: <[Array]<[AndroidWebView]>> Currently open WebViews. diff --git a/docs/src/api/class-androidinput.md b/docs/src/api/class-androidinput.md index 1e22561000..b68178efaf 100644 --- a/docs/src/api/class-androidinput.md +++ b/docs/src/api/class-androidinput.md @@ -1,11 +1,14 @@ # class: AndroidInput +* since: v1.9 * langs: js ## async method: AndroidInput.drag +* since: v1.9 Performs a drag between [`param: from`] and [`param: to`] points. ### param: AndroidInput.drag.from +* since: v1.9 - `from` <[Object]> - `x` <[float]> - `y` <[float]> @@ -13,6 +16,7 @@ Performs a drag between [`param: from`] and [`param: to`] points. The start point of the drag. ### param: AndroidInput.drag.to +* since: v1.9 - `to` <[Object]> - `x` <[float]> - `y` <[float]> @@ -20,25 +24,30 @@ The start point of the drag. The end point of the drag. ### param: AndroidInput.drag.steps +* since: v1.9 - `steps` <[int]> The number of steps in the drag. Each step takes 5 milliseconds to complete. ## async method: AndroidInput.press +* since: v1.9 Presses the [`param: key`]. ### param: AndroidInput.press.key +* since: v1.9 - `key` <[AndroidKey]> Key to press. ## async method: AndroidInput.swipe +* since: v1.9 Swipes following the path defined by [`param: segments`]. ### param: AndroidInput.swipe.from +* since: v1.9 - `from` <[Object]> - `x` <[float]> - `y` <[float]> @@ -46,6 +55,7 @@ Swipes following the path defined by [`param: segments`]. The point to start swiping from. ### param: AndroidInput.swipe.segments +* since: v1.9 - `segments` <[Array]<[Object]>> - `x` <[float]> - `y` <[float]> @@ -53,15 +63,18 @@ The point to start swiping from. Points following the [`param: from`] point in the swipe gesture. ### param: AndroidInput.swipe.steps +* since: v1.9 - `steps` <[int]> The number of steps for each segment. Each step takes 5 milliseconds to complete, so 100 steps means half a second per each segment. ## async method: AndroidInput.tap +* since: v1.9 Taps at the specified [`param: point`]. ### param: AndroidInput.tap.point +* since: v1.9 - `point` <[Object]> - `x` <[float]> - `y` <[float]> @@ -69,10 +82,12 @@ Taps at the specified [`param: point`]. The point to tap at. ## async method: AndroidInput.type +* since: v1.9 Types [`param: text`] into currently focused widget. ### param: AndroidInput.type.text +* since: v1.9 - `text` <[string]> Text to type. diff --git a/docs/src/api/class-androidsocket.md b/docs/src/api/class-androidsocket.md index b55354423b..1ffd49f711 100644 --- a/docs/src/api/class-androidsocket.md +++ b/docs/src/api/class-androidsocket.md @@ -1,26 +1,32 @@ # class: AndroidSocket +* since: v1.9 * langs: js [AndroidSocket] is a way to communicate with a process launched on the [AndroidDevice]. Use [`method: AndroidDevice.open`] to open a socket. ## event: AndroidSocket.close +* since: v1.9 Emitted when the socket is closed. ## event: AndroidSocket.data +* since: v1.9 - argument: <[Buffer]> Emitted when data is available to read from the socket. ## async method: AndroidSocket.close +* since: v1.9 Closes the socket. ## async method: AndroidSocket.write +* since: v1.9 Writes some [`param: data`] to the socket. ### param: AndroidSocket.write.data +* since: v1.9 - `data` <[Buffer]> Data to write. diff --git a/docs/src/api/class-androidwebview.md b/docs/src/api/class-androidwebview.md index 8a97bcfefe..1d4b7eacf4 100644 --- a/docs/src/api/class-androidwebview.md +++ b/docs/src/api/class-androidwebview.md @@ -1,23 +1,28 @@ # class: AndroidWebView +* since: v1.9 * langs: js [AndroidWebView] represents a WebView open on the [AndroidDevice]. WebView is usually obtained using [`method: AndroidDevice.webView`]. ## event: AndroidWebView.close +* since: v1.9 Emitted when the WebView is closed. ## async method: AndroidWebView.page +* since: v1.9 - returns: <[Page]> Connects to the WebView and returns a regular Playwright [Page] to interact with. ## method: AndroidWebView.pid +* since: v1.9 - returns: <[int]> WebView process PID. ## method: AndroidWebView.pkg +* since: v1.9 - returns: <[string]> WebView package identifier. \ No newline at end of file diff --git a/docs/src/api/class-apirequest.md b/docs/src/api/class-apirequest.md index 317e1f8e71..8142da9a47 100644 --- a/docs/src/api/class-apirequest.md +++ b/docs/src/api/class-apirequest.md @@ -1,4 +1,5 @@ # class: APIRequest +* since: v1.16 Exposes API that can be used for the Web API testing. This class is used for creating [APIRequestContext] instance which in turn can be used for sending web requests. An instance @@ -6,17 +7,24 @@ of this class can be obtained via [`property: Playwright.request`]. For more inf see [APIRequestContext]. ## async method: APIRequest.newContext +* since: v1.16 - returns: <[APIRequestContext]> Creates new instances of [APIRequestContext]. ### option: APIRequest.newContext.useragent = %%-context-option-useragent-%% +* since: v1.16 ### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%% +* since: v1.16 ### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%% +* since: v1.16 ### option: APIRequest.newContext.proxy = %%-browser-option-proxy-%% +* since: v1.16 ### option: APIRequest.newContext.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%% +* since: v1.16 ### option: APIRequest.newContext.timeout +* since: v1.16 - `timeout` <[float]> Maximum time in milliseconds to wait for the response. Defaults to @@ -24,6 +32,7 @@ Maximum time in milliseconds to wait for the response. Defaults to ### option: APIRequest.newContext.baseURL +* since: v1.16 - `baseURL` <[string]> Methods like [`method: APIRequestContext.get`] take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples: @@ -32,6 +41,7 @@ Methods like [`method: APIRequestContext.get`] take the base URL into considerat * baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html` ### option: APIRequest.newContext.storageState +* since: v1.16 * langs: js, python - `storageState` <[path]|[Object]> - `cookies` <[Array]<[Object]>> @@ -55,6 +65,7 @@ file with saved storage, or the value returned by one of [`method: BrowserContex [`method: APIRequestContext.storageState`] methods. ### option: APIRequest.newContext.storageState +* since: v1.16 * langs: java, csharp - `storageState` <[string]> @@ -64,3 +75,4 @@ file with saved storage, or the value returned by one of [`method: BrowserContex [`method: APIRequestContext.storageState`] methods. ### option: APIRequest.newContext.storageStatePath = %%-csharp-java-context-option-storage-state-path-%% +* since: v1.18 diff --git a/docs/src/api/class-apirequestcontext.md b/docs/src/api/class-apirequestcontext.md index e63492d662..52a6e14bc6 100644 --- a/docs/src/api/class-apirequestcontext.md +++ b/docs/src/api/class-apirequestcontext.md @@ -1,4 +1,5 @@ # class: APIRequestContext +* since: v1.16 This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare environment or the service to your e2e test. @@ -120,12 +121,14 @@ with sync_playwright() as p: ``` ## method: APIRequestContext.createFormData +* since: v1.23 * langs: csharp - returns: <[FormData]> Creates a new [FormData] instance which is used for providing form and multipart data when making HTTP requests. ## async method: APIRequestContext.delete +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response. @@ -133,40 +136,60 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.delete.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.delete.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.delete.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.delete.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.delete.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.delete.data = %%-js-python-fetch-option-data-%% +* since: v1.17 ### option: APIRequestContext.delete.form = %%-js-python-fetch-option-form-%% +* since: v1.17 ### option: APIRequestContext.delete.form = %%-csharp-fetch-option-form-%% +* since: v1.17 ### option: APIRequestContext.delete.multipart = %%-js-python-fetch-option-multipart-%% +* since: v1.17 ### option: APIRequestContext.delete.multipart = %%-csharp-fetch-option-multipart-%% +* since: v1.17 ### option: APIRequestContext.delete.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.delete.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.delete.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.dispose +* since: v1.16 All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes [`method: APIResponse.body`] throw "Response disposed" error. ## async method: APIRequestContext.fetch +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.fetch.urlOrRequest +* since: v1.16 - `urlOrRequest` <[string]|[Request]> Target URL or Request to get all parameters from. ### param: APIRequestContext.fetch.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.fetch.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.fetch.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.fetch.method +* since: v1.16 * langs: js, python, csharp - `method` <[string]> @@ -174,16 +197,26 @@ If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/ [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)). If not specified, GET method is used. ### option: APIRequestContext.fetch.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.fetch.data = %%-js-python-fetch-option-data-%% +* since: v1.16 ### option: APIRequestContext.fetch.form = %%-js-python-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.fetch.form = %%-csharp-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.fetch.multipart = %%-js-python-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.fetch.multipart = %%-csharp-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.fetch.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.fetch.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.fetch.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.get +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. @@ -191,15 +224,24 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.get.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.get.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.get.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.get.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.get.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.get.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.get.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.get.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.head +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response. @@ -207,15 +249,24 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.head.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.head.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.head.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.head.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.head.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.head.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.head.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.head.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.patch +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response. @@ -223,20 +274,34 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.patch.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.patch.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.patch.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.patch.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.patch.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.patch.data = %%-js-python-fetch-option-data-%% +* since: v1.16 ### option: APIRequestContext.patch.form = %%-js-python-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.patch.form = %%-csharp-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.patch.multipart = %%-js-python-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.patch.multipart = %%-csharp-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.patch.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.patch.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.patch.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.post +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response. @@ -244,20 +309,34 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.post.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.post.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.post.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.post.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.post.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.post.data = %%-js-python-fetch-option-data-%% +* since: v1.16 ### option: APIRequestContext.post.form = %%-js-python-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.post.form = %%-csharp-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.post.multipart = %%-js-python-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.post.multipart = %%-csharp-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.post.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.post.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.post.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.put +* since: v1.16 - returns: <[APIResponse]> Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. @@ -265,20 +344,34 @@ The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects. ### param: APIRequestContext.put.url = %%-fetch-param-url-%% +* since: v1.16 ### param: APIRequestContext.put.params = %%-java-csharp-fetch-params-%% +* since: v1.18 ### option: APIRequestContext.put.params = %%-js-python-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.put.params = %%-csharp-fetch-option-params-%% +* since: v1.16 ### option: APIRequestContext.put.headers = %%-js-python-fetch-option-headers-%% +* since: v1.16 ### option: APIRequestContext.put.data = %%-js-python-fetch-option-data-%% +* since: v1.16 ### option: APIRequestContext.put.form = %%-js-python-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.put.form = %%-csharp-fetch-option-form-%% +* since: v1.16 ### option: APIRequestContext.put.multipart = %%-js-python-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.put.multipart = %%-csharp-fetch-option-multipart-%% +* since: v1.16 ### option: APIRequestContext.put.timeout = %%-js-python-fetch-option-timeout-%% +* since: v1.16 ### option: APIRequestContext.put.failOnStatusCode = %%-js-python-fetch-option-failonstatuscode-%% +* since: v1.16 ### option: APIRequestContext.put.ignoreHTTPSErrors = %%-js-python-fetch-option-ignorehttpserrors-%% +* since: v1.16 ## async method: APIRequestContext.storageState +* since: v1.16 - returns: <[Object]> - `cookies` <[Array]<[Object]>> - `name` <[string]> @@ -298,7 +391,9 @@ context cookies from the response. The method will automatically follow redirect Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor. ## async method: APIRequestContext.storageState +* since: v1.16 * langs: java, csharp - returns: <[string]> ### option: APIRequestContext.storageState.path = %%-storagestate-option-path-%% +* since: v1.16 diff --git a/docs/src/api/class-apiresponse.md b/docs/src/api/class-apiresponse.md index 93f7600cc6..1297d2d4fa 100644 --- a/docs/src/api/class-apiresponse.md +++ b/docs/src/api/class-apiresponse.md @@ -1,4 +1,5 @@ # class: APIResponse +* since: v1.16 [APIResponse] class represents responses returned by [`method: APIRequestContext.get`] and similar methods. @@ -37,20 +38,24 @@ with sync_playwright() as p: ``` ## async method: APIResponse.body +* since: v1.16 - returns: <[Buffer]> Returns the buffer with response body. ## async method: APIResponse.dispose +* since: v1.16 Disposes the body of this response. If not called then the body will stay in memory until the context closes. ## method: APIResponse.headers +* since: v1.16 - returns: <[Object]<[string], [string]>> An object with all the response HTTP headers associated with this response. ## method: APIResponse.headersArray +* since: v1.16 - returns: <[Array]<[Object]>> - `name` <[string]> Name of the header. - `value` <[string]> Value of the header. @@ -59,6 +64,7 @@ An array with all the request HTTP headers associated with this response. Header Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times. ## async method: APIResponse.json +* since: v1.16 * langs: js, python - returns: <[Serializable]> @@ -67,6 +73,7 @@ Returns the JSON representation of response body. This method will throw if the response body is not parsable via `JSON.parse`. ## async method: APIResponse.json +* since: v1.16 * langs: csharp - returns: <[null]|[JsonElement]> @@ -75,26 +82,31 @@ Returns the JSON representation of response body. This method will throw if the response body is not parsable via `JSON.parse`. ## method: APIResponse.ok +* since: v1.16 - returns: <[boolean]> Contains a boolean stating whether the response was successful (status in the range 200-299) or not. ## method: APIResponse.status +* since: v1.16 - returns: <[int]> Contains the status code of the response (e.g., 200 for a success). ## method: APIResponse.statusText +* since: v1.16 - returns: <[string]> Contains the status text of the response (e.g. usually an "OK" for a success). ## async method: APIResponse.text +* since: v1.16 - returns: <[string]> Returns the text representation of response body. ## method: APIResponse.url +* since: v1.16 - returns: <[string]> Contains the URL of the response. diff --git a/docs/src/api/class-apiresponseassertions.md b/docs/src/api/class-apiresponseassertions.md index eeca79f5be..c4ef4edb53 100644 --- a/docs/src/api/class-apiresponseassertions.md +++ b/docs/src/api/class-apiresponseassertions.md @@ -1,4 +1,5 @@ # class: APIResponseAssertions +* since: v1.18 * langs: js, java, python The [APIResponseAssertions] class provides assertion methods that can be used to make assertions about the [APIResponse] in the tests. A new instance of [APIResponseAssertions] is created by calling [`method: PlaywrightAssertions.expectAPIResponse`]: @@ -48,6 +49,7 @@ def test_navigates_to_login_page(page: Page) -> None: ## property: APIResponseAssertions.not +* since: v1.20 * langs: java, js - returns: <[APIResponseAssertions]> @@ -62,11 +64,13 @@ assertThat(response).not().isOK(); ``` ## async method: APIResponseAssertions.NotToBeOK +* since: v1.19 * langs: python The opposite of [`method: APIResponseAssertions.toBeOK`]. ## async method: APIResponseAssertions.toBeOK +* since: v1.18 * langs: - alias-java: isOK diff --git a/docs/src/api/class-browser.md b/docs/src/api/class-browser.md index 3167f49eea..bf5c4307e3 100644 --- a/docs/src/api/class-browser.md +++ b/docs/src/api/class-browser.md @@ -1,4 +1,5 @@ # class: Browser +* since: v1.8 * extends: [EventEmitter] A Browser is created via [`method: BrowserType.launch`]. An example of using a [Browser] to create a [Page]: @@ -73,6 +74,7 @@ await browser.CloseAsync(); ``` ## event: Browser.disconnected +* since: v1.8 - argument: <[Browser]> Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following: @@ -80,11 +82,13 @@ Emitted when Browser gets disconnected from the browser application. This might * The [`method: Browser.close`] method was called. ## method: Browser.browserType +* since: v1.23 - returns: <[BrowserType]> Get the browser type (chromium, firefox or webkit) that the browser belongs to. ## async method: Browser.close +* since: v1.8 In case this browser is obtained using [`method: BrowserType.launch`], closes the browser and all of its pages (if any were opened). @@ -99,6 +103,7 @@ This is similar to force quitting the browser. Therefore, you should call [`meth The [Browser] object itself is considered to be disposed and cannot be used anymore. ## method: Browser.contexts +* since: v1.8 - returns: <[Array]<[BrowserContext]>> Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts. @@ -141,11 +146,13 @@ System.Console.WriteLine(browser.Contexts.Count); // prints "1" ``` ## method: Browser.isConnected +* since: v1.8 - returns: <[boolean]> Indicates that the browser is connected. ## async method: Browser.newBrowserCDPSession +* since: v1.11 * langs: js, python - returns: <[CDPSession]> @@ -156,6 +163,7 @@ CDP Sessions are only supported on Chromium-based browsers. Returns the newly created browser session. ## async method: Browser.newContext +* since: v1.8 - returns: <[BrowserContext]> Creates a new browser context. It won't share cookies/cache with other browser contexts. @@ -233,17 +241,23 @@ await context.CloseAsync(); await browser.CloseAsync(); ``` -### option: Browser.newContext.-inline- = %%-shared-context-params-list-%% +### option: Browser.newContext.-inline- = %%-shared-context-params-list-v1.8-%% +* since: v1.8 ### option: Browser.newContext.proxy = %%-context-option-proxy-%% +* since: v1.8 ### option: Browser.newContext.storageState = %%-js-python-context-option-storage-state-%% +* since: v1.8 ### option: Browser.newContext.storageState = %%-csharp-java-context-option-storage-state-%% +* since: v1.8 ### option: Browser.newContext.storageStatePath = %%-csharp-java-context-option-storage-state-path-%% +* since: v1.9 ## async method: Browser.newPage +* since: v1.8 - returns: <[Page]> Creates a new page in a new browser context. Closing this page will close the context as well. @@ -252,17 +266,23 @@ This is a convenience API that should only be used for the single-page scenarios testing frameworks should explicitly create [`method: Browser.newContext`] followed by the [`method: BrowserContext.newPage`] to control their exact life times. -### option: Browser.newPage.-inline- = %%-shared-context-params-list-%% +### option: Browser.newPage.-inline- = %%-shared-context-params-list-v1.8-%% +* since: v1.8 ### option: Browser.newPage.proxy = %%-context-option-proxy-%% +* since: v1.8 ### option: Browser.newPage.storageState = %%-js-python-context-option-storage-state-%% +* since: v1.8 ### option: Browser.newPage.storageState = %%-csharp-java-context-option-storage-state-%% +* since: v1.8 ### option: Browser.newPage.storageStatePath = %%-csharp-java-context-option-storage-state-path-%% +* since: v1.9 ## async method: Browser.startTracing +* since: v1.11 * langs: java, js, python :::note @@ -298,26 +318,31 @@ browser.stop_tracing() ``` ### param: Browser.startTracing.page +* since: v1.11 - `page` ?<[Page]> Optional, if specified, tracing includes screenshots of the given page. ### option: Browser.startTracing.path +* since: v1.11 - `path` <[path]> A path to write the trace file to. ### option: Browser.startTracing.screenshots +* since: v1.11 - `screenshots` <[boolean]> captures screenshots in the trace. ### option: Browser.startTracing.categories +* since: v1.11 - `categories` <[Array]<[string]>> specify custom categories to use instead of default. ## async method: Browser.stopTracing +* since: v1.11 * langs: java, js, python - returns: <[Buffer]> @@ -328,6 +353,7 @@ This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos Returns the buffer with trace data. ## method: Browser.version +* since: v1.8 - returns: <[string]> Returns the browser version. diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 00d060e82c..fdab58e763 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -1,4 +1,5 @@ # class: BrowserContext +* since: v1.8 * extends: [EventEmitter] BrowserContexts provide a way to operate multiple independent browser sessions. @@ -62,6 +63,7 @@ await context.CloseAsync(); ``` ## event: BrowserContext.backgroundPage +* since: v1.11 * langs: js, python - argument: <[Page]> @@ -85,6 +87,7 @@ background_page = context.wait_for_event("backgroundpage") ``` ## event: BrowserContext.close +* since: v1.8 - argument: <[BrowserContext]> Emitted when Browser context gets closed. This might happen because of one of the following: @@ -93,6 +96,7 @@ Emitted when Browser context gets closed. This might happen because of one of th * The [`method: Browser.close`] method was called. ## event: BrowserContext.page +* since: v1.8 - argument: <[Page]> The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will @@ -145,6 +149,7 @@ cases). ::: ## event: BrowserContext.request +* since: v1.12 - argument: <[Request]> Emitted when a request is issued from any pages created through this context. @@ -155,6 +160,7 @@ In order to intercept and mutate requests, see [`method: BrowserContext.route`] or [`method: Page.route`]. ## event: BrowserContext.requestFailed +* since: v1.12 - argument: <[Request]> Emitted when a request fails, for example by timing out. To only listen for @@ -166,6 +172,7 @@ with [`event: BrowserContext.requestFinished`] event and not with [`event: Brows ::: ## event: BrowserContext.requestFinished +* since: v1.12 - argument: <[Request]> Emitted when a request finishes successfully after downloading the response body. For a successful response, the @@ -173,6 +180,7 @@ sequence of events is `request`, `response` and `requestfinished`. To listen for successful requests from a particular page, use [`event: Page.requestFinished`]. ## event: BrowserContext.response +* since: v1.12 - argument: <[Response]> Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events @@ -180,6 +188,7 @@ is `request`, `response` and `requestfinished`. To listen for response events from a particular page, use [`event: Page.response`]. ## event: BrowserContext.serviceWorker +* since: v1.11 * langs: js, python - argument: <[Worker]> @@ -190,6 +199,7 @@ Service workers are only supported on Chromium-based browsers. Emitted when new service worker is created in the context. ## async method: BrowserContext.addCookies +* since: v1.8 Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via [`method: BrowserContext.cookies`]. @@ -215,6 +225,7 @@ await context.AddCookiesAsync(new[] { cookie1, cookie2 }); ``` ### param: BrowserContext.addCookies.cookies +* since: v1.8 - `cookies` <[Array]<[Object]>> - `name` <[string]> - `value` <[string]> @@ -227,6 +238,7 @@ await context.AddCookiesAsync(new[] { cookie1, cookie2 }); - `sameSite` ?<[SameSiteAttribute]<"Strict"|"Lax"|"None">> Optional. ## async method: BrowserContext.addInitScript +* since: v1.8 Adds a script which would be evaluated in one of the following scenarios: * Whenever a page is created in the browser context or is navigated. @@ -275,6 +287,7 @@ The order of evaluation of multiple scripts installed via [`method: BrowserConte ::: ### param: BrowserContext.addInitScript.script +* since: v1.8 * 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 @@ -284,18 +297,21 @@ The order of evaluation of multiple scripts installed via [`method: BrowserConte Script to be evaluated in all pages in the browser context. ### param: BrowserContext.addInitScript.script +* since: v1.8 * langs: csharp, java - `script` <[string]|[path]> Script to be evaluated in all pages in the browser context. ### param: BrowserContext.addInitScript.arg +* since: v1.8 * langs: js - `arg` ?<[Serializable]> Optional argument to pass to [`param: script`] (only supported when passing a function). ## method: BrowserContext.backgroundPages +* since: v1.11 * langs: js, python - returns: <[Array]<[Page]>> @@ -306,15 +322,18 @@ Background pages are only supported on Chromium-based browsers. All existing background pages in the context. ## method: BrowserContext.browser +* since: v1.8 - returns: <[null]|[Browser]> Returns the browser instance of the context. If it was launched as a persistent context null gets returned. ## async method: BrowserContext.clearCookies +* since: v1.8 Clears context cookies. ## async method: BrowserContext.clearPermissions +* since: v1.8 Clears all permission overrides for the browser context. @@ -356,6 +375,7 @@ await context.ClearPermissionsAsync(); ``` ## async method: BrowserContext.close +* since: v1.8 Closes the browser context. All the pages that belong to the browser context will be closed. @@ -364,6 +384,7 @@ The default browser context cannot be closed. ::: ## async method: BrowserContext.cookies +* since: v1.8 - returns: <[Array]<[Object]>> - `name` <[string]> - `value` <[string]> @@ -378,11 +399,13 @@ If no URLs are specified, this method returns all cookies. If URLs are specified are returned. ### param: BrowserContext.cookies.urls +* since: v1.8 - `urls` ?<[string]|[Array]<[string]>> Optional list of URLs. ## async method: BrowserContext.exposeBinding +* since: v1.8 The method adds a function called [`param: name`] on the `window` object of every frame in every page in the context. When called, the function executes [`param: callback`] and returns a [Promise] which resolves to the return value of @@ -588,22 +611,26 @@ Assert.AreEqual("Click me", await result.Task); ``` ### param: BrowserContext.exposeBinding.name +* since: v1.8 - `name` <[string]> Name of the function on the window object. ### param: BrowserContext.exposeBinding.callback +* since: v1.8 - `callback` <[function]> Callback function that will be called in the Playwright's context. ### option: BrowserContext.exposeBinding.handle +* since: v1.8 - `handle` <[boolean]> Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported. ## async method: BrowserContext.exposeFunction +* since: v1.8 The method adds a function called [`param: name`] on the `window` object of every frame in every page in the context. When called, the function executes [`param: callback`] and returns a [Promise] which resolves to the return value of @@ -776,21 +803,25 @@ class BrowserContextExamples ``` ### param: BrowserContext.exposeFunction.name +* since: v1.8 - `name` <[string]> Name of the function on the window object. ### param: BrowserContext.exposeFunction.callback +* since: v1.8 - `callback` <[function]> Callback function that will be called in the Playwright's context. ## async method: BrowserContext.grantPermissions +* since: v1.8 Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified. ### param: BrowserContext.grantPermissions.permissions +* since: v1.8 - `permissions` <[Array]<[string]>> A permission or an array of permissions to grant. Permissions can be one of the following values: @@ -811,11 +842,13 @@ A permission or an array of permissions to grant. Permissions can be one of the * `'payment-handler'` ### option: BrowserContext.grantPermissions.origin +* since: v1.8 - `origin` <[string]> The [origin] to grant permissions to, e.g. "https://example.com". ## async method: BrowserContext.newCDPSession +* since: v1.11 * langs: js, python - returns: <[CDPSession]> @@ -826,22 +859,26 @@ CDP sessions are only supported on Chromium-based browsers. Returns the newly created session. ### param: BrowserContext.newCDPSession.page +* since: v1.11 - `page` <[Page]|[Frame]> Target to create new session for. For backwards-compatibility, this parameter is named `page`, but it can be a `Page` or `Frame` type. ## async method: BrowserContext.newPage +* since: v1.8 - returns: <[Page]> Creates a new page in the browser context. ## method: BrowserContext.pages +* since: v1.8 - returns: <[Array]<[Page]>> Returns all open pages in the context. ## property: BrowserContext.request +* since: v1.16 * langs: - alias-csharp: APIRequest - type: <[APIRequestContext]> @@ -849,6 +886,7 @@ Returns all open pages in the context. API testing helper associated with this context. Requests made with this API will use context cookies. ## async method: BrowserContext.route +* since: v1.8 Routing provides the capability to modify network requests that are made by any page in the browser context. Once route is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted. @@ -1002,6 +1040,7 @@ Enabling routing disables http cache. ::: ### param: BrowserContext.route.url +* since: v1.8 - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing. @@ -1009,34 +1048,40 @@ When a [`option: baseURL`] via the context options was provided and the passed U it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor. ### param: BrowserContext.route.handler +* since: v1.8 * langs: js, python - `handler` <[function]\([Route], [Request]\)> handler function to route the request. ### param: BrowserContext.route.handler +* since: v1.8 * langs: csharp, java - `handler` <[function]\([Route]\)> handler function to route the request. ### option: BrowserContext.route.times +* since: v1.15 - `times` <[int]> How often a route should be used. By default it will be used every time. ## async method: BrowserContext.routeFromHAR +* since: v1.23 If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har). Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting [`option: Browser.newContext.serviceWorkers`] to `'block'`. ### param: BrowserContext.routeFromHAR.har +* since: v1.23 - `har` <[path]> Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a relative path, then it is resolved relative to the current working directory. ### option: BrowserContext.routeFromHAR.notFound +* since: v1.23 - `notFound` ?<[HarNotFound]<"abort"|"fallback">> * If set to 'abort' any request not found in the HAR file will be aborted. @@ -1045,16 +1090,19 @@ Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerec Defaults to abort. ### option: BrowserContext.routeFromHAR.update +* since: v1.23 - `update` ? If specified, updates the given HAR with the actual network information instead of serving from file. ### option: BrowserContext.routeFromHAR.url +* since: v1.23 - `url` <[string]|[RegExp]> A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern will be served from the HAR file. If not specified, all requests are served from the HAR file. ## method: BrowserContext.serviceWorkers +* since: v1.11 * langs: js, python - returns: <[Array]<[Worker]>> @@ -1065,6 +1113,7 @@ Service workers are only supported on Chromium-based browsers. All existing service workers in the context. ## method: BrowserContext.setDefaultNavigationTimeout +* since: v1.8 This setting will change the default maximum navigation time for the following methods and related shortcuts: * [`method: Page.goBack`] @@ -1080,11 +1129,13 @@ This setting will change the default maximum navigation time for the following m ::: ### param: BrowserContext.setDefaultNavigationTimeout.timeout +* since: v1.8 - `timeout` <[float]> Maximum navigation time in milliseconds ## method: BrowserContext.setDefaultTimeout +* since: v1.8 This setting will change the default maximum time for all the methods accepting [`param: timeout`] option. @@ -1094,11 +1145,13 @@ This setting will change the default maximum time for all the methods accepting ::: ### param: BrowserContext.setDefaultTimeout.timeout +* since: v1.8 - `timeout` <[float]> Maximum time in milliseconds ## async method: BrowserContext.setExtraHTTPHeaders +* since: v1.8 The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged with page-specific extra HTTP headers set with [`method: Page.setExtraHTTPHeaders`]. If page overrides a particular @@ -1109,11 +1162,13 @@ header, page-specific header value will be used instead of the browser context h ::: ### param: BrowserContext.setExtraHTTPHeaders.headers +* since: v1.8 - `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings. ## async method: BrowserContext.setGeolocation +* since: v1.8 Sets the context's geolocation. Passing `null` or `undefined` emulates position unavailable. @@ -1147,29 +1202,35 @@ its geolocation. ::: ### param: BrowserContext.setGeolocation.geolocation +* since: v1.8 - `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`. ## async method: BrowserContext.setHTTPCredentials +* since: v1.8 * langs: js **DEPRECATED** Browsers may cache credentials after successful authentication. Create a new browser context instead. ### param: BrowserContext.setHTTPCredentials.httpCredentials +* since: v1.8 - `httpCredentials` <[null]|[Object]> - `username` <[string]> - `password` <[string]> ## async method: BrowserContext.setOffline +* since: v1.8 ### param: BrowserContext.setOffline.offline +* since: v1.8 - `offline` <[boolean]> Whether to emulate network being offline for the browser context. ## async method: BrowserContext.storageState +* since: v1.8 - returns: <[Object]> - `cookies` <[Array]<[Object]>> - `name` <[string]> @@ -1189,38 +1250,46 @@ Whether to emulate network being offline for the browser context. Returns storage state for this browser context, contains current cookies and local storage snapshot. ## async method: BrowserContext.storageState +* since: v1.8 * langs: csharp, java - returns: <[string]> ### option: BrowserContext.storageState.path = %%-storagestate-option-path-%% +* since: v1.8 ## property: BrowserContext.tracing +* since: v1.12 - type: <[Tracing]> ## async method: BrowserContext.unroute +* since: v1.8 Removes a route created with [`method: BrowserContext.route`]. When [`param: handler`] is not specified, removes all routes for the [`param: url`]. ### param: BrowserContext.unroute.url +* since: v1.8 - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [`method: BrowserContext.route`]. ### param: BrowserContext.unroute.handler +* since: v1.8 * langs: js, python - `handler` ?<[function]\([Route], [Request]\)> Optional handler function used to register a routing with [`method: BrowserContext.route`]. ### param: BrowserContext.unroute.handler +* since: v1.8 * langs: csharp, java - `handler` ?<[function]\([Route]\)> Optional handler function used to register a routing with [`method: BrowserContext.route`]. ## async method: BrowserContext.waitForEvent +* since: v1.8 * langs: js, python - alias-python: expect_event - returns: <[any]> @@ -1259,11 +1328,13 @@ var page = await context.RunAndWaitForPageAsync(async () => ``` ### param: BrowserContext.waitForEvent.event +* since: v1.8 - `event` <[string]> Event name, same one would pass into `browserContext.on(event)`. ### param: BrowserContext.waitForEvent.optionsOrPredicate +* since: v1.8 * langs: js - `optionsOrPredicate` ?<[function]|[Object]> - `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve. @@ -1273,6 +1344,7 @@ Event name, same one would pass into `browserContext.on(event)`. Either a predicate that receives an event or an options object. Optional. ## async method: BrowserContext.waitForPage +* since: v1.9 * langs: java, python, csharp - alias-python: expect_page - alias-csharp: RunAndWaitForPage @@ -1283,14 +1355,17 @@ Performs action and waits for a new [Page] to be created in the context. If pred Will throw an error if the context closes before new [Page] is created. ### option: BrowserContext.waitForPage.predicate = +* since: v1.9 * langs: csharp, java, python - `predicate` <[function]\([Page]\):[boolean]> Receives the [Page] object and resolves to truthy value when the waiting should resolve. ### option: BrowserContext.waitForPage.timeout = %%-wait-for-event-timeout-%% +* since: v1.9 ## async method: BrowserContext.waitForEvent2 +* since: v1.8 * langs: python - alias-python: wait_for_event - returns: <[any]> @@ -1304,5 +1379,8 @@ event's value into the `predicate` function and waits for `predicate(event)` to Will throw an error if the browser context is closed before the `event` is fired. ### param: BrowserContext.waitForEvent2.event = %%-wait-for-event-event-%% +* since: v1.8 ### option: BrowserContext.waitForEvent2.predicate = %%-wait-for-event-predicate-%% +* since: v1.8 ### option: BrowserContext.waitForEvent2.timeout = %%-wait-for-event-timeout-%% +* since: v1.8 diff --git a/docs/src/api/class-browserserver.md b/docs/src/api/class-browserserver.md index 646f08f636..21f318a70a 100644 --- a/docs/src/api/class-browserserver.md +++ b/docs/src/api/class-browserserver.md @@ -1,24 +1,30 @@ # class: BrowserServer +* since: v1.8 * langs: js ## event: BrowserServer.close +* since: v1.8 Emitted when the browser server closes. ## async method: BrowserServer.close +* since: v1.8 Closes the browser gracefully and makes sure the process is terminated. ## async method: BrowserServer.kill +* since: v1.8 Kills the browser process and waits for the process to exit. ## method: BrowserServer.process +* since: v1.8 - returns: <[ChildProcess]> Spawned browser application process. ## method: BrowserServer.wsEndpoint +* since: v1.8 - returns: <[string]> Browser websocket url. diff --git a/docs/src/api/class-browsertype.md b/docs/src/api/class-browsertype.md index fe197d7776..2daa4986f1 100644 --- a/docs/src/api/class-browsertype.md +++ b/docs/src/api/class-browsertype.md @@ -1,4 +1,5 @@ # class: BrowserType +* since: v1.8 BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation: @@ -85,39 +86,46 @@ class BrowserTypeExamples ``` ## async method: BrowserType.connect +* since: v1.8 - returns: <[Browser]> This method attaches Playwright to an existing browser instance. ### param: BrowserType.connect.wsEndpoint +* since: v1.10 - `wsEndpoint` <[string]> A browser websocket endpoint to connect to. ### option: BrowserType.connect.headers +* since: v1.11 - `headers` <[Object]<[string], [string]>> Additional HTTP headers to be sent with web socket connect request. Optional. ### option: BrowserType.connect.slowMo +* since: v1.10 - `slowMo` <[float]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0. ### option: BrowserType.connect.logger +* since: v1.14 * langs: js - `logger` <[Logger]> Logger sink for Playwright logging. Optional. ### option: BrowserType.connect.timeout +* since: v1.10 - `timeout` <[float]> Maximum time in milliseconds to wait for the connection to be established. Defaults to `0` (no timeout). ## async method: BrowserType.connectOverCDP +* since: v1.9 - returns: <[Browser]> This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol. @@ -129,45 +137,53 @@ Connecting over the Chrome DevTools Protocol is only supported for Chromium-base ::: ### param: BrowserType.connectOverCDP.endpointURL +* since: v1.11 - `endpointURL` <[string]> A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or `ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`. ### option: BrowserType.connectOverCDP.endpointURL +* since: v1.14 * langs: js - `endpointURL` <[string]> Deprecated, use the first argument instead. Optional. ### option: BrowserType.connectOverCDP.headers +* since: v1.11 - `headers` <[Object]<[string], [string]>> Additional HTTP headers to be sent with connect request. Optional. ### option: BrowserType.connectOverCDP.slowMo +* since: v1.11 - `slowMo` <[float]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0. ### option: BrowserType.connectOverCDP.logger +* since: v1.14 * langs: js - `logger` <[Logger]> Logger sink for Playwright logging. Optional. ### option: BrowserType.connectOverCDP.timeout +* since: v1.11 - `timeout` <[float]> Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. ## method: BrowserType.executablePath +* since: v1.8 - returns: <[string]> A path where Playwright expects to find a bundled browser executable. ## async method: BrowserType.launch +* since: v1.8 - returns: <[Browser]> Returns the browser instance. @@ -216,16 +232,24 @@ option with extreme caution. [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. -### option: BrowserType.launch.-inline- = %%-shared-browser-options-list-%% +### option: BrowserType.launch.-inline- = %%-shared-browser-options-list-v1.8-%% +* since: v1.8 ### option: BrowserType.launch.firefoxUserPrefs = %%-js-python-browser-option-firefoxuserprefs-%% +* since: v1.8 ### option: BrowserType.launch.firefoxUserPrefs2 = %%-csharp-java-browser-option-firefoxuserprefs-%% +* since: v1.8 ### option: BrowserType.launch.logger = %%-browser-option-logger-%% +* since: v1.8 ### option: BrowserType.launch.slowMo = %%-browser-option-slowmo-%% +* since: v1.8 ### option: BrowserType.launch.ignoreDefaultArgs = %%-csharp-java-browser-option-ignoredefaultargs-%% +* since: v1.8 ### option: BrowserType.launch.ignoreAllDefaultArgs = %%-csharp-java-browser-option-ignorealldefaultargs-%% +* since: v1.9 ## async method: BrowserType.launchPersistentContext +* since: v1.8 - returns: <[BrowserContext]> Returns the persistent browser context instance. @@ -234,6 +258,7 @@ Launches browser that uses persistent storage located at [`param: userDataDir`] this context will automatically close the browser. ### param: BrowserType.launchPersistentContext.userDataDir +* since: v1.8 - `userDataDir` <[path]> Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for @@ -242,13 +267,19 @@ Path to a User Data Directory, which stores browser session data like cookies an Note that Chromium's user data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`. Pass an empty string to use a temporary directory instead. -### option: BrowserType.launchPersistentContext.-inline- = %%-shared-browser-options-list-%% +### option: BrowserType.launchPersistentContext.-inline- = %%-shared-browser-options-list-v1.8-%% +* since: v1.8 ### option: BrowserType.launchPersistentContext.slowMo = %%-browser-option-slowmo-%% +* since: v1.8 ### option: BrowserType.launchPersistentContext.ignoreDefaultArgs = %%-csharp-java-browser-option-ignoredefaultargs-%% +* since: v1.8 ### option: BrowserType.launchPersistentContext.ignoreAllDefaultArgs = %%-csharp-java-browser-option-ignorealldefaultargs-%% -### option: BrowserType.launchPersistentContext.-inline- = %%-shared-context-params-list-%% +* since: v1.9 +### option: BrowserType.launchPersistentContext.-inline- = %%-shared-context-params-list-v1.8-%% +* since: v1.8 ## async method: BrowserType.launchServer +* since: v1.8 * langs: js - returns: <[BrowserServer]> @@ -270,17 +301,23 @@ const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'. })(); ``` -### option: BrowserType.launchServer.-inline- = %%-shared-browser-options-list-%% +### option: BrowserType.launchServer.-inline- = %%-shared-browser-options-list-v1.8-%% +* since: v1.8 ### option: BrowserType.launchServer.firefoxUserPrefs = %%-js-python-browser-option-firefoxuserprefs-%% +* since: v1.8 ### option: BrowserType.launchServer.firefoxUserPrefs2 = %%-csharp-java-browser-option-firefoxuserprefs-%% +* since: v1.8 ### option: BrowserType.launchServer.logger = %%-browser-option-logger-%% +* since: v1.8 ### option: BrowserType.launchServer.port +* since: v1.8 - `port` <[int]> Port to use for the web socket. Defaults to 0 that picks any available port. ### option: BrowserType.launchServer.wsPath +* since: v1.15 - `wsPath` <[string]> Path at which to serve the Browser Server. For security, this defaults to an @@ -293,6 +330,7 @@ use an unguessable token when using this option. ::: ## method: BrowserType.name +* since: v1.8 - returns: <[string]> Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`. diff --git a/docs/src/api/class-cdpsession.md b/docs/src/api/class-cdpsession.md index b690b7b4f0..70783247ff 100644 --- a/docs/src/api/class-cdpsession.md +++ b/docs/src/api/class-cdpsession.md @@ -1,4 +1,5 @@ # class: CDPSession +* since: v1.8 * langs: js, python * extends: [EventEmitter] @@ -46,19 +47,23 @@ client.send("Animation.setPlaybackRate", { ``` ## async method: CDPSession.detach +* since: v1.8 Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages. ## async method: CDPSession.send +* since: v1.8 - returns: <[Object]> ### param: CDPSession.send.method +* since: v1.8 - `method` <[string]> Protocol method name. ### param: CDPSession.send.params +* since: v1.8 - `params` ?<[Object]> Optional method parameters. diff --git a/docs/src/api/class-consolemessage.md b/docs/src/api/class-consolemessage.md index 25b07e832f..784eef8748 100644 --- a/docs/src/api/class-consolemessage.md +++ b/docs/src/api/class-consolemessage.md @@ -1,4 +1,5 @@ # class: ConsoleMessage +* since: v1.8 [ConsoleMessage] objects are dispatched by page via the [`event: Page.console`] event. For each console messages logged in the page there will be corresponding event in the Playwright @@ -106,11 +107,13 @@ await message.Args.ElementAt(1).JsonValueAsync(); // 42 ``` ## method: ConsoleMessage.args +* since: v1.8 - returns: <[Array]<[JSHandle]>> List of arguments passed to a `console` function call. See also [`event: Page.console`]. ## method: ConsoleMessage.location +* since: v1.8 * langs: js, python - returns: <[Object]> - `url` <[string]> URL of the resource. @@ -118,17 +121,20 @@ List of arguments passed to a `console` function call. See also [`event: Page.co - `columnNumber` <[int]> 0-based column number in the resource. ## method: ConsoleMessage.location +* since: v1.8 * langs: csharp, java - returns: <[string]> URL of the resource followed by 0-based line and column numbers in the resource formatted as `URL:line:column`. ## method: ConsoleMessage.text +* since: v1.8 - returns: <[string]> The text of the console message. ## method: ConsoleMessage.type +* since: v1.8 - returns: <[string]> One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, diff --git a/docs/src/api/class-coverage.md b/docs/src/api/class-coverage.md index 513005b407..021d33e127 100644 --- a/docs/src/api/class-coverage.md +++ b/docs/src/api/class-coverage.md @@ -1,4 +1,5 @@ # class: Coverage +* since: v1.11 * langs: js Coverage gathers information about parts of JavaScript and CSS that were used by the page. @@ -30,15 +31,18 @@ const v8toIstanbul = require('v8-to-istanbul'); ``` ## async method: Coverage.startCSSCoverage +* since: v1.11 Returns coverage is started ### option: Coverage.startCSSCoverage.resetOnNavigation +* since: v1.11 - `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`. ## async method: Coverage.startJSCoverage +* since: v1.11 Returns coverage is started @@ -49,16 +53,19 @@ will have `__playwright_evaluation_script__` as their URL. ::: ### option: Coverage.startJSCoverage.resetOnNavigation +* since: v1.11 - `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`. ### option: Coverage.startJSCoverage.reportAnonymousScripts +* since: v1.11 - `reportAnonymousScripts` <[boolean]> Whether anonymous scripts generated by the page should be reported. Defaults to `false`. ## async method: Coverage.stopCSSCoverage +* since: v1.11 - returns: <[Array]<[Object]>> - `url` <[string]> StyleSheet URL - `text` ?<[string]> StyleSheet content, if available. @@ -73,6 +80,7 @@ CSS Coverage doesn't include dynamically injected style tags without sourceURLs. ::: ## async method: Coverage.stopJSCoverage +* since: v1.11 - returns: <[Array]<[Object]>> - `url` <[string]> Script URL - `scriptId` <[string]> Script ID diff --git a/docs/src/api/class-dialog.md b/docs/src/api/class-dialog.md index 55bb757611..b013f4b69c 100644 --- a/docs/src/api/class-dialog.md +++ b/docs/src/api/class-dialog.md @@ -1,4 +1,5 @@ # class: Dialog +* since: v1.8 [Dialog] objects are dispatched by page via the [`event: Page.dialog`] event. @@ -109,29 +110,35 @@ When listener is present, it **must** either [`method: Dialog.accept`] or [`meth ::: ## async method: Dialog.accept +* since: v1.8 Returns when the dialog has been accepted. ### param: Dialog.accept.promptText +* since: v1.8 - `promptText` ?<[string]> A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional. ## method: Dialog.defaultValue +* since: v1.8 - returns: <[string]> If dialog is prompt, returns default prompt value. Otherwise, returns empty string. ## async method: Dialog.dismiss +* since: v1.8 Returns when the dialog has been dismissed. ## method: Dialog.message +* since: v1.8 - returns: <[string]> A message displayed in the dialog. ## method: Dialog.type +* since: v1.8 - returns: <[string]> Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`. diff --git a/docs/src/api/class-download.md b/docs/src/api/class-download.md index 701354b377..281ddd278f 100644 --- a/docs/src/api/class-download.md +++ b/docs/src/api/class-download.md @@ -1,4 +1,5 @@ # class: Download +* since: v1.8 [Download] objects are dispatched by page via the [`event: Page.download`] event. @@ -61,31 +62,37 @@ Console.WriteLine(await download.PathAsync()); ``` ## async method: Download.cancel +* since: v1.13 Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations, `download.failure()` would resolve to `'canceled'`. ## async method: Download.createReadStream +* since: v1.8 * langs: java, js, csharp - returns: <[null]|[Readable]> Returns readable stream for current download or `null` if download failed. ## async method: Download.delete +* since: v1.8 Deletes the downloaded file. Will wait for the download to finish if necessary. ## async method: Download.failure +* since: v1.8 - returns: <[null]|[string]> Returns download error if any. Will wait for the download to finish if necessary. ## method: Download.page +* since: v1.12 - returns: <[Page]> Get the page that the download belongs to. ## async method: Download.path +* since: v1.8 - returns: <[null]|[path]> Returns path to the downloaded file in case of successful download. The method will @@ -95,16 +102,19 @@ Note that the download's file name is a random GUID, use [`method: Download.sugg to get suggested file name. ## async method: Download.saveAs +* since: v1.8 Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will wait for the download to finish if necessary. ### param: Download.saveAs.path +* since: v1.8 - `path` <[path]> Path where the download should be copied. ## method: Download.suggestedFilename +* since: v1.8 - returns: <[string]> Returns suggested filename for this download. It is typically computed by the browser from the @@ -113,6 +123,7 @@ or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.o browsers can use different logic for computing it. ## method: Download.url +* since: v1.8 - returns: <[string]> Returns downloaded url. diff --git a/docs/src/api/class-electron.md b/docs/src/api/class-electron.md index c17c84957e..57baacb92e 100644 --- a/docs/src/api/class-electron.md +++ b/docs/src/api/class-electron.md @@ -1,4 +1,5 @@ # class: Electron +* since: v1.9 * langs: js Playwright has **experimental** support for Electron automation. You can access electron namespace via: @@ -51,50 +52,72 @@ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright * v14+ ## async method: Electron.launch +* since: v1.9 - returns: <[ElectronApplication]> Launches electron application specified with the [`option: executablePath`]. ### option: Electron.launch.executablePath +* since: v1.9 - `executablePath` <[string]> Launches given Electron application. If not specified, launches the default Electron executable installed in this package, located at `node_modules/.bin/electron`. ### option: Electron.launch.args +* since: v1.9 - `args` <[Array]<[string]>> Additional arguments to pass to the application when launching. You typically pass the main script name here. ### option: Electron.launch.cwd +* since: v1.9 - `cwd` <[string]> Current working directory to launch application from. ### option: Electron.launch.env +* since: v1.9 - `env` <[Object]<[string], [string]>> Specifies environment variables that will be visible to Electron. Defaults to `process.env`. ### option: Electron.launch.timeout +* since: v1.15 - `timeout` <[float]> Maximum time in milliseconds to wait for the application to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. ### option: Electron.launch.acceptdownloads = %%-context-option-acceptdownloads-%% +* since: v1.12 ### option: Electron.launch.bypassCSP = %%-context-option-bypasscsp-%% +* since: v1.12 ### option: Electron.launch.colorScheme = %%-context-option-colorscheme-%% +* since: v1.12 ### option: Electron.launch.extraHTTPHeaders = %%-context-option-extrahttpheaders-%% +* since: v1.12 ### option: Electron.launch.geolocation = %%-context-option-geolocation-%% +* since: v1.12 ### option: Electron.launch.httpcredentials = %%-context-option-httpcredentials-%% +* since: v1.12 ### option: Electron.launch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%% +* since: v1.12 ### option: Electron.launch.locale = %%-context-option-locale-%% +* since: v1.12 ### option: Electron.launch.offline = %%-context-option-offline-%% +* since: v1.12 ### option: Electron.launch.recordhar = %%-context-option-recordhar-%% +* since: v1.12 ### option: Electron.launch.recordharpath = %%-context-option-recordhar-path-%% +* since: v1.12 ### option: Electron.launch.recordHarOmitContent = %%-context-option-recordhar-omit-content-%% +* since: v1.12 ### option: Electron.launch.recordvideo = %%-context-option-recordvideo-%% +* since: v1.12 ### option: Electron.launch.recordvideodir = %%-context-option-recordvideo-dir-%% +* since: v1.12 ### option: Electron.launch.recordvideosize = %%-context-option-recordvideo-size-%% +* since: v1.12 ### option: Electron.launch.timezoneId = %%-context-option-timezoneid-%% +* since: v1.12 diff --git a/docs/src/api/class-electronapplication.md b/docs/src/api/class-electronapplication.md index 80f25302fa..5b661ccb49 100644 --- a/docs/src/api/class-electronapplication.md +++ b/docs/src/api/class-electronapplication.md @@ -1,4 +1,5 @@ # class: ElectronApplication +* since: v1.9 * langs: js Electron application representation. You can use [`method: Electron.launch`] to @@ -36,35 +37,42 @@ const { _electron: electron } = require('playwright'); ``` ## event: ElectronApplication.close +* since: v1.9 This event is issued when the application closes. ## event: ElectronApplication.window +* since: v1.9 - argument: <[Page]> This event is issued for every window that is created **and loaded** in Electron. It contains a [Page] that can be used for Playwright automation. ## async method: ElectronApplication.browserWindow +* since: v1.11 - returns: <[JSHandle]> Returns the BrowserWindow object that corresponds to the given Playwright page. ### param: ElectronApplication.browserWindow.page +* since: v1.11 - `page` <[Page]> Page to retrieve the window for. ## async method: ElectronApplication.close +* since: v1.9 Closes Electron application. ## method: ElectronApplication.context +* since: v1.9 - returns: <[BrowserContext]> This method returns browser context that can be used for setting up context-wide routing, etc. ## async method: ElectronApplication.evaluate +* since: v1.9 - returns: <[Serializable]> Returns the return value of [`param: expression`]. @@ -77,13 +85,16 @@ If the function passed to the [`method: ElectronApplication.evaluate`] returns a some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`. ### param: ElectronApplication.evaluate.expression = %%-evaluate-expression-%% +* since: v1.9 ### param: ElectronApplication.evaluate.arg +* since: v1.9 - `arg` ?<[EvaluationArgument]> Optional argument to pass to [`param: expression`]. ## async method: ElectronApplication.evaluateHandle +* since: v1.9 - returns: <[JSHandle]> Returns the return value of [`param: expression`] as a [JSHandle]. @@ -94,13 +105,16 @@ If the function passed to the [`method: ElectronApplication.evaluateHandle`] ret [`method: ElectronApplication.evaluateHandle`] would wait for the promise to resolve and return its value. ### param: ElectronApplication.evaluateHandle.expression = %%-evaluate-expression-%% +* since: v1.9 ### param: ElectronApplication.evaluateHandle.arg +* since: v1.9 - `arg` ?<[EvaluationArgument]> Optional argument to pass to [`param: expression`]. ## async method: ElectronApplication.firstWindow +* since: v1.9 - returns: <[Page]> Convenience method that waits for the first application window to be opened. @@ -115,11 +129,13 @@ Typically your script will start with: ``` ## method: ElectronApplication.process +* since: v1.21 - returns: <[ChildProcess]> Returns the main process for this Electron Application. ## async method: ElectronApplication.waitForEvent +* since: v1.9 - returns: <[any]> Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the application is closed before the event is fired. Returns the event data value. @@ -132,8 +148,10 @@ const [window] = await Promise.all([ ``` ### param: ElectronApplication.waitForEvent.event = %%-wait-for-event-event-%% +* since: v1.9 ### param: ElectronApplication.waitForEvent.optionsOrPredicate +* since: v1.9 * langs: js - `optionsOrPredicate` ?<[function]|[Object]> - `predicate` <[function]> receives the event data and resolves to truthy value when the waiting should resolve. @@ -143,6 +161,7 @@ const [window] = await Promise.all([ Either a predicate that receives an event or an options object. Optional. ## method: ElectronApplication.windows +* since: v1.9 - returns: <[Array]<[Page]>> Convenience method that returns all the opened windows. diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md index 0cd557e4c3..75dde84924 100644 --- a/docs/src/api/class-elementhandle.md +++ b/docs/src/api/class-elementhandle.md @@ -1,4 +1,5 @@ # class: ElementHandle +* since: v1.8 * extends: [JSHandle] ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.querySelector`] method. @@ -106,6 +107,7 @@ await locator.ClickAsync(); ``` ## async method: ElementHandle.boundingBox +* since: v1.8 - returns: <[null]|[Object]> - `x` <[float]> the x coordinate of the element in pixels. - `y` <[float]> the y coordinate of the element in pixels. @@ -151,6 +153,7 @@ await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2); ``` ## async method: ElementHandle.check +* since: v1.8 This method checks the element by performing the following steps: 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already @@ -167,16 +170,22 @@ When all steps combined have not finished during the specified [`option: timeout [TimeoutError]. Passing zero timeout disables this. ### option: ElementHandle.check.position = %%-input-position-%% +* since: v1.11 ### option: ElementHandle.check.force = %%-input-force-%% +* since: v1.8 ### option: ElementHandle.check.noWaitAfter = %%-input-no-wait-after-%% +* since: v1.8 ### option: ElementHandle.check.timeout = %%-input-timeout-%% +* since: v1.8 ### option: ElementHandle.check.trial = %%-input-trial-%% +* since: v1.11 ## async method: ElementHandle.click +* since: v1.8 This method clicks the element by performing the following steps: 1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set. @@ -190,29 +199,40 @@ When all steps combined have not finished during the specified [`option: timeout [TimeoutError]. Passing zero timeout disables this. ### option: ElementHandle.click.button = %%-input-button-%% +* since: v1.8 ### option: ElementHandle.click.clickCount = %%-input-click-count-%% +* since: v1.8 ### option: ElementHandle.click.delay = %%-input-down-up-delay-%% +* since: v1.8 ### option: ElementHandle.click.position = %%-input-position-%% +* since: v1.8 ### option: ElementHandle.click.modifiers = %%-input-modifiers-%% +* since: v1.8 ### option: ElementHandle.click.force = %%-input-force-%% +* since: v1.8 ### option: ElementHandle.click.noWaitAfter = %%-input-no-wait-after-%% +* since: v1.8 ### option: ElementHandle.click.timeout = %%-input-timeout-%% +* since: v1.8 ### option: ElementHandle.click.trial = %%-input-trial-%% +* since: v1.11 ## async method: ElementHandle.contentFrame +* since: v1.8 - returns: <[null]|[Frame]> Returns the content frame for element handles referencing iframe nodes, or `null` otherwise ## async method: ElementHandle.dblclick +* since: v1.8 * langs: - alias-csharp: DblClickAsync @@ -233,22 +253,31 @@ When all steps combined have not finished during the specified [`option: timeout ::: ### option: ElementHandle.dblclick.button = %%-input-button-%% +* since: v1.8 ### option: ElementHandle.dblclick.delay = %%-input-down-up-delay-%% +* since: v1.8 ### option: ElementHandle.dblclick.position = %%-input-position-%% +* since: v1.8 ### option: ElementHandle.dblclick.modifiers = %%-input-modifiers-%% +* since: v1.8 ### option: ElementHandle.dblclick.force = %%-input-force-%% +* since: v1.8 ### option: ElementHandle.dblclick.noWaitAfter = %%-input-no-wait-after-%% +* since: v1.8 ### option: ElementHandle.dblclick.timeout = %%-input-timeout-%% +* since: v1.8 ### option: ElementHandle.dblclick.trial = %%-input-trial-%% +* since: v1.11 ## async method: ElementHandle.dispatchEvent +* since: v1.8 The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click` is dispatched. This is equivalent to calling @@ -325,16 +354,19 @@ await elementHandle.DispatchEventAsync("dragstart", new Dictionary DOM event type: `"click"`, `"dragstart"`, etc. ### param: ElementHandle.dispatchEvent.eventInit +* since: v1.8 - `eventInit` ?<[EvaluationArgument]> Optional event-specific initialization properties. ## async method: ElementHandle.evalOnSelector +* since: v1.9 * langs: - alias-python: eval_on_selector - alias-js: $eval @@ -382,15 +414,19 @@ Assert.AreEqual("10", await tweetHandle.EvalOnSelectorAsync(".retweets", "node = ``` ### param: ElementHandle.evalOnSelector.selector = %%-query-selector-%% +* since: v1.9 ### param: ElementHandle.evalOnSelector.expression = %%-evaluate-expression-%% +* since: v1.9 ### param: ElementHandle.evalOnSelector.arg +* since: v1.9 - `arg` ?<[EvaluationArgument]> Optional argument to pass to [`param: expression`]. ## async method: ElementHandle.evalOnSelectorAll +* since: v1.9 * langs: - alias-python: eval_on_selector_all - alias-js: $$eval @@ -440,15 +476,19 @@ Assert.AreEqual(new [] { "Hello!", "Hi!" }, await feedHandle.EvalOnSelectorAllAs ``` ### param: ElementHandle.evalOnSelectorAll.selector = %%-query-selector-%% +* since: v1.9 ### param: ElementHandle.evalOnSelectorAll.expression = %%-evaluate-expression-%% +* since: v1.9 ### param: ElementHandle.evalOnSelectorAll.arg +* since: v1.9 - `arg` ?<[EvaluationArgument]> Optional argument to pass to [`param: expression`]. ## async method: ElementHandle.fill +* since: v1.8 This method waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field. @@ -457,29 +497,37 @@ If the target element is not an ``, `