Modifier and Type | Field and Description |
---|---|
ScreenshotAnimations |
animations
When set to
"disabled" , stops CSS animations, CSS transitions and Web Animations. |
ScreenshotCaret |
caret
When set to
"hide" , screenshot will hide text caret. |
List<Locator> |
mask
Specify locators that should be masked when the screenshot is taken.
|
Boolean |
omitBackground
Hides default white background and allows capturing screenshots with transparency.
|
Path |
path
The file path to save the image to.
|
Integer |
quality
The quality of the image, between 0-100.
|
ScreenshotScale |
scale
When set to
"css" , screenshot will have a single pixel per each css pixel on the page. |
Double |
timeout
Maximum time in milliseconds, defaults to 30 seconds, pass
0 to disable timeout. |
ScreenshotType |
type
Specify screenshot type, defaults to
png . |
Constructor and Description |
---|
ScreenshotOptions() |
Modifier and Type | Method and Description |
---|---|
Locator.ScreenshotOptions |
setAnimations(ScreenshotAnimations animations)
When set to
"disabled" , stops CSS animations, CSS transitions and Web Animations. |
Locator.ScreenshotOptions |
setCaret(ScreenshotCaret caret)
When set to
"hide" , screenshot will hide text caret. |
Locator.ScreenshotOptions |
setMask(List<Locator> mask)
Specify locators that should be masked when the screenshot is taken.
|
Locator.ScreenshotOptions |
setOmitBackground(boolean omitBackground)
Hides default white background and allows capturing screenshots with transparency.
|
Locator.ScreenshotOptions |
setPath(Path path)
The file path to save the image to.
|
Locator.ScreenshotOptions |
setQuality(int quality)
The quality of the image, between 0-100.
|
Locator.ScreenshotOptions |
setScale(ScreenshotScale scale)
When set to
"css" , screenshot will have a single pixel per each css pixel on the page. |
Locator.ScreenshotOptions |
setTimeout(double timeout)
Maximum time in milliseconds, defaults to 30 seconds, pass
0 to disable timeout. |
Locator.ScreenshotOptions |
setType(ScreenshotType type)
Specify screenshot type, defaults to
png . |
public ScreenshotAnimations animations
"disabled"
, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
depending on their duration:
transitionend
event. Defaults to "allow"
that leaves animations untouched.
public ScreenshotCaret caret
"hide"
, screenshot will hide text caret. When set to "initial"
, text caret behavior will not be changed.
Defaults to "hide"
.public List<Locator> mask
#FF00FF
that completely covers its bounding box.public Boolean omitBackground
jpeg
images.
Defaults to false
.public Path path
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.public Integer quality
png
images.public ScreenshotScale scale
"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 screenhots of
high-dpi devices will be twice as large or even larger. Defaults to "device"
.public Double timeout
0
to disable timeout. The default value can be changed by
using the BrowserContext.setDefaultTimeout()
or Page.setDefaultTimeout()
methods.public ScreenshotType type
png
.public Locator.ScreenshotOptions setAnimations(ScreenshotAnimations animations)
"disabled"
, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
depending on their duration:
transitionend
event. Defaults to "allow"
that leaves animations untouched.
public Locator.ScreenshotOptions setCaret(ScreenshotCaret caret)
"hide"
, screenshot will hide text caret. When set to "initial"
, text caret behavior will not be changed.
Defaults to "hide"
.public Locator.ScreenshotOptions setMask(List<Locator> mask)
#FF00FF
that completely covers its bounding box.public Locator.ScreenshotOptions setOmitBackground(boolean omitBackground)
jpeg
images.
Defaults to false
.public Locator.ScreenshotOptions setPath(Path path)
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.public Locator.ScreenshotOptions setQuality(int quality)
png
images.public Locator.ScreenshotOptions setScale(ScreenshotScale scale)
"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 screenhots of
high-dpi devices will be twice as large or even larger. Defaults to "device"
.public Locator.ScreenshotOptions setTimeout(double timeout)
0
to disable timeout. The default value can be changed by
using the BrowserContext.setDefaultTimeout()
or Page.setDefaultTimeout()
methods.public Locator.ScreenshotOptions setType(ScreenshotType type)
png
.Copyright © 2022. All rights reserved.