Class ElementHandleScreenshotOptions
- Namespace
- Microsoft.Playwright
- Assembly
- Microsoft.Playwright.dll
public class ElementHandleScreenshotOptions
- Inheritance
-
ElementHandleScreenshotOptions
- Inherited Members
Constructors
ElementHandleScreenshotOptions()
public ElementHandleScreenshotOptions()
ElementHandleScreenshotOptions(ElementHandleScreenshotOptions)
public ElementHandleScreenshotOptions(ElementHandleScreenshotOptions clone)
Parameters
Properties
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
transitionend
event. - infinite animations are canceled to initial state, and then played over after the screenshot.
Defaults to "allow"
that leaves animations untouched.
[JsonPropertyName("animations")]
public ScreenshotAnimations? Animations { get; set; }
Property Value
Caret
When set to "hide"
, screenshot will hide text caret. When set to "initial"
,
text caret behavior will not be changed. Defaults to "hide"
.
[JsonPropertyName("caret")]
public ScreenshotCaret? Caret { get; set; }
Property Value
Mask
Specify locators that should be masked when the screenshot is taken. Masked elements
will be overlaid with a pink box #FF00FF
(customized by maskColor
)
that completely covers its bounding box.
[JsonPropertyName("mask")]
public IEnumerable<ILocator>? Mask { get; set; }
Property Value
MaskColor
Specify the color of the overlay box for masked elements, in CSS
color format. Default color is pink #FF00FF
.
[JsonPropertyName("maskColor")]
public string? MaskColor { get; set; }
Property Value
OmitBackground
Hides default white background and allows capturing screenshots with transparency.
Not applicable to jpeg
images. Defaults to false
.
[JsonPropertyName("omitBackground")]
public bool? OmitBackground { get; set; }
Property Value
- bool?
Path
The file path to save the image to. The screenshot type will be inferred from file
extension. If 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.
[JsonPropertyName("path")]
public string? Path { get; set; }
Property Value
Quality
The quality of the image, between 0-100. Not applicable to png
images.
[JsonPropertyName("quality")]
public int? Quality { get; set; }
Property Value
- int?
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"
.
[JsonPropertyName("scale")]
public ScreenshotScale? Scale { get; set; }
Property Value
Style
Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM and applies to the inner frames.
[JsonPropertyName("style")]
public string? Style { get; set; }
Property Value
Timeout
Maximum time in milliseconds. Defaults to 30000
(30 seconds). Pass 0
to disable timeout. The default value can be changed by using the SetDefaultTimeout(float)
or SetDefaultTimeout(float) methods.
[JsonPropertyName("timeout")]
public float? Timeout { get; set; }
Property Value
Type
Specify screenshot type, defaults to png
.
[JsonPropertyName("type")]
public ScreenshotType? Type { get; set; }