docs: add details to the element screenshot methods (#13847)

This commit is contained in:
Dmitry Gozman 2022-04-29 17:36:09 +01:00 committed by GitHub
parent e3b96d1ee4
commit dc3f2d26c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 6 deletions

View file

@ -619,11 +619,13 @@ returns empty array.
## async method: ElementHandle.screenshot ## async method: ElementHandle.screenshot
- returns: <[Buffer]> - returns: <[Buffer]>
Returns the buffer with the captured screenshot. This method captures a screenshot of the page, clipped to the size and position of this particular element. If the element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable container, only the currently scrolled content will be visible on the screenshot.
This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a 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. screenshot. If the element is detached from DOM, the method throws an error.
Returns the buffer with the captured screenshot.
### option: ElementHandle.screenshot.-inline- = %%-screenshot-options-common-list-%% ### option: ElementHandle.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: ElementHandle.scrollIntoViewIfNeeded ## async method: ElementHandle.scrollIntoViewIfNeeded

View file

@ -601,11 +601,13 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
## async method: Locator.screenshot ## async method: Locator.screenshot
- returns: <[Buffer]> - returns: <[Buffer]>
Returns the buffer with the captured screenshot. This method captures a screenshot of the page, clipped to the size and position of a particular element matching the locator. If the element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable container, only the currently scrolled content will be visible on the screenshot.
This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a 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. screenshot. If the element is detached from DOM, the method throws an error.
Returns the buffer with the captured screenshot.
### option: Locator.screenshot.-inline- = %%-screenshot-options-common-list-%% ### option: Locator.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: Locator.scrollIntoViewIfNeeded ## async method: Locator.scrollIntoViewIfNeeded

View file

@ -8144,10 +8144,14 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
}): Promise<void>; }): Promise<void>;
/** /**
* Returns the buffer with the captured screenshot. * This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
* element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
* container, only the currently scrolled content will be visible on the screenshot.
* *
* This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a * This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a
* screenshot. If the element is detached from DOM, the method throws an error. * screenshot. If the element is detached from DOM, the method throws an error.
*
* Returns the buffer with the captured screenshot.
* @param options * @param options
*/ */
screenshot(options?: { screenshot(options?: {
@ -9486,10 +9490,14 @@ export interface Locator {
}): Promise<void>; }): Promise<void>;
/** /**
* Returns the buffer with the captured screenshot. * This method captures a screenshot of the page, clipped to the size and position of a particular element matching the
* locator. If the element is covered by other elements, it will not be actually visible on the screenshot. If the element
* is a scrollable container, only the currently scrolled content will be visible on the screenshot.
* *
* This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a * This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a
* screenshot. If the element is detached from DOM, the method throws an error. * screenshot. If the element is detached from DOM, the method throws an error.
*
* Returns the buffer with the captured screenshot.
* @param options * @param options
*/ */
screenshot(options?: LocatorScreenshotOptions): Promise<Buffer>; screenshot(options?: LocatorScreenshotOptions): Promise<Buffer>;

View file

@ -8146,10 +8146,14 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
}): Promise<void>; }): Promise<void>;
/** /**
* Returns the buffer with the captured screenshot. * This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
* element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
* container, only the currently scrolled content will be visible on the screenshot.
* *
* This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a * This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a
* screenshot. If the element is detached from DOM, the method throws an error. * screenshot. If the element is detached from DOM, the method throws an error.
*
* Returns the buffer with the captured screenshot.
* @param options * @param options
*/ */
screenshot(options?: { screenshot(options?: {
@ -9495,10 +9499,14 @@ export interface Locator {
}): Promise<void>; }): Promise<void>;
/** /**
* Returns the buffer with the captured screenshot. * This method captures a screenshot of the page, clipped to the size and position of a particular element matching the
* locator. If the element is covered by other elements, it will not be actually visible on the screenshot. If the element
* is a scrollable container, only the currently scrolled content will be visible on the screenshot.
* *
* This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a * This method waits for the [actionability](https://playwright.dev/docs/actionability) checks, then scrolls element into view before taking a
* screenshot. If the element is detached from DOM, the method throws an error. * screenshot. If the element is detached from DOM, the method throws an error.
*
* Returns the buffer with the captured screenshot.
* @param options * @param options
*/ */
screenshot(options?: LocatorScreenshotOptions): Promise<Buffer>; screenshot(options?: LocatorScreenshotOptions): Promise<Buffer>;