CheckSettings class
The methods in this class are used as part of the Check Fluent API to configure and execute checkpoints.
To use these methods, first create a target object using a method from the Target class, then call one or more of the methods in this class on the returned object, chaining them one after the other using the '.' operator.
Using statement
using Applitools.Selenium.Fluent;
Accessibility method
Syntax
eyes.Check(Target.Window().Accessibility(regionSelector, regionType))
eyes.Check(Target.Window().Accessibility(element, regionType))
eyes.Check(Target.Window().Accessibility(regionType, elements))
eyes.Check(Target.Window().Accessibility(region))
eyes.Check(Target.Window().Accessibility(region, regionType))
Parameters
region
Type: AccessibilityRegionByRectangle
An object of this class.
region
Type: Rectangle
The position and size of the region.
regionType
Type: AccessibilityRegionType
The accessibility type of the region.
regionSelector
Type: By
A selector that specified one or more elements. The bounding rectangle of each element, defines an accessibility region to be analyzed.
element
Type: IWebElement
An element bounding rectangle that defines an accessibility region to be analyzed.
elements
Type: IWebElement[]
One or more element bounding rectangle that defines an accessibility region to be analyzed.
Return value
Type: CheckSettings
Remarks
For more information about the Contrast advisor feature see Contrast advisor.
BeforeRenderScreenshotHook method
Syntax
eyes.Check(Target.Window().BeforeRenderScreenshotHook(hook))
Parameters
hook
Type: string
A string with legal JavaScript code.
Return value
Type: CheckSettings
Content method
This method has been deprecated and replaced with IgnoreColors
.
Exact method
Syntax
eyes.Check(Target.Window().Exact())
Parameters
This method does not take any parameters.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
This method sets the default match level for this target. This overrides the hard-coded default and the default match level defined by using MatchLevel
.
For a given target you can call only one of the following methods that set a target default match level:
http://localhost:3000/docs/api-ref/sdk-api/selenium/csharp/checksettings#layout-method http://localhost:3000/docs/api-ref/sdk-api/selenium/csharp/checksettings#IgnoreColors-method
To set a match level for a one or more regions within a target use one of the following methods:
CheckSettings.StrictRegions
CheckSettings.IgnoreColorsRegions
CheckSettings.LayoutRegions
For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.
Floating method
Syntax
eyes.Check(Target.Window().Floating(regionSelector, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset))
eyes.Check(Target.Window().Floating(regionSelector, maxOffset))
eyes.Check(Target.Window().Floating(regionSelector))
eyes.Check(Target.Window().Floating(element, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset))
eyes.Check(Target.Window().Floating(element, maxOffset))
eyes.Check(Target.Window().Floating(element))
eyes.Check(Target.Window().Floating(maxOffset, regions))
eyes.Check(Target.Window().Floating(region, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset))
eyes.Check(Target.Window().Floating(region, regionId))
Parameters
maxOffset
Type: int
The maximum amount that the region can shift in any direction and still be considered matching.
region
Type: Rectangle
An object that defines the region.
regionId
Type: String
ID of a coded region. It can be used to identify a region with a dynamic size or position so Eyes can identify the region while comparing it to the baseline. This parameter is only needed if the size or position of the region can change and the SDK cannot automatically accurately define the region.
regions
Type: Rectangle[]
One or more region definitions.
maxUpOffset
Type: int
The maximum amount that the region can shift upwards and still be considered matching.
maxDownOffset
Type: int
The maximum amount that the region can shift downwards and still be considered matching.
maxLeftOffset
Type: int
The maximum amount that the region can shift to the left and still be considered matching.
maxRightOffset
Type: int
The maximum amount that the region can shift to the right and still be considered matching.
regionSelector
Type: By
An object that defines a selector for the region.
element
Type: IWebElement
An element whose position and bounding rectangle defines the region.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can call this method multiple times in a given chain; each call defines a different floating region. Floating regions can not overlap each other or other types of regions, such as ignore or match level regions.
Frame method
Syntax
eyes.Check(Target.frame(by).Frame(by))
eyes.Check(Target.frame(by).Frame(frameNameOrId))
eyes.Check(Target.frame(by).Frame(index))
eyes.Check(Target.frame(by).Frame(frameReference))
Parameters
by
Type: By
Any legal Selenium By request.
frameNameOrId
Type: string
The name or id of the frame element.
index
Type: int
The index of the frame element as defined by Selenium.
frameReference
Type: IWebElement
A Selenium reference to the frame element. This can be anything acceptable to the Selenium switch to frame method.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can only use this method in the chain if the first method in the chain is Frame. You can not call it if the first method in the chain is Window or Region. Call this method multiple times to descend a hierarchy of embedded frames.
Fully method
Syntax
eyes.Check(Target.Window().Fully())
eyes.Check(Target.Window().Fully(fully))
Parameters
fully
Type: bool
If this parameter has a value of true, then Eyes uses scrolling and stitching to capture the entire page. If it's false, then only the viewport will be captured. If the method is called without a parameter, then the default is true.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
This method overrides the global default or the most recent value set by the Eyes.ForceFullPageScreenshot property or Configuration.SetForceFullPageScreenshot method. If stitching is done, then the stitch mode used, StitchModes.CSS or StitchModes.Scroll is determined by the global default or the value set using, Eyes.StitchMode or Configuration.SetStitchMode You can use the CheckSettings.ScrollRootElement method to specify which element should be scrolled to render all of the content of the page. You can only specify one such element per checkpoint. You can only call this method once in a given target.
Ignore method
Syntax
eyes.Check(Target.Window().Ignore(selector, selectors))
eyes.Check(Target.Window().Ignore(selectors))
eyes.Check(Target.Window().Ignore(region, regions))
eyes.Check(Target.Window().Ignore(regions))
eyes.Check(Target.Window().Ignore(region, regionId))
Parameters
region
Type: Rectangle
An object that defines a rectangular area in the window.
regionId
Type: String
ID of a coded region. It can be used to identify a region with a dynamic size or position so Eyes can identify the region while comparing it to the baseline. This parameter is only needed if the size or position of the region may change and the SDK cannot automatically accurately define the region.
regions
Type: Rectangle[]
An array of rectangle objects, each of which defines a region.
regions
Type: IEnumerable
<Rectangle>
An array of rectangle objects, each of which defines a region.
selector
Type: By
An object that defines a selector for the region.
electors
Type: By[]
An array of selector objects that define regions.
selectors
Type: IEnumerable
<By>
A collection of selector objects that define regions.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can call this method multiple times in a given chain.
Ignore regions should not overlap each other or other types of regions such as floating or match level regions.
IgnoreCaret method
Syntax
eyes.Check(Target.Window().IgnoreCaret(ignoreCaret))
eyes.Check(Target.Window().IgnoreCaret())
Parameters
ignoreCaret
Type: bool [Optional : default = true ]
If
true
, Eyes will detect artifacts caused by a blinking cursor and will not report a mismatch for differences caused by these artifacts. Iffalse
, then Eyes will not try to detect artifacts caused by blinking cursors. If no parameter is passed then the default value istrue
and the cursor artifacts will be ignored.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can only call this method once in a given chain. This method overrides the global default setting or the setting chosen explicitly for the current target using the Eyes.setIgnoreCaret
or Configuration.setIgnoreCaret
.
IgnoreColors method
Syntax
eyes.Check(Target.Window().IgnoreColors(selector, selectors))
eyes.Check(Target.Window().IgnoreColors(selectors))
eyes.Check(Target.Window().IgnoreColors(element, elements))
eyes.Check(Target.Window().IgnoreColors(elements))
eyes.Check(Target.Window().IgnoreColors(region, regions))
eyes.Check(Target.Window().IgnoreColors(regions))
eyes.Check(Target.Window().IgnoreColors())
Parameters
region
Type: Rectangle
An object that defines a rectangular area in the window.
regions
Type: Rectangle[]
An array of rectangle objects, each of which defines a region.
regions
Type: IEnumerable
<Rectangle>
An array of rectangle objects, each of which defines a region.
selector
Type: By
An object that defines a selector for the region.
selectors
Type: By[]
An array of selector objects that define regions.
selectors
Type: IEnumerable
<By>
An array of selector objects that define regions.
element
Type: IWebElement
An element whose position and bounding rectangle defines the region.
elements
Type: IWebElement[]
One or more elements, each of whose bounding rectangle defines a region.
elements
Type: IEnumerable
<IWebElement>
One or more elements, each of whose bounding rectangle defines a region.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can call this method in two ways - with parameters and without parameters. The meaning of the method, and the way it can be used is different in each case. When the method is called without parameters it sets the default match level for this target. When called with one or more regions as parameters it defines the match level for that region. The sections below provide some more details regarding how to use this method in each of these modes.
Called without parameters
If this method is called without parameters then it sets the default match level for this target. This overrides the hard-coded default and the default match level defined by using MatchLevel
.
For a given target you can call only one of the following methods (without parameters) that set a target default match level:
Called with parameters
When the method is called with one or more parameters that define one or more regions, then these set the match level for those regions, overiding the defaults set for the target (by calling these methods without a parameter), set by MatchLevel
and the hardcoded default match level.
You can define multiple regions that have an explicit match level by calling this method multiple times in a chain, or by passing the method multiple regions.
The region matchlevel methods Strict(regions)
, Layout(regions)
, IgnoreColors(regions)
, StrictRegions(regions)
, LayoutRegions(regions)
, and ContentRegions(regions)
should not overlap each other or the regions defined using CheckSettings.ignore (regions)
or IgnoreRegions(regions)
. If they overlap with each other, or regions that were defined using the Test Manager, then the results are undefined.
For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.
IgnoreDisplacements method
Syntax
eyes.Check(Target.Window().IgnoreDisplacements(ignoreDisplacements))
eyes.Check(Target.Window().IgnoreDisplacements())
Parameters
ignoreDisplacements
Type: bool [Optional : default = true ]
If
true
, then mismatches due to displaced content will not be displayed in the Test Manager. Otherwise, they will be displayed.
Return value
Type: CheckSettings
Remarks
Ignore displacements is only active when using a Match level of Strict or IgnoreColors
Layout method
Syntax
eyes.Check(Target.Window().Layout(selector, selectors))
eyes.Check(Target.Window().Layout(selectors))
eyes.Check(Target.Window().Layout(element, elements))
eyes.Check(Target.Window().Layout(elements))
eyes.Check(Target.Window().Layout(region, regions))
eyes.Check(Target.Window().Layout(regions))
eyes.Check(Target.Window().Layout())
eyes.Check(Target.Window().Layout(region, regionId))
Parameters
region
Type: Rectangle
An object that defines a rectangular area in the window.
regionId
Type: String
ID of a coded region. It can be used to identify a region with a dynamic size or position so Eyes can identify the region while comparing it to the baseline. This parameter is only needed if the size or position of the region may change and the SDK cannot automatically accurately define the region.
regions
Type: Rectangle[]
An array of rectangle objects, each of which defines a region.
regions
Type: IEnumerable
<Rectangle>
An array of rectangle objects, each of which defines a region.
selector
Type: By
An object that defines a selector for the region.
selectors
Type: By[]
An array of selector objects that define regions.
selectors
Type: IEnumerable
<By>
An array of selector objects that define regions.
element
Type: IWebElement
An element whose position and bounding rectangle defines the region.
elements
Type: IWebElement[]
One or more elements, each of whose bounding rectangle defines a region.
elements
Type: IEnumerable
<IWebElement>
One or more elements, each of whose bounding rectangle defines a region.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can call this method in two ways - with parameters and without parameters. The meaning of the method, and the way it can be used is different in each case. When the method is called without parameters it sets the default match level for this target. When called with one or more regions as parameters it defines the match level for that region. The sections below provide some more details regarding how to use this method in each of these modes.
Called without parameters
If this method is called without parameters then it sets the default match level for this target. This overrides the hard-coded default and the default match level defined by using MatchLevel
.
For a given target you can call only one of the following methods (without parameters) that set a target default match level:
Called with parameters
When the method is called with one or more parameters that define one or more regions, then these set the match level for those regions, overiding the defaults set for the target (by calling these methods without a parameter), set by MatchLevel
and the hardcoded default match level.
You can define multiple regions that have an explicit match level by calling this method multiple times in a chain, or by passing the method multiple regions.
The region matchlevel methods Strict(regions)
, Layout(regions)
, IgnoreColors(regions)
, StrictRegions(regions)
, LayoutRegions(regions)
, and ContentRegions(regions)
should not overlap each other or the regions defined using CheckSettings.ignore (regions)
or IgnoreRegions(regions)
. If they overlap with each other, or regions that were defined using the Test Manager, then the results are undefined.
For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.
LayoutBreakpoints method
Syntax
eyes.Check(Target.Window().LayoutBreakpoints(breakpoints))
Parameters
breakpoints
Type: int[]
Pass one or more viewport widths explicitly, and the JavaScript is executed and the DOM is extracted for each viewport width. For each target, the Ultrafast Grid uses the DOM extracted with the widest viewport that is smaller than the viewport width. For example, if the values 640, 768 and 1024 are passed, then targets with a width between 640 and 767 (inclusive) use the DOM extracted at 640. Similarly, targets between 768 and 1023 use the DOM extracted at 768. Targets that have a width smaller than the smallest defined width use a DOM extracted at one less than the smallest DOM width (639 in this example). Targets that have a width larger than the largest width defined (1024 in this example) use the DOM extracted at the largest width. If no width is specified, then a separate DOM is extracted for each distinct execution environment viewport width.
Return value
Type: CheckSettings
Remarks
This method enables and sets breakpoints for the current checkpoint. It overrides the default values when the test is configured with a previous use of Configuration.LayoutBreakpoints property, Configuration.SetLayoutBreakpoints method or Configuration.LayoutBreakpoints property.
LazyLoad method
Syntax
// lazy loads with sensible defaults
eyes.Check(Target.Window().Fully().LazyLoad());
// lazy loads with options specified
eyes.Check(Target.Window().LazyLoad(new LazyLoadOptions(maxAmountToScroll:1000, scrollLength:250, waitingTime:500));
Scrolls the entire page, or a specific length of the page, to make sure all lazily loaded assets are on the page before performing a check.
Parameters
maxAmountToScroll
Type: int
Total pixels of the page to be scrolled
scrollLength
Type: int
Number of pixels to use for each scroll attempt
waitingTime
Type: int
The wait time between scroll attempts in milliseconds.
Remarks
- If you do not enter an option, the sensible default for that value will be used
- The SDK will repeatedly scroll the page using the
scrollLength
until either the page cannot be scrolled further or themaxAmountToScroll
has been reached (whichever happens first)
MatchLevel method
Syntax
eyes.Check(Target.Window().MatchLevel(matchLevel))
Parameters
matchLevel
Type: MatchLevel
Available match level values are:
- None
- Strict
- Layout
- IgnoreColors
- Exact
For a description of these match levels and the different ways to apply them to tests, checkpoints, and regions, see Eyes match levels.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
The value provided here overrides the default match level, or the global value set for this target using Eyes.MatchLevel or Configuration.SetMatchLevel. You can only call this method once in a given chain. If you call this method, then you can't call the other match level methods.
CheckSettings.Strict
CheckSettings.IgnoreColors
CheckSettings.Layout
CheckSettings.Exact
For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.
Region method
Syntax
eyes.Check(Target.Frame(frameSelector).Region(rect))
eyes.Check(Target.Frame(frameSelector).Region(by))
eyes.Check(Target.Frame(frameSelector).Region(targetElement))
Parameters
rect
Type: Rectangle
An object that defines the rectangular area in the window to be matched.
by
Type: By
Any legal Selenium
By
request.
targetElement
Type: IWebElement
An object which defines a region.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
The parameter to the method specifies the region to be matched. The enclosing frame(s) are selected by the previous calls in the chain to Target.Frame. You can only use this method in the chain if the first method in the chain is Target.Frame. You can not call it if the first method in the chain is Target.Window or Target.Region. To match a region within a window, use the method Target.Region as the first method in the Target chain. You can only call this method once in a given chain.
ScrollRootElement method
Syntax
eyes.Check(Target.Window().ScrollRootElement(selector))
eyes.Check(Target.Window().ScrollRootElement(element))
Parameters
selector
Type: By
A
By
selector to the element that should be scrolled.
element
Type: IWebElement
The element that should be scrolled.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
SendDom method
Syntax
eyes.Check(Target.Window().SendDom(sendDom))
eyes.Check(Target.Window().SendDom())
Parameters
sendDom
Type: bool [Optional : default = true ]
If a value of true is passed then send DOM information for this checkpoint even if sending DOM is disabled globally.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Strict method
Syntax
eyes.Check(Target.Window().Strict(selector, selectors))
eyes.Check(Target.Window().Strict(selectors))
eyes.Check(Target.Window().Strict(element, elements))
eyes.Check(Target.Window().Strict(elements))
eyes.Check(Target.Window().Strict(region, regions))
eyes.Check(Target.Window().Strict(regions))
eyes.Check(Target.Window().Strict())
eyes.Check(Target.Window().Strict(region, regionId))
Parameters
region
Type: Rectangle
An object that defines a rectangular area in the window.
regionId
Type: String
ID of a coded region. It can be used to identify a region with a dynamic size or position so Eyes can identify the region while comparing it to the baseline. This parameter is only needed if the size or position of the region may change and the SDK cannot automatically accurately define the region.
regions
Type: Rectangle[]
An array of rectangle objects, each of which defines a region.
regions
Type: IEnumerable
<Rectangle>
An array of rectangle objects, each of which defines a region.
selector
Type: By
An object that defines a selector for the region.
selectors
Type: By[]
An array of selector objects that define regions.
selectors
Type: IEnumerable
<By>
An array of selector objects that define regions.
element
Type: IWebElement
An element whose position and bounding rectangle defines the region.
elements
Type: IWebElement[]
One or more elements, each of whose bounding rectangle defines a region.
elements
Type: IEnumerable
<IWebElement>
One or more elements, each of whose bounding rectangle defines a region.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can call this method in two ways - with parameters and without parameters. The meaning of the method, and the way it can be used is different in each case. When the method is called without parameters it sets the default match level for this target. When called with one or more regions as parameters it defines the match level for that region. The sections below provide some more details regarding how to use this method in each of these modes.
Called without parameters
If this method is called without parameters then it sets the default match level for this target. This overrides the hard-coded default and the default match level defined by using MatchLevel
.
For a given target you can call only one of the following methods (without parameters) that set a target default match level:
Called with parameters
When the method is called with one or more parameters that define one or more regions, then these set the match level for those regions, overiding the defaults set for the target (by calling these methods without a parameter), set by MatchLevel
and the hardcoded default match level.
You can define multiple regions that have an explicit match level by calling this method multiple times in a chain, or by passing the method multiple regions.
The region matchlevel methods Strict(regions)
, Layout(regions)
, IgnoreColors(regions)
, StrictRegions(regions)
, LayoutRegions(regions)
, and ContentRegions(regions)
should not overlap each other or the regions defined using CheckSettings.ignore (regions)
or IgnoreRegions(regions)
. If they overlap with each other, or regions that were defined using the Test Manager, then the results are undefined.
For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.
Timeout method
Syntax
eyes.Check(Target.Window().Timeout(timeout))
Parameters
timeout
Type: TimeSpan
The timeout to use in TimeSpan units.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can only call this method once in a given chain. The timeout value provided here overrides the default value or the value set by MatchTimeout for the current target. Passing this method a value of zero disables the timeout mechanism.
VariationGroupId method
Syntax
eyes.Check(Target.Window().VariationGroupId(variationGroupId))
Parameters
variationGroupId
Type: string
The value of the variation group ID to be set.
Return value
Type: CheckSettings
VisualGridOptions method
Syntax
eyes.Check(Target.Window().VisualGridOptions(options))
Parameters
options
Type: VisualGridOption[]
One or more options for configuring the Ultrafast Grid.
Return value
Type: CheckSettings
Remarks
The following configuration key/value pairs are currently supported:
chromeHeadless
Normally, the Ultrafast Grid renders its images using Headless Chrome. There are cases where the behavior of Headless Chrome is different from that of regular Chrome browser, and if the baseline was created with a regular Chrome browser, the differences will be found. Set this option to a value of false to instruct the Ultrafast Grid to use a regular Chrome browser instead of the Headless Chrome browser, so as to eliminate differences that arise because of the different types of Chrome browser.
polyfillAdoptedStyleSheets
Adopted Stylesheets are a way to create and distribute reusable styles when using a Shadow DOM. Adopted Stylesheets are not supported by all browsers, so their use may cause mismatches when doing cross-browser validation. By default, when the Ultrafast Grid detects that a page being checked uses Adopted Stylesheets, it will not render that checkpoint, the check will fail, and the test will be aborted. In the Test Manager, the test results for that run will have an Aborted status, and the step that failed will have a Missing status.
To enable rendering of checkpoints that include Adopted Stylesheets, and to ensure that the test can complete successfully, you need to explicitly set the Ultrafast Grid option polyfillAdoptedStyleSheets to a value of true or false:
- Setting a value of true instructs the Ultrafast Grid to polyfill Adopted Stylesheets.
- Setting a value of false instructs the Ultrafast Grid to render the page without polyfilling Adopted Stylesheets.
You can set this option globally using the method Configuration.SetVisualGridOptions
You can override the global value for a given checkpoint using the method CheckSettings.VisualGridOptions.
Example
eyes.Check(
Target.Window()
.VisualGridOptions(new VisualGridOption("polyfillAdoptedStyleSheets", true)));
WithName method
Syntax
eyes.Check(Target.Window().WithName(name))
Parameters
name
Type: string
The name to be given to this check point.
Return value
Type: CheckSettings
The value returned is the object that called the method. You can use it to call other methods supported by the object class.
Remarks
You can only call this method once in a given chain.