Skip to content

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

docs: move common screenshot options to params.md (#12008)

Andrey Lushnikov3c88d4126c27
diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md
index 6291bb5809..bb44b2c06b 100644
--- a/docs/src/api/class-elementhandle.md
+++ b/docs/src/api/class-elementhandle.md
@@ -622,35 +622,7 @@ Returns the buffer with the captured screenshot.
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
screenshot. If the element is detached from DOM, the method throws an error.
-### option: ElementHandle.screenshot.path
-- `path` <[path]>
-
-The file path to save the image to. The screenshot type will be inferred from file extension. If [`option: path`] is a
-relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
-saved to the disk.
-
-### option: ElementHandle.screenshot.type = %%-screenshot-type-%%
-
-### option: ElementHandle.screenshot.quality
-- `quality` <[int]>
-
-The quality of the image, between 0-100. Not applicable to `png` images.
-
-### option: ElementHandle.screenshot.omitBackground
-- `omitBackground` <[boolean]>
-
-Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.
-Defaults to `false`.
-
-### option: ElementHandle.screenshot.disableAnimations
-- `disableAnimations` <[boolean]>
-
-When true, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
-- finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
-- infinite animations are canceled to initial state, and then played over after the screenshot.
-
-
-### option: ElementHandle.screenshot.timeout = %%-input-timeout-%%
+### option: ElementHandle.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: ElementHandle.scrollIntoViewIfNeeded
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md
index 4ebef599a6..ad5eef8494 100644
--- a/docs/src/api/class-locator.md
+++ b/docs/src/api/class-locator.md
@@ -600,34 +600,7 @@ Returns the buffer with the captured screenshot.
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
screenshot. If the element is detached from DOM, the method throws an error.
-### option: Locator.screenshot.path
-- `path` <[path]>
-
-The file path to save the image to. The screenshot type will be inferred from file extension. If [`option: path`] is a
-relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
-saved to the disk.
-
-### option: Locator.screenshot.type = %%-screenshot-type-%%
-
-### option: Locator.screenshot.quality
-- `quality` <[int]>
-
-The quality of the image, between 0-100. Not applicable to `png` images.
-
-### option: Locator.screenshot.omitBackground
-- `omitBackground` <[boolean]>
-
-Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.
-Defaults to `false`.
-
-### option: Locator.screenshot.disableAnimations
-- `disableAnimations` <[boolean]>
-
-When true, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
-- finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
-- infinite animations are canceled to initial state, and then played over after the screenshot.
-
-### option: Locator.screenshot.timeout = %%-input-timeout-%%
+### option: Locator.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: Locator.scrollIntoViewIfNeeded
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 4e8e94fcdf..09a89027ba 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -2648,19 +2648,7 @@ How often a route should be used. By default it will be used every time.
Returns the buffer with the captured screenshot.
-### option: Page.screenshot.path
-- `path` <[path]>
-
-The file path to save the image to. The screenshot type will be inferred from file extension. If [`option: path`] is a
-relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
-saved to the disk.
-
-### option: Page.screenshot.type = %%-screenshot-type-%%
-
-### option: Page.screenshot.quality
-- `quality` <[int]>
-
-The quality of the image, between 0-100. Not applicable to `png` images.
+### option: Page.screenshot.-inline- = %%-screenshot-options-common-list-%%
### option: Page.screenshot.fullPage
- `fullPage` <[boolean]>
@@ -2668,12 +2656,6 @@ The quality of the image, between 0-100. Not applicable to `png` images.
When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to
`false`.
-### option: Page.screenshot.disableAnimations
-- `disableAnimations` <[boolean]>
-
-When true, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
-- finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
-- infinite animations are canceled to initial state, and then played over after the screenshot.
### option: Page.screenshot.clip
- `clip` <[Object]>
@@ -2684,14 +2666,6 @@ When true, stops CSS animations, CSS transitions and Web Animations. Animations
An object which specifies clipping of the resulting image. Should have the following fields:
-### option: Page.screenshot.omitBackground
-- `omitBackground` <[boolean]>
-
-Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.
-Defaults to `false`.
-
-### option: Page.screenshot.timeout = %%-input-timeout-%%
-
## async method: Page.selectOption
- returns: <[Array]<[string]>>
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 732af683f7..7dc00767d7 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -646,11 +646,6 @@ method resolves immediately. Can be one of:
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
* `'networkidle'` - wait until there are no network connections for at least `500` ms.
-## screenshot-type
-- `type` <[ScreenshotType]<"png"|"jpeg">>
-
-Specify screenshot type, defaults to `png`.
-
## java-wait-for-event-callback
* langs: java
- `callback` <[Runnable]>
@@ -887,3 +882,42 @@ Note that outer and inner locators must belong to the same frame. Inner locator
## locator-options-list
- %%-locator-option-has-text-%%
- %%-locator-option-has-%%
+
+## screenshot-option-disable-animations
+- `disableAnimations` <[boolean]>
+
+When true, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
+- finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
+- infinite animations are canceled to initial state, and then played over after the screenshot.
+
+## screenshot-option-omit-background
+- `omitBackground` <[boolean]>
+
+Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.
+Defaults to `false`.
+
+## screenshot-option-quality
+- `quality` <[int]>
+
+The quality of the image, between 0-100. Not applicable to `png` images.
+
+## screenshot-option-path
+- `path` <[path]>
+
+The file path to save the image to. The screenshot type will be inferred from file extension. If [`option: path`] is a
+relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
+saved to the disk.
+
+## screenshot-option-type
+- `type` <[ScreenshotType]<"png"|"jpeg">>
+
+Specify screenshot type, defaults to `png`.
+
+## screenshot-options-common-list
+- %%-screenshot-option-disable-animations-%%
+- %%-screenshot-option-omit-background-%%
+- %%-screenshot-option-quality-%%
+- %%-screenshot-option-path-%%
+- %%-screenshot-option-type-%%
+- %%-input-timeout-%%
+