You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,6 +220,68 @@ public class Example {
220
220
- `bottom` (int): Bottom coordinate of the consider region.
221
221
- `left` (int): Left coordinate of the consider region.
222
222
- `right` (int): Right coordinate of the consider region.
223
+
- `regions` parameter that allows users to apply snapshot options to specific areas of the page. This parameter is an array where each object defines a custom region with configurations.
224
+
- Parameters:
225
+
- `elementSelector` (mandatory, only one of the following must be provided)
226
+
- `boundingBox` (object): Defines the coordinates and size of the region.
227
+
- `x` (number): X-coordinate of the region.
228
+
- `y` (number): Y-coordinate of the region.
229
+
- `width` (number): Width of the region.
230
+
- `height` (number): Height of the region.
231
+
- `elementXpath` (string): The XPath selector for the element.
232
+
- `elementCSS` (string): The CSS selector for the element.
233
+
- `padding` (optional)
234
+
- Specifies additional padding around the selected region.
assertEquals("Invalid function call - screenshot(). Please use snapshot() function for taking screenshot. screenshot() should be used only while using Percy with Automate. For more information on usage of snapshot(), refer doc for your language https://www.browserstack.com/docs/percy/integrate/overview", exception.getMessage());
209
210
}
211
+
212
+
@Test
213
+
publicvoidcreateRegionTest() {
214
+
// Setup the parameters for the region
215
+
Map<String, Object> params = newHashMap<>();
216
+
params.put("boundingBox", "100,100,200,200");
217
+
params.put("elementXpath", "//div[@id='test']");
218
+
params.put("elementCSS", ".test-class");
219
+
params.put("padding", 10);
220
+
params.put("algorithm", "standard");
221
+
params.put("diffSensitivity", 0.5);
222
+
params.put("imageIgnoreThreshold", 0.2);
223
+
params.put("carouselsEnabled", true);
224
+
params.put("bannersEnabled", false);
225
+
params.put("adsEnabled", true);
226
+
params.put("diffIgnoreThreshold", 0.1);
227
+
228
+
// Call the method to create the region
229
+
Map<String, Object> region = percy.createRegion(params);
0 commit comments