Define Regions via code
Examples of using Regions in Percy via code.
You can define regions programmatically in your test scripts to consistently apply them across browsers and devices.
Methods to define Regions:
Key details:
For language-specific examples, see the region examples on how to apply regions via code.
For Percy on Automate projects, pass the regions parameter in the options of the screenshot
command.
Ignore all rule
```javascript
const { percySnapshot } = require("@percy/selenium-webdriver");
const { createRegion } = percySnapshot;
// option - 1
const obj4 = createRegion({
elementXpath: "/html/body/header/h1",
algorithm: 'ignore',
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "ignore"
};
percySnapshot(driver, "Homepage 1", { regions: [obj4] });
percySnapshot(driver, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(driver, "Homepage 3", { regions: [obj4, obj5] });
```
Copy icon
Copy
```java
Map<String, Object> region_ignore4 = new HashMap<>();
region_ignore4.put("elementCSS", ".banner-tagline");
region_ignore4.put("algorithm", "ignore");
regionList.add(percy.createRegion(region_ignore4));
// Ignore region using XPath on header section
Map<String, Object> region_ignore5 = new HashMap<>();
region_ignore5.put("elementXpath", "/html/body/header/section/p");
region_ignore5.put("algorithm", "ignore");
regionList.add(percy.createRegion(region_ignore5));
Map<String, Object> options = new HashMap<>();
options.put("regions", regionList);
// Trigger Percy snapshot with defined regions
percy.snapshot("screenshot_1", options);
```
Copy icon
Copy
```python
# Ignore region using CSS selector
region_ignore4 = create_region(
elementCSS=".banner-tagline",
algorithm="ignore"
)
# Ignore region using XPath selector
region_ignore5 = create_region(
elementXpath="/html/body/header/section/p",
algorithm="ignore"
)
# Ignore region with image threshold and carousels enabled
region_ignore7 = create_region(
elementXpath='//*[@id="testImage"]',
algorithm="ignore",
)
regions_array = [
region_ignore4,
region_ignore5,
region_ignore7
]
percy_snapshot(driver, "screenshot_1", regions=regions_array)
```
Copy icon
Copy
```csharp
// Ignore region using CSS selector
var region_ignore4 = Percy.CreateRegion(
elementCSS: ".banner-tagline",
algorithm: "ignore"
);
// Ignore region using XPath selector
var region_ignore5 = Percy.CreateRegion(
elementXpath: "/html/body/header/section/p",
algorithm: "ignore"
);
var regions_array = new List<Percy.Region>
{
region_ignore4,
region_ignore5
};
Percy.Snapshot(driver, ".NET example", regions: regions_array);
```
Copy icon
Copy
```ruby
# Ignore region on .banner-tagline
region_ignore4 = Percy.create_region({
element_css: ".banner-tagline",
algorithm: 'ignore'
})
# Ignore region using XPath on header section
region_ignore5 = Percy.create_region({
element_xpath: "/html/body/header/section/p",
algorithm: 'ignore'
})
# Capture Percy Snapshot - pass region in array which ever you want
options = {'regions': [region_ignore4, region_ignore5]}
Percy.snapshot(driver, 'screenshot_1', options)
```
Copy icon
Copy
```javascript
// for inbuild fxn
const percySnapshot = require('@percy/playwright');
const { chromium } = require("playwright");
const { createRegion } = percySnapshot;
// option - 1
// Ignore rule
const obj4 = createRegion({
elementXpath: "/html/body/header/h1",
algorithm: 'ignore',
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "ignore"
};
percySnapshot(page, "Homepage 1", { regions: [obj4] });
percySnapshot(page, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(page, "Homepage 3", { regions: [obj4, obj5] });
```
Copy icon
Copy
```java
// for inbuild function
Map<String, Object> params = new HashMap<>();
params.put("elementXpath", "//div[@id='test']");
params.put("algorithm", "ignore");
// Call the method to create the region
Map<String, Object> regions2 = percy.createRegion(params);
// for inbuild function
Map<String, Object> params2 = new HashMap<>();
params2.put("elementXpath", "//div[@id='test']");
params2.put("algorithm", "ignore");
// Call the method to create the region
Map<String, Object> regions3 = percy.createRegion(params2);
List<Map<String, Object>> regions = Collections.singletonList(obj1);
Map<String, Object> options = new HashMap<>();
options.put("regions", regions);
percy.snapshot("Homepage", options);
```
Copy icon
Copy
```python
// for in build fxn
from percy.screenshot import (
create_region
)
// Ignore rule
const obj4 = createRegion(
elementXpath="/html/body/header/h1",
algorithm='ignore',
)
percy_snapshot(page, name="Homepage", regions= [obj4]);
```
Copy icon
Copy
```csharp
// Ignore
var region3 = Percy.CreateRegion(
elementXpath: "/html/body/header/h1",
algorithm: "ignore",
);
var options = new Dictionary<string, object>
{
{"regions", new List<Percy.Region> { region3 }},
};
Percy.Snapshot(page, "snapshot_2", options);
```
Copy icon
Copy
```cypress
const { createRegion } = require("@percy/cypress");
// Ignore
cy.percySnapshot('screenshot_2',
{ regions: [
createRegion({ boundingBox: { x: 0, y: 0, width: 400, height: 100 }, algorithm: 'ignore' })
]
});
cy.percySnapshot('screenshot_2', {regions: [region_1]}
```
Copy icon
Copy
Layout
```javascript
const { percySnapshot } = require("@percy/selenium-webdriver");
const { createRegion } = percySnapshot;
// option - 1
const obj2 = createRegion({
elementCSS: ".cookie-banner",
algorithm: 'layout',
diffIgnoreThreshold: 1
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "layout"
assertion: {
diffIgnoreThreshold: 1,
}
};
percySnapshot(driver, "Homepage 1", { regions: [obj2] });
percySnapshot(driver, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(driver, "Homepage 3", { regions: [obj2, obj5] });
```
Copy icon
Copy
```java
Map<String, Object> region_ignore2 = new HashMap<>();
region_ignore2.put("elementCSS", ".current-time");
region_ignore2.put("algorithm", "layout");
region_ignore2.put("diffIgnoreThreshold", 0.1);
regionList.add(percy.createRegion(region_ignore2));
Map<String, Object> options = new HashMap<>();
options.put("regions", regionList);
// Trigger Percy snapshot with defined regions
percy.snapshot("screenshot_1", options);
```
Copy icon
Copy
```python
# Layout algorithm applied to text element
region_ignore2 = create_region(
elementCSS=".text-element",
algorithm="layout",
diffIgnoreThreshold=0.9
)
regions_array = [
region_ignore2
]
percy_snapshot(driver, "screenshot_1", regions=regions_array)
```
Copy icon
Copy
```csharp
// Layout algorithm applied to a text element
var region_ignore2 = Percy.CreateRegion(
elementCSS: ".text-element",
algorithm: "layout",
diffIgnoreThreshold: 0.9
);
var rules = new List<Percy.Region>
{
region_ignore2
};
Percy.Snapshot(driver, ".NET example", regions: rules);
```
Copy icon
Copy
```Ruby
# Layout algorithm on .text-element
region_ignore2 = Percy.create_region({
element_css: ".text-element",
algorithm: 'layout',
diff_ignore_threshold: 0.9
})
# Capture Percy Snapshot - pass region in array which ever you want
options = {'regions': [region_ignore2]}
Percy.snapshot(driver, 'screenshot_1', options)
```
Copy icon
Copy
```javascript
// for inbuild fxn
const percySnapshot = require('@percy/playwright');
const { chromium } = require("playwright");
const { createRegion } = percySnapshot;
// option - 1
// Layout rule
const obj2 = createRegion({
elementCSS: ".cookie-banner",
algorithm: 'layout',
diffIgnoreThreshold: 1
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "layout"
assertion: {
diffIgnoreThreshold: 0.4,
}
};
percySnapshot(page, "Homepage 1", { regions: [obj2] });
percySnapshot(page, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(page, "Homepage 3", { regions: [obj2, obj5] });
```
Copy icon
Copy
```java
Map<String, Object> params2 = new HashMap<>();
params2.put("elementXpath", "//div[@id='test']");
params2.put("algorithm", "layout");
params2.put("diffIgnoreThreshold", 0.1);
// Call the method to create the region
Map<String, Object> regions = percy.createRegion(params2);
List<Map<String, Object>> regions = Collections.singletonList(obj1);
Map<String, Object> options = new HashMap<>();
options.put("regions", regions);
percy.snapshot("Homepage", options);
```
Copy icon
Copy
```python
// Layout rule
const obj2 = createRegion(
elementCSS=".cookie-banner",
algorithm='layout',
diffIgnoreThreshold=1
}
percy_snapshot(page, name="Homepage", regions= [obj2]);
```
Copy icon
Copy
```csharp
var diffIgnoreThreshold = 0.5;
// Layout
var region2 = Percy.CreateRegion(
algorithm: "layout",
diffIgnoreThreshold: diffIgnoreThreshold
);
var options = new Dictionary<string, object>
{
{"regions", new List<Percy.Region> { region2 }},
};
Percy.Snapshot(page, "snapshot_2", options);
```
Copy icon
Copy
```cypress
const { createRegion } = require("@percy/cypress");
// Layout
cy.percySnapshot('screenshot_2',
{ regions: [
createRegion({ elementCSS: ".cookie-banner", algorithm: 'layout', diffIgnoreThreshold: 0.6 })
]
});
cy.percySnapshot('screenshot_2', {regions: [region_1]}
```
Copy icon
Copy
Intelli Ignore
```javascript
const { percySnapshot } = require("@percy/selenium-webdriver");
const { createRegion } = percySnapshot;
// option - 1
// Intelli ignore rule
const obj1 = createRegion({ algorithm: 'intelliignore', elementCSS: ".ad-banner", diffSensitivity: 4, adsEnabled: true,
diffIgnoreThreshold: 0.4 });
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "intelliignore",
configuration: {
diffSensitivity: 2,
imageIgnoreThreshold: 0.2,
carouselsEnabled: true,
bannersEnabled: true,
adsEnabled: true
},
assertion: {
diffIgnoreThreshold: 0.4,
}
};
percySnapshot(driver, "Homepage 1", { regions: [obj1] });
percySnapshot(driver, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(driver, "Homepage 3", { regions: [obj1, obj5] });
```
Copy icon
Copy
```java
// Intelli ignore region on .header-section
Map<String, Object> region1 = new HashMap<>();
region1.put("elementXpath", ".header-section");
region1.put("algorithm", "intelliignore");
region1.put("diffSensitivity", 2);
region1.put("carouselsEnabled", true);
region1.put("bannersEnabled", true);
region1.put("adsEnabled", true);
region1.put("diffIgnoreThreshold", 0.2);
regionList.add(percy.createRegion(region1));
// Intelli ignore region with image threshold on #carouselImage
Map<String, Object> region_ignore6 = new HashMap<>();
region_ignore6.put("elementXpath", "//*[@id=\"carouselImage\"]");
region_ignore6.put("diffSensitivity", 3);
region_ignore6.put("algorithm", "intelliignore");
region_ignore6.put("imageIgnoreThreshold", 0.8);
region_ignore6.put("carouselsEnabled", true);
region_ignore6.put("diffIgnoreThreshold", 0.2);
regionList.add(percy.createRegion(region_ignore6));
Map<String, Object> options = new HashMap<>();
options.put("regions", regionList);
// Trigger Percy snapshot with defined regions
percy.snapshot("screenshot_1", options);
```
Copy icon
Copy
```python
# Intelli ignore region with diff sensitivity and ads/banners/carousels enabled
region_ignore1 = create_region(
diffSensitivity=3,
algorithm="intelliignore",
carouselsEnabled=True,
bannersEnabled=True,
adsEnabled=True,
diffIgnoreThreshold=0.2
)
# Intelli ignore region with XPath selector and image threshold
region_ignore6 = create_region(
elementXpath='//*[@id="carouselImage"]',
diffSensitivity=3,
algorithm="intelliignore",
imageIgnoreThreshold=0.8,
carouselsEnabled=True,
diffIgnoreThreshold=0.2
)
regions_array = [
region_ignore1,
region_ignore6
]
percy_snapshot(driver, "screenshot_1", regions=regions_array)
```
Copy icon
Copy
```csharp
// Intelli ignore region using CSS selector, with full feature flags and sensitivity
var region_ignore1 = Percy.CreateRegion(
elementCSS: ".header-section",
diffSensitivity: 3,
algorithm: "intelliignore",
carouselsEnabled: true,
bannersEnabled: true,
adsEnabled: true,
diffIgnoreThreshold: 0.2
);
// Intelli ignore region using XPath and image-specific threshold
var region_ignore6 = Percy.CreateRegion(
elementXpath: "//*[@id=\"carouselImage\"]",
diffSensitivity: 3,
algorithm: "intelliignore",
imageIgnoreThreshold: 0.8,
carouselsEnabled: true,
diffIgnoreThreshold: 0.2
);
var regions_array = new List<Percy.Region>
{
region_ignore1,
region_ignore6
};
Percy.Snapshot(driver, ".NET example", regions: regions_array);
```
Copy icon
Copy
```python
# Intelli ignore region with diff sensitivity and ads/banners/carousels enabled
region_ignore1 = create_region(
diffSensitivity=3,
algorithm="intelliignore",
carouselsEnabled=True,
bannersEnabled=True,
adsEnabled=True,
diffIgnoreThreshold=0.2
)
# Intelli ignore region with XPath selector and image threshold
region_ignore6 = create_region(
elementXpath='//*[@id="carouselImage"]',
diffSensitivity=3,
algorithm="intelliignore",
imageIgnoreThreshold=0.8,
carouselsEnabled=True,
diffIgnoreThreshold=0.2
)
regions_array = [
region_ignore1,
region_ignore6
]
percy_snapshot(driver, "screenshot_1", regions=regions_array)
```
Copy icon
Copy
```javascript
// for inbuild fxn
const percySnapshot = require('@percy/playwright');
const { chromium } = require("playwright");
const { createRegion } = percySnapshot;
// option - 1
// Intelli ignore rule
const obj1 = createRegion({ algorithm: 'standard', elementCSS: ".ad-banner", diffSensitivity: 4, adsEnabled: true,
diffIgnoreThreshold: 0.4 });
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "intelliignore",
configuration: {
diffSensitivity: 2,
imageIgnoreThreshold: 0.2,
carouselsEnabled: true,
bannersEnabled: true,
adsEnabled: true
},
assertion: {
diffIgnoreThreshold: 0.4,
}
};
percySnapshot(page, "Homepage 1", { regions: [obj1] });
percySnapshot(page, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(page, "Homepage 3", { regions: [obj1, obj5] });
```
Copy icon
Copy
```java
Map<String, Object> elementSelector = new HashMap<>();
elementSelector.put("elementCSS", ".ad-banner");
Map<String, Object> configuration = new HashMap<>();
configuration.put("diffSensitivity", 2);
configuration.put("imageIgnoreThreshold", 0.2);
configuration.put("carouselsEnabled", true);
configuration.put("bannersEnabled", true);
configuration.put("adsEnabled", true);
Map<String, Object> assertion = new HashMap<>();
assertion.put("diffIgnoreThreshold", 0.4);
Map<String, Object> obj1 = new HashMap<>();
obj1.put("elementSelector", elementSelector);
obj1.put("algorithm", "intelliignore");
obj1.put("configuration", configuration);
obj1.put("assertion", assertion);
List<Map<String, Object>> regions = Collections.singletonList(obj1);
Map<String, Object> options = new HashMap<>();
options.put("regions", regions);
percy.snapshot("Homepage", options);
```
Copy icon
Copy
```python
obj1 = {
"elementSelector": {
"elementCSS": ".ad-banner"
},
"algorithm": "intelliignore",
"configuration": {
"diffSensitivity": 2,
"imageIgnoreThreshold": 0.2,
"carouselsEnabled": true,
"bannersEnabled": true,
"adsEnabled": true
},
"assertion": {
"diffIgnoreThreshold": 0.4,
}
};
// for in build fxn
from percy.screenshot import (
create_region
)
// Intelli ignore rule
obj1 = create_region(
algorithm="intellignore",
diffSensitivity=2,
imageIgnoreThreshold=0.2,
carouselsEnabled=True,
bannersEnabled=True,
adsEnabled=True,
diffIgnoreThreshold=0.4
)
percy_snapshot(page, name="Homepage", regions= [obj1]);
```
Copy icon
Copy
```csharp
var diffSensitivity = 3;
var imageIgnoreThreshold = 0.8;
var carouselsEnabled = true;
var algorithm = "intelliignore";
var diffIgnoreThreshold = 0.5;
// Intelli ignore
var region1 = Percy.CreateRegion(
algorithm: algorithm,
diffSensitivity: diffSensitivity,
imageIgnoreThreshold: imageIgnoreThreshold,
carouselsEnabled: carouselsEnabled,
diffIgnoreThreshold: diffIgnoreThreshold
);
var options = new Dictionary<string, object>
{
{"regions", new List<Percy.Region> { region1 }},
};
Percy.Snapshot(page, "snapshot_2", options);
```
Copy icon
Copy
```cypress
const { createRegion } = require("@percy/cypress");
// Intelli ignore rule
const region_1 = createRegion({
elementXpath: '/html/body/div[3]/img',
diffSensitivity: 3,
algorithm: 'intelliignore',
imageIgnoreThreshold: 0.9,
carouselsEnabled: true,
bannersEnabled: true,
adsEnabled: true,
diffIgnoreThreshold: 0.4
});
cy.percySnapshot('screenshot_2', {regions: [region_1]}
```
Copy icon
Copy
Standard (Pixel-based)
```javascript
const { percySnapshot } = require("@percy/selenium-webdriver");
const { createRegion } = percySnapshot;
// option - 1
const obj3 = createRegion({
elementCSS: ".image-container",
diffSensitivity: 3,
algorithm: 'standard',
diffIgnoreThreshold: 0.6
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "intelliignore",
configuration: {
diffSensitivity: 2,
imageIgnoreThreshold: 0.2,
carouselsEnabled: true,
bannersEnabled: true,
adsEnabled: true
},
assertion: {
diffIgnoreThreshold: 0.4,
}
};
percySnapshot(driver, "Homepage 1", { regions: [obj1] });
percySnapshot(driver, "Homepage 2", { regions: [obj2] });
// To pass multiple rules
percySnapshot(driver, "Homepage 3", { regions: [obj1, obj2] });
```
Copy icon
Copy
```java
Map<String, Object> region_ignore3 = new HashMap<>();
region_ignore3.put("elementCSS", ".color-picker-container");
region_ignore3.put("diffSensitivity", 3);
region_ignore3.put("algorithm", "standard");
regionList.add(percy.createRegion(region_ignore3));
Map<String, Object> options = new HashMap<>();
options.put("regions", regionList);
// Trigger Percy snapshot with defined regions
percy.snapshot("screenshot_1", options);
```
Copy icon
Copy
```python
# Standard algorithm for color picker container
region_ignore3 = create_region(
elementCSS=".color-picker-container",
diffSensitivity=3,
algorithm="standard"
)
regions_array = [
region_ignore3
]
percy_snapshot(driver, "screenshot_1", regions=regions_array)
```
Copy icon
Copy
```csharp
// Standard diff with moderate sensitivity for color picker
var region_ignore3 = Percy.CreateRegion(
elementCSS: ".color-picker-container",
diffSensitivity: 3,
algorithm: "standard"
);
var regions_array = new List<Percy.Region>
{
region_ignore3
};
Percy.Snapshot(driver, ".NET example", regions: regions_array);
```
Copy icon
Copy
```Ruby
# Standard diffing on .color-picker-container
region_ignore3 = Percy.create_region({
element_css: ".color-picker-container",
diff_sensitivity: 3,
algorithm: 'standard',
})
# Capture Percy Snapshot - pass region in array which ever you want
options = {'regions': [region_ignore3]}
Percy.snapshot(driver, 'screenshot_1', options)
```
Copy icon
Copy
```javascript
// for inbuild fxn
const percySnapshot = require('@percy/playwright');
const { chromium } = require("playwright");
const { createRegion } = percySnapshot;
// option - 1
// Standard rule
const obj3 = createRegion({
elementCSS: ".image-container",
diffSensitivity: 3,
algorithm: 'standard',
diffIgnoreThreshold: 0.6
});
// option - 2
const obj5 = {
elementSelector: {
elementCSS: ".ad-banner"
},
algorithm: "standard",
configuration: {
diffSensitivity: 2,
},
assertion: {
diffIgnoreThreshold: 0.6,
}
};
percySnapshot(page, "Homepage 1", { regions: [obj3] });
percySnapshot(page, "Homepage 2", { regions: [obj5] });
// To pass multiple rules
percySnapshot(page, "Homepage 3", { regions: [obj3, obj5] });
```
Copy icon
Copy
```java
// for inbuild function
Map<String, Object> params = new HashMap<>();
params.put("elementXpath", "//div[@id='test']");
params.put("algorithm", "standard");
params.put("diffSensitivity", 3);
params.put("imageIgnoreThreshold", 0.2);
params.put("carouselsEnabled", true);
params.put("bannersEnabled", false);
params.put("adsEnabled", true);
params.put("diffIgnoreThreshold", 0.1);
// Call the method to create the region
Map<String, Object> regions = percy.createRegion(params);
List<Map<String, Object>> regions = Collections.singletonList(obj1);
Map<String, Object> options = new HashMap<>();
options.put("regions", regions);
percy.snapshot("Homepage", options);
```
Copy icon
Copy
```python
// Standard rule
const obj3 = createRegion(
elementCSS=".image-container",
diffSensitivity=3,
algorithm='standard',
diffIgnoreThreshold=0.6
)
percy_snapshot(page, name="Homepage", regions= [obj3]);
```
Copy icon
Copy
```csharp
var diffSensitivity = 3;
var diffIgnoreThreshold = 0.5;
// Standard
var region4 = Percy.CreateRegion(
elementXpath: "/html/body/header/h1",
algorithm: "standard",
diffIgnoreThreshold: diffIgnoreThreshold,
diffSensitivity: diffSensitivity,
);
var options = new Dictionary<string, object>
{
{"regions", new List<Percy.Region> { region4 }},
};
Percy.Snapshot(page, "snapshot_2", options);
```
Copy icon
Copy
```cypress
const { createRegion } = require("@percy/cypress");
// standard
cy.percySnapshot('screenshot_1',
{ regions: [
createRegion({ algorithm: 'standard', diffSensitivity: 4 })
]
});
cy.percySnapshot('screenshot_2', {regions: [region_1]}
```
Copy icon
Copy
Supported parameters
Refer to the table below for details about each parameter and its description:
Parameter
Type
Description
algorithm
(mandatory)
string
Specify the snapshot comparison algorithm. One of the following can be passed: intelliignore ignore layout standard
diffSensitivity
(optional)
integer
Set the sensitivity level for detecting differences. Allowed values: 1 strict, 2 moderately strict, 3 recommended, 4 moderately recommended, 5 relaxed.
imageIgnoreThreshold
(optional)
integer
Set the threshold for ignoring minor image differences. Allowed range: (0, 0.1, 0.15, …,1).
diffIgnoreThreshold
(optional)
integer
Set the threshold for ignoring minor differences. Allowed values: (0,0.1,0.15, …, 1).
elementXpath
(optional)
string
Supported XPath Formats - Only basic XPaths with id is supported. - Full absolute XPaths are supported. - Examples: 1. ‘//[@id=”carouselImage”]’ 2. ‘//[@class=”banner”]’ 3. ‘/html/body/div[1]/header/nav’Not Supported - Double-quoted XPath strings- Examples: 1. /*[@id=’carouselImage’] (inside double quotes)Relative or dynamic XPath patterns 1. //button[text()=”Submit”] 2. //input[@type=”email”] 3. //div[@class=”header”]/h1
elementCSS
(optional)
string
Specify the CSS selector for the element. Currently we only support combination of tag, class, and id. 1. div#id1.class2.class3 2. div.class1.class2 3. .class3 4. #id 5. div, p, section
boundingBox
(optional)
object
Defines the coordinates and size of the region. -x
(Integer): Specify the X-coordinate of the region. -y
(Integer): Specify the Y-coordinate of the region. -width
(Integer): Specify the width of the region. -height
(Integer): Specify the height of the region.
carouselsEnabled
(optional)
boolean
Enable detection of carousels. Any component containing one of the following class names will be ignored: (slide, gallery, carousel, or swiper)
bannersEnabled
(optional)
boolean
Enable banner detection. Any component containing the banner
class name will be ignored.
adsEnabled
(optional)
boolean
Enable ad detection. Any ad component containing one of the following class names will be ignored: (‘google_ad’, ‘adslot’, ‘advertisment’, ‘amazon-adsystem’, ‘taboola’, ‘google-ad’, ‘googlead’)