Package com.microsoft.playwright
Class Page.ScreenshotOptions
java.lang.Object
com.microsoft.playwright.Page.ScreenshotOptions
- Enclosing interface:
Page
-
Field Summary
FieldsModifier and TypeFieldDescriptionWhen set to"disabled", stops CSS animations, CSS transitions and Web Animations.When set to"hide", screenshot will hide text caret.An object which specifies clipping of the resulting image.When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport.Specify locators that should be masked when the screenshot is taken.Specify the color of the overlay box for masked elements, in CSS color format.Hides default white background and allows capturing screenshots with transparency.The file path to save the image to.The quality of the image, between 0-100.When set to"css", screenshot will have a single pixel per each css pixel on the page.Maximum time in milliseconds.Specify screenshot type, defaults topng. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetAnimations(ScreenshotAnimations animations) When set to"disabled", stops CSS animations, CSS transitions and Web Animations.setCaret(ScreenshotCaret caret) When set to"hide", screenshot will hide text caret.setClip(double x, double y, double width, double height) An object which specifies clipping of the resulting image.An object which specifies clipping of the resulting image.setFullPage(boolean fullPage) When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport.Specify locators that should be masked when the screenshot is taken.setMaskColor(String maskColor) Specify the color of the overlay box for masked elements, in CSS color format.setOmitBackground(boolean omitBackground) Hides default white background and allows capturing screenshots with transparency.The file path to save the image to.setQuality(int quality) The quality of the image, between 0-100.setScale(ScreenshotScale scale) When set to"css", screenshot will have a single pixel per each css pixel on the page.setTimeout(double timeout) Maximum time in milliseconds.setType(ScreenshotType type) Specify screenshot type, defaults topng.
-
Field Details
-
animations
When set to"disabled", 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
transitionendevent. - infinite animations are canceled to initial state, and then played over after the screenshot.
Defaults to
"allow"that leaves animations untouched. - finite animations are fast-forwarded to completion, so they'll fire
-
caret
When set to"hide", screenshot will hide text caret. When set to"initial", text caret behavior will not be changed. Defaults to"hide". -
clip
An object which specifies clipping of the resulting image. -
fullPage
When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults tofalse. -
mask
Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box#FF00FF(customized bymaskColor) that completely covers its bounding box. -
maskColor
Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink#FF00FF. -
omitBackground
Hides default white background and allows capturing screenshots with transparency. Not applicable tojpegimages. Defaults tofalse. -
path
The file path to save the image to. The screenshot type will be inferred from file extension. Ifpathis 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. -
quality
The quality of the image, between 0-100. Not applicable topngimages. -
scale
When set to"css", screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using"device"option will produce a single pixel per each device pixel, so screenshots of high-dpi devices will be twice as large or even larger.Defaults to
"device". -
timeout
Maximum time in milliseconds. Defaults to30000(30 seconds). Pass0to disable timeout. The default value can be changed by using theBrowserContext.setDefaultTimeout()orPage.setDefaultTimeout()methods. -
type
Specify screenshot type, defaults topng.
-
-
Constructor Details
-
ScreenshotOptions
public ScreenshotOptions()
-
-
Method Details
-
setAnimations
When set to"disabled", 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
transitionendevent. - infinite animations are canceled to initial state, and then played over after the screenshot.
Defaults to
"allow"that leaves animations untouched. - finite animations are fast-forwarded to completion, so they'll fire
-
setCaret
When set to"hide", screenshot will hide text caret. When set to"initial", text caret behavior will not be changed. Defaults to"hide". -
setClip
An object which specifies clipping of the resulting image. -
setClip
An object which specifies clipping of the resulting image. -
setFullPage
When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults tofalse. -
setMask
Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box#FF00FF(customized bymaskColor) that completely covers its bounding box. -
setMaskColor
Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink#FF00FF. -
setOmitBackground
Hides default white background and allows capturing screenshots with transparency. Not applicable tojpegimages. Defaults tofalse. -
setPath
The file path to save the image to. The screenshot type will be inferred from file extension. Ifpathis 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. -
setQuality
The quality of the image, between 0-100. Not applicable topngimages. -
setScale
When set to"css", screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using"device"option will produce a single pixel per each device pixel, so screenshots of high-dpi devices will be twice as large or even larger.Defaults to
"device". -
setTimeout
Maximum time in milliseconds. Defaults to30000(30 seconds). Pass0to disable timeout. The default value can be changed by using theBrowserContext.setDefaultTimeout()orPage.setDefaultTimeout()methods. -
setType
Specify screenshot type, defaults topng.
-