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
Sauce Visual allows selective diffing that permits to ignore changes from a certain kind (_more information [here](/visual-testing/selective-diffing/)_).
2
2
3
3
:::warning
4
-
Selective diffing is only availble with `Balanced` diffing method **AND** with DOM capture enabled.
4
+
Selective diffing is only available with `Balanced` diffing method **AND** with DOM capture enabled.
Below are the environment variables available in the Sauce Visual Python plugin. Keep in mind that the variables defined in code / configuration have precedence over these.
102
+
### Full Page Screenshots
104
103
105
-
<EnvironmentVariables />
104
+
By default, only the current viewport is capture when taking a screenshot. By passing a `FullPageConfig` instance in the `full_page_config` named param you can enable and customize the behavior for our scroll-and-stitch snapshots. View the `FullPageConfig` class in our [visual SDKs](https://github.com/saucelabs/visual-sdks/blob/main/visual-python/src/saucelabs_visual/typing.py) for up to date inline docs for all properties.
105
+
106
+
<FullPageLimit />
107
+
108
+
```python
109
+
from saucelabs_visual.typing import FullPageConfig
110
+
# ...
111
+
visual_client.create_snapshot_from_webdriver(
112
+
"Inventory Page",
113
+
session_id=session_id,
114
+
full_page_config=FullPageConfig(
115
+
# Can customize full page behavior by customizing values here. Or omit completely to
You can use the `capture_dom` named param with a value of `True` to enable DOM capture during a snapshot.
128
+
129
+
```python
130
+
visual_client.create_snapshot_from_webdriver(
131
+
"Inventory Page",
132
+
session_id=session_id,
133
+
capture_dom=True,
134
+
)
135
+
```
136
+
137
+
### Clip to an Element
138
+
139
+
If you'd like to test a specific component or area of a page you can use the `clip_selector` named param in combination with a CSS selector to clip the screenshot and DOM comparison. When enabled, we'll crop the screenshot to the coordinates of the element and constrain our DOM comparison to that area. We accept any `document.querySelector` compatible string / CSS selector as the value.
140
+
141
+
```python
142
+
visual_client.create_snapshot_from_webdriver(
143
+
"Inventory Page",
144
+
session_id=session_id,
145
+
clip_selector='.my-css-selector',
146
+
)
147
+
```
148
+
149
+
Alternatively, you can also pass an element directly if you've already queried one from selenium using the `clip_element` named param:
You can ignore one or more areas on the page by using the `ignore_regions` named param. Ignore regions accepts an array of full region definitions (width, height, x & y coordinates). We also support passing elements directly using the `ignore_elements` named param to bypass region calculation / creation. See below for examples for both.
163
+
164
+
Regions:
165
+
166
+
```python
167
+
from saucelabs_visual.typing import IgnoreRegion
168
+
# ...
169
+
visual_client.create_snapshot_from_webdriver(
170
+
"Inventory Page",
171
+
session_id=session_id,
172
+
# Use coordinates on a page to create manual regions.
173
+
ignore_regions=[
174
+
IgnoreRegion(x=100, y=100, width=100, height=100)
175
+
],
176
+
)
177
+
```
178
+
179
+
Elements:
180
+
181
+
```python
182
+
from saucelabs_visual.typing import IgnoreElementRegion
# Can also pass an element that has been previously found via the driver
196
+
element=add_to_cart_button,
197
+
),
198
+
],
199
+
)
200
+
```
107
201
108
202
### Selective Diffing
109
203
@@ -135,6 +229,12 @@ Example:
135
229
)
136
230
```
137
231
232
+
## Environment variables
233
+
234
+
Below are the environment variables available in the Sauce Visual Python plugin. Keep in mind that the variables defined in code / configuration have precedence over these.
235
+
236
+
<EnvironmentVariables />
237
+
138
238
## Examples
139
239
140
240
Example projects are available [here](https://github.com/saucelabs/visual-examples/tree/main/python).
0 commit comments