selenium-webdriver 4.51.0 → 4.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +15 -0
  3. data/Gemfile +14 -0
  4. data/README.md +20 -0
  5. data/bin/linux-arm64/selenium-manager +0 -0
  6. data/bin/linux-x86_64/selenium-manager +0 -0
  7. data/bin/macos/selenium-manager +0 -0
  8. data/bin/selenium-manager-THIRD-PARTY-NOTICES.txt +543 -226
  9. data/bin/selenium-manager.cdx.json +804 -722
  10. data/bin/windows/selenium-manager.exe +0 -0
  11. data/lib/selenium/webdriver/atoms/findElements.js +960 -250
  12. data/lib/selenium/webdriver/atoms/getAttribute.js +153 -127
  13. data/lib/selenium/webdriver/atoms/isDisplayed.js +433 -364
  14. data/lib/selenium/webdriver/atoms.rb +4 -1
  15. data/lib/selenium/webdriver/bidi/protocol/bluetooth.rb +6 -6
  16. data/lib/selenium/webdriver/bidi/protocol/browser.rb +21 -9
  17. data/lib/selenium/webdriver/bidi/protocol/browsing_context.rb +109 -39
  18. data/lib/selenium/webdriver/bidi/protocol/emulation.rb +89 -44
  19. data/lib/selenium/webdriver/bidi/protocol/input.rb +95 -31
  20. data/lib/selenium/webdriver/bidi/protocol/log.rb +4 -4
  21. data/lib/selenium/webdriver/bidi/protocol/moz_debugging.rb +12 -10
  22. data/lib/selenium/webdriver/bidi/protocol/moz_profiler.rb +4 -4
  23. data/lib/selenium/webdriver/bidi/protocol/network.rb +82 -39
  24. data/lib/selenium/webdriver/bidi/protocol/script.rb +38 -24
  25. data/lib/selenium/webdriver/bidi/protocol/session.rb +61 -8
  26. data/lib/selenium/webdriver/bidi/protocol/storage.rb +3 -3
  27. data/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb +3 -3
  28. data/lib/selenium/webdriver/bidi/protocol/web_extension.rb +17 -9
  29. data/lib/selenium/webdriver/bidi/serialization/record.rb +66 -24
  30. data/lib/selenium/webdriver/bidi/serialization.rb +2 -2
  31. data/lib/selenium/webdriver/bidi/support/bidi_generate.rb +228 -150
  32. data/lib/selenium/webdriver/common/client_config.rb +4 -1
  33. data/lib/selenium/webdriver/common/driver_finder.rb +5 -2
  34. data/lib/selenium/webdriver/common/websocket_connection.rb +51 -13
  35. data/lib/selenium/webdriver/remote/http/default.rb +17 -1
  36. data/lib/selenium/webdriver/version.rb +1 -1
  37. data/selenium-webdriver.gemspec +0 -12
  38. metadata +6 -163
@@ -1,388 +1,457 @@
1
1
  (function () {
2
- function isShownElement(elem, optIgnoreOpacity) {
3
- var tagNameDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'tagName');
4
- var computedStyleCache = new Map();
5
- var clientRectCache = new Map();
6
- var displayedCache = new Map();
7
- function toUpperCaseTag(tagName) {
8
- return tagName ? tagName.toUpperCase() : undefined;
2
+ var __seleniumAtom = (() => {
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
16
  }
10
- function isElement(node, tagName) {
11
- if (!node || node.nodeType !== 1) {
12
- return false;
13
- }
14
- var asElement = node;
15
- var rawTagName = tagNameDescriptor && typeof tagNameDescriptor.get === 'function'
16
- ? tagNameDescriptor.get.call(asElement)
17
- : asElement.tagName;
18
- var upperTagName = typeof rawTagName === 'string' ? rawTagName.toUpperCase() : '';
19
- var normalizedTagName = toUpperCaseTag(tagName);
20
- if (upperTagName === 'FORM') {
21
- return !normalizedTagName || normalizedTagName === 'FORM';
22
- }
23
- return !!upperTagName && (!normalizedTagName || upperTagName === normalizedTagName);
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // javascript/atoms/typescript/is-displayed.ts
22
+ var is_displayed_exports = {};
23
+ __export(is_displayed_exports, {
24
+ default: () => shown_default
25
+ });
26
+
27
+ // javascript/atoms/typescript/core/attribute.ts
28
+ var SPLIT_STYLE_ATTRIBUTE_ON_SEMICOLONS = new RegExp(
29
+ `[;]+(?=(?:(?:[^"]*"){2})*[^"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\\([^()]*\\))*[^()]*$)`
30
+ );
31
+
32
+ // javascript/atoms/typescript/core/element.ts
33
+ var tagNameDescriptor = null;
34
+ function getTagNameDescriptor() {
35
+ if (tagNameDescriptor === null) {
36
+ tagNameDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, "tagName");
24
37
  }
25
- function getParentElement(node) {
26
- var current = node.parentNode;
27
- while (current &&
28
- current.nodeType !== Node.ELEMENT_NODE &&
29
- current.nodeType !== Node.DOCUMENT_NODE &&
30
- current.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
31
- current = current.parentNode;
32
- }
33
- return current && current.nodeType === 1 ? current : null;
38
+ return tagNameDescriptor;
39
+ }
40
+ function toUpperCaseTag(tagName) {
41
+ return tagName ? tagName.toUpperCase() : void 0;
42
+ }
43
+ function isElement(node, tagName) {
44
+ if (!node || node.nodeType !== 1) {
45
+ return false;
34
46
  }
35
- function getEffectiveStyle(elem, propertyName) {
36
- var computed = computedStyleCache.get(elem);
37
- if (computed === undefined) {
38
- var win = elem.ownerDocument.defaultView;
39
- computed = win ? (win.getComputedStyle(elem) || null) : null;
40
- computedStyleCache.set(elem, computed);
41
- }
42
- if (!computed) {
43
- return null;
44
- }
45
- var value = computed.getPropertyValue(propertyName);
46
- return value || null;
47
+ var asElement = node;
48
+ var descriptor = getTagNameDescriptor();
49
+ var rawTagName = descriptor && typeof descriptor.get === "function" ? descriptor.get.call(asElement) : asElement.tagName;
50
+ var upperTagName = typeof rawTagName === "string" ? rawTagName.toUpperCase() : "";
51
+ var normalizedTagName = toUpperCaseTag(tagName);
52
+ if (upperTagName === "FORM") {
53
+ return !normalizedTagName || normalizedTagName === "FORM";
47
54
  }
48
- function getOpacity(elem) {
49
- var opacityStyle = getEffectiveStyle(elem, 'opacity');
50
- var opacity = opacityStyle ? Number(opacityStyle) : 1;
51
- var parent = getParentElement(elem);
52
- return parent ? opacity * getOpacity(parent) : opacity;
55
+ return !!upperTagName && (!normalizedTagName || upperTagName === normalizedTagName);
56
+ }
57
+ function getParentElement(node) {
58
+ var current = node.parentNode;
59
+ while (current && current.nodeType !== Node.ELEMENT_NODE && current.nodeType !== Node.DOCUMENT_NODE && current.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
60
+ current = current.parentNode;
53
61
  }
54
- function getParentNodeInComposedDom(node) {
55
- var parent = node.parentNode;
56
- var slottable = node;
57
- var parentWithShadow = parent;
58
- if (parentWithShadow && parentWithShadow.shadowRoot && slottable.assignedSlot !== undefined) {
59
- return slottable.assignedSlot ? slottable.assignedSlot.parentNode : null;
60
- }
61
- return parent;
62
+ return current && current.nodeType === 1 ? current : null;
63
+ }
64
+ function getParentNodeInComposedDom(node) {
65
+ var parent = node.parentNode;
66
+ var slottable = node;
67
+ var parentWithShadow = parent;
68
+ if (parentWithShadow && parentWithShadow.shadowRoot && slottable.assignedSlot !== void 0) {
69
+ return slottable.assignedSlot ? slottable.assignedSlot.parentNode : null;
70
+ }
71
+ return parent;
72
+ }
73
+
74
+ // javascript/atoms/typescript/core/geometry.ts
75
+ function createRect(left, top, width, height) {
76
+ return {
77
+ left,
78
+ top,
79
+ right: left + width,
80
+ bottom: top + height,
81
+ width,
82
+ height
83
+ };
84
+ }
85
+ function clamp(value, min, max) {
86
+ return Math.min(Math.max(value, min), max);
87
+ }
88
+ function getAreaRelativeRect(area) {
89
+ var shape = area.shape.toLowerCase();
90
+ var coords = area.coords.split(",").map(function(value) {
91
+ return Number(value.trim());
92
+ });
93
+ if (shape === "rect" && coords.length === 4) {
94
+ return createRect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]);
95
+ }
96
+ if (shape === "circle" && coords.length === 3) {
97
+ return createRect(coords[0] - coords[2], coords[1] - coords[2], coords[2] * 2, coords[2] * 2);
98
+ }
99
+ if (shape === "poly" && coords.length > 2) {
100
+ var minX = coords[0];
101
+ var minY = coords[1];
102
+ var maxX = minX;
103
+ var maxY = minY;
104
+ for (var index = 2; index + 1 < coords.length; index += 2) {
105
+ minX = Math.min(minX, coords[index]);
106
+ maxX = Math.max(maxX, coords[index]);
107
+ minY = Math.min(minY, coords[index + 1]);
108
+ maxY = Math.max(maxY, coords[index + 1]);
109
+ }
110
+ return createRect(minX, minY, maxX - minX, maxY - minY);
111
+ }
112
+ return createRect(0, 0, 0, 0);
113
+ }
114
+ function findImageUsingMap(mapName, doc) {
115
+ return doc.querySelector('[usemap="#' + mapName.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"]');
116
+ }
117
+ function maybeFindImageMap(elem, getRect = getClientRect) {
118
+ var isMap = isElement(elem, "MAP");
119
+ if (!isMap && !isElement(elem, "AREA")) {
120
+ return null;
121
+ }
122
+ var map = isMap ? elem : isElement(elem.parentNode, "MAP") ? elem.parentNode : null;
123
+ var image = null;
124
+ var rect = createRect(0, 0, 0, 0);
125
+ if (isElement(map, "MAP") && map.name) {
126
+ image = findImageUsingMap(map.name, map.ownerDocument);
127
+ if (image) {
128
+ rect = getRect(image);
129
+ if (!isMap && isElement(elem, "AREA") && elem.shape.toLowerCase() !== "default") {
130
+ var relativeRect = getAreaRelativeRect(elem);
131
+ var relativeX = Math.min(Math.max(relativeRect.left, 0), rect.width);
132
+ var relativeY = Math.min(Math.max(relativeRect.top, 0), rect.height);
133
+ var width = Math.min(relativeRect.width, rect.width - relativeX);
134
+ var height = Math.min(relativeRect.height, rect.height - relativeY);
135
+ rect = createRect(relativeX + rect.left, relativeY + rect.top, width, height);
136
+ }
137
+ }
62
138
  }
63
- function createRect(left, top, width, height) {
139
+ return { image, rect };
140
+ }
141
+ function getClientRect(elem, getRect) {
142
+ var imageMap = maybeFindImageMap(elem, getRect || getClientRect);
143
+ if (imageMap) {
144
+ return imageMap.rect;
145
+ }
146
+ var elemTagName = typeof elem.tagName === "string" ? elem.tagName : "";
147
+ if (elemTagName.toUpperCase() === "HTML") {
148
+ var doc = elem.ownerDocument;
149
+ var sizeElem = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body || doc.documentElement;
150
+ return createRect(0, 0, sizeElem.clientWidth, sizeElem.clientHeight);
151
+ }
152
+ try {
153
+ var nativeRect = elem.getBoundingClientRect();
154
+ return {
155
+ left: nativeRect.left,
156
+ top: nativeRect.top,
157
+ right: nativeRect.right,
158
+ bottom: nativeRect.bottom,
159
+ width: nativeRect.right - nativeRect.left,
160
+ height: nativeRect.bottom - nativeRect.top
161
+ };
162
+ } catch (_error) {
163
+ return createRect(0, 0, 0, 0);
164
+ }
165
+ }
166
+ function getClientRegion(elem, optRegion, getRect = getClientRect) {
167
+ var rect = getRect(elem);
168
+ if (!optRegion) {
169
+ return rect;
170
+ }
171
+ var region = "left" in optRegion ? optRegion : { left: optRegion.x, top: optRegion.y, width: 1, height: 1 };
172
+ var left = clamp(rect.left + region.left, rect.left, rect.right);
173
+ var top = clamp(rect.top + region.top, rect.top, rect.bottom);
174
+ var right = clamp(left + region.width, left, rect.right);
175
+ var bottom = clamp(top + region.height, top, rect.bottom);
176
+ return createRect(left, top, right - left, bottom - top);
177
+ }
178
+
179
+ // javascript/atoms/typescript/core/style.ts
180
+ function getEffectiveStyle(elem, propertyName) {
181
+ const win = elem.ownerDocument.defaultView;
182
+ const computed = win ? win.getComputedStyle(elem) : null;
183
+ if (!computed) {
184
+ return null;
185
+ }
186
+ return computed.getPropertyValue(propertyName) || null;
187
+ }
188
+
189
+ // javascript/atoms/typescript/core/overflow.ts
190
+ function getOverflowState(elem, optRegion, getStyle = getEffectiveStyle, getRect = getClientRect) {
191
+ var region = getClientRegion(elem, optRegion, getRect);
192
+ var ownerDoc = elem.ownerDocument;
193
+ var htmlElem = ownerDoc.documentElement;
194
+ var bodyElem = ownerDoc.body;
195
+ var htmlOverflowStyle = getStyle(htmlElem, "overflow") || "visible";
196
+ var treatAsFixedPosition = false;
197
+ function canBeOverflowed(container2, position) {
198
+ if (container2 === htmlElem) {
199
+ return true;
200
+ }
201
+ var display = getStyle(container2, "display") || "";
202
+ if (display.indexOf("inline") === 0 || display === "contents") {
203
+ return false;
204
+ }
205
+ if (position === "absolute" && getStyle(container2, "position") === "static") {
206
+ return false;
207
+ }
208
+ return true;
209
+ }
210
+ function getOverflowParent(current) {
211
+ var position = getStyle(current, "position");
212
+ if (position === "fixed") {
213
+ treatAsFixedPosition = true;
214
+ return current === htmlElem ? null : htmlElem;
215
+ }
216
+ var parent = getParentElement(current);
217
+ while (parent && !canBeOverflowed(parent, position)) {
218
+ parent = getParentElement(parent);
219
+ }
220
+ return parent;
221
+ }
222
+ function getOverflowStyles(current) {
223
+ var overflowElem = current;
224
+ if (htmlOverflowStyle === "visible") {
225
+ if (current === htmlElem && bodyElem) {
226
+ overflowElem = bodyElem;
227
+ } else if (current === bodyElem) {
228
+ return { x: "visible", y: "visible" };
229
+ }
230
+ }
231
+ var overflow = {
232
+ x: getStyle(overflowElem, "overflow-x") || "visible",
233
+ y: getStyle(overflowElem, "overflow-y") || "visible"
234
+ };
235
+ if (current === htmlElem) {
236
+ overflow.x = overflow.x === "visible" ? "auto" : overflow.x;
237
+ overflow.y = overflow.y === "visible" ? "auto" : overflow.y;
238
+ }
239
+ return overflow;
240
+ }
241
+ function getScroll(current) {
242
+ if (current === htmlElem) {
64
243
  return {
65
- left: left,
66
- top: top,
67
- right: left + width,
68
- bottom: top + height,
69
- width: width,
70
- height: height,
244
+ x: ownerDoc.defaultView ? ownerDoc.defaultView.pageXOffset : 0,
245
+ y: ownerDoc.defaultView ? ownerDoc.defaultView.pageYOffset : 0
71
246
  };
247
+ }
248
+ return { x: current.scrollLeft, y: current.scrollTop };
72
249
  }
73
- function getClientRect(elem) {
74
- var cachedRect = clientRectCache.get(elem);
75
- if (cachedRect) {
76
- return cachedRect;
77
- }
78
- var rect;
79
- var imageMap = maybeFindImageMap(elem);
80
- if (imageMap) {
81
- rect = imageMap.rect;
82
- }
83
- else {
84
- var elemTagName = typeof elem.tagName === 'string' ? elem.tagName : '';
85
- if (elemTagName.toUpperCase() === 'HTML') {
86
- var doc = elem.ownerDocument;
87
- var sizeElem = doc.compatMode === 'CSS1Compat' ? doc.documentElement : (doc.body || doc.documentElement);
88
- rect = createRect(0, 0, sizeElem.clientWidth, sizeElem.clientHeight);
89
- }
90
- else {
91
- try {
92
- var nativeRect = elem.getBoundingClientRect();
93
- rect = {
94
- left: nativeRect.left,
95
- top: nativeRect.top,
96
- right: nativeRect.right,
97
- bottom: nativeRect.bottom,
98
- width: nativeRect.right - nativeRect.left,
99
- height: nativeRect.bottom - nativeRect.top,
100
- };
101
- }
102
- catch (_error) {
103
- rect = createRect(0, 0, 0, 0);
104
- }
105
- }
106
- }
107
- clientRectCache.set(elem, rect);
108
- return rect;
250
+ function overflowStateOf(container2) {
251
+ return getOverflowState(container2, void 0, getStyle, getRect);
109
252
  }
110
- function getAreaRelativeRect(area) {
111
- var shape = area.shape.toLowerCase();
112
- var coords = area.coords.split(',').map(function (value) {
113
- return Number(value.trim());
114
- });
115
- if (shape === 'rect' && coords.length === 4) {
116
- return createRect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]);
117
- }
118
- if (shape === 'circle' && coords.length === 3) {
119
- return createRect(coords[0] - coords[2], coords[1] - coords[2], coords[2] * 2, coords[2] * 2);
120
- }
121
- if (shape === 'poly' && coords.length > 2) {
122
- var minX = coords[0];
123
- var minY = coords[1];
124
- var maxX = minX;
125
- var maxY = minY;
126
- for (var index = 2; index + 1 < coords.length; index += 2) {
127
- minX = Math.min(minX, coords[index]);
128
- maxX = Math.max(maxX, coords[index]);
129
- minY = Math.min(minY, coords[index + 1]);
130
- maxY = Math.max(maxY, coords[index + 1]);
131
- }
132
- return createRect(minX, minY, maxX - minX, maxY - minY);
133
- }
134
- return createRect(0, 0, 0, 0);
253
+ for (var container = getOverflowParent(elem); container; container = getOverflowParent(container)) {
254
+ var containerOverflow = getOverflowStyles(container);
255
+ if (containerOverflow.x === "visible" && containerOverflow.y === "visible") {
256
+ continue;
257
+ }
258
+ var containerRect = getRect(container);
259
+ if (containerRect.width === 0 || containerRect.height === 0) {
260
+ return "hidden";
261
+ }
262
+ var underflowsX = region.right < containerRect.left;
263
+ var underflowsY = region.bottom < containerRect.top;
264
+ if (underflowsX && containerOverflow.x === "hidden" || underflowsY && containerOverflow.y === "hidden") {
265
+ return "hidden";
266
+ }
267
+ if (underflowsX && containerOverflow.x !== "visible" || underflowsY && containerOverflow.y !== "visible") {
268
+ var containerScroll = getScroll(container);
269
+ var unscrollableX = region.right < containerRect.left - containerScroll.x;
270
+ var unscrollableY = region.bottom < containerRect.top - containerScroll.y;
271
+ if (unscrollableX && containerOverflow.x !== "visible" || unscrollableY && containerOverflow.y !== "visible") {
272
+ return "hidden";
273
+ }
274
+ return overflowStateOf(container) === "hidden" ? "hidden" : "scroll";
275
+ }
276
+ var overflowsX = region.left >= containerRect.left + containerRect.width;
277
+ var overflowsY = region.top >= containerRect.top + containerRect.height;
278
+ if (overflowsX && containerOverflow.x === "hidden" || overflowsY && containerOverflow.y === "hidden") {
279
+ return "hidden";
280
+ }
281
+ if (overflowsX && containerOverflow.x !== "visible" || overflowsY && containerOverflow.y !== "visible") {
282
+ if (treatAsFixedPosition) {
283
+ var docScroll = getScroll(container);
284
+ if (region.left >= htmlElem.scrollWidth - docScroll.x || region.right >= htmlElem.scrollHeight - docScroll.y) {
285
+ return "hidden";
286
+ }
287
+ }
288
+ return overflowStateOf(container) === "hidden" ? "hidden" : "scroll";
289
+ }
135
290
  }
136
- function findImageUsingMap(mapName, doc) {
137
- return doc.querySelector('[usemap="#' + mapName.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"]');
291
+ return "none";
292
+ }
293
+
294
+ // javascript/atoms/typescript/core/shown.ts
295
+ function isShownElement(elem, optIgnoreOpacity) {
296
+ var computedStyleCache = /* @__PURE__ */ new Map();
297
+ var clientRectCache = /* @__PURE__ */ new Map();
298
+ var displayedCache = /* @__PURE__ */ new Map();
299
+ function getEffectiveStyle2(elem2, propertyName) {
300
+ var computed = computedStyleCache.get(elem2);
301
+ if (computed === void 0) {
302
+ var win = elem2.ownerDocument.defaultView;
303
+ computed = win ? win.getComputedStyle(elem2) || null : null;
304
+ computedStyleCache.set(elem2, computed);
305
+ }
306
+ if (!computed) {
307
+ return null;
308
+ }
309
+ var value = computed.getPropertyValue(propertyName);
310
+ return value || null;
138
311
  }
139
- function maybeFindImageMap(elem) {
140
- var isMap = isElement(elem, 'MAP');
141
- if (!isMap && !isElement(elem, 'AREA')) {
142
- return null;
143
- }
144
- var map = isMap ? elem : isElement(elem.parentNode, 'MAP') ? elem.parentNode : null;
145
- var image = null;
146
- var rect = createRect(0, 0, 0, 0);
147
- if (isElement(map, 'MAP') && map.name) {
148
- image = findImageUsingMap(map.name, map.ownerDocument);
149
- if (image) {
150
- rect = getClientRect(image);
151
- if (!isMap && isElement(elem, 'AREA') && elem.shape.toLowerCase() !== 'default') {
152
- var relativeRect = getAreaRelativeRect(elem);
153
- var relativeX = Math.min(Math.max(relativeRect.left, 0), rect.width);
154
- var relativeY = Math.min(Math.max(relativeRect.top, 0), rect.height);
155
- var width = Math.min(relativeRect.width, rect.width - relativeX);
156
- var height = Math.min(relativeRect.height, rect.height - relativeY);
157
- rect = createRect(relativeX + rect.left, relativeY + rect.top, width, height);
158
- }
159
- }
160
- }
161
- return { image: image, rect: rect };
312
+ function getOpacity(elem2) {
313
+ var opacityStyle = getEffectiveStyle2(elem2, "opacity");
314
+ var opacity = opacityStyle ? Number(opacityStyle) : 1;
315
+ var parent = getParentElement(elem2);
316
+ return parent ? opacity * getOpacity(parent) : opacity;
162
317
  }
163
- function getClientRegion(elem) {
164
- return getClientRect(elem);
318
+ function getClientRect2(elem2) {
319
+ var cachedRect = clientRectCache.get(elem2);
320
+ if (cachedRect) {
321
+ return cachedRect;
322
+ }
323
+ var rect = getClientRect(elem2, getClientRect2);
324
+ clientRectCache.set(elem2, rect);
325
+ return rect;
165
326
  }
166
- function getOverflowState(elem) {
167
- var region = getClientRegion(elem);
168
- var ownerDoc = elem.ownerDocument;
169
- var htmlElem = ownerDoc.documentElement;
170
- var bodyElem = ownerDoc.body;
171
- var htmlOverflowStyle = getEffectiveStyle(htmlElem, 'overflow') || 'visible';
172
- var treatAsFixedPosition = false;
173
- function canBeOverflowed(container, position) {
174
- if (container === htmlElem) {
175
- return true;
176
- }
177
- var display = getEffectiveStyle(container, 'display') || '';
178
- if (display.indexOf('inline') === 0 || display === 'contents') {
179
- return false;
180
- }
181
- if (position === 'absolute' && getEffectiveStyle(container, 'position') === 'static') {
182
- return false;
327
+ function maybeFindImageMap2(elem2) {
328
+ return maybeFindImageMap(elem2, getClientRect2);
329
+ }
330
+ function getClientRegion2(elem2) {
331
+ return getClientRegion(elem2, void 0, getClientRect2);
332
+ }
333
+ function getOverflowState2(elem2) {
334
+ return getOverflowState(elem2, void 0, getEffectiveStyle2, getClientRect2);
335
+ }
336
+ function isShownInternal(elem2, ignoreOpacity, displayedFn) {
337
+ if (!isElement(elem2)) {
338
+ throw new Error("Argument to isShown must be of type Element");
339
+ }
340
+ if (isElement(elem2, "BODY")) {
341
+ return true;
342
+ }
343
+ if (isElement(elem2, "OPTION") || isElement(elem2, "OPTGROUP")) {
344
+ var select = elem2.closest("select");
345
+ return !!select && isShownInternal(select, true, displayedFn);
346
+ }
347
+ var imageMap = maybeFindImageMap2(elem2);
348
+ if (imageMap) {
349
+ return !!imageMap.image && imageMap.rect.width > 0 && imageMap.rect.height > 0 && isShownInternal(imageMap.image, ignoreOpacity, displayedFn);
350
+ }
351
+ if (isElement(elem2, "INPUT") && elem2.type.toLowerCase() === "hidden") {
352
+ return false;
353
+ }
354
+ if (isElement(elem2, "NOSCRIPT")) {
355
+ return false;
356
+ }
357
+ var visibility = getEffectiveStyle2(elem2, "visibility");
358
+ if (visibility === "collapse" || visibility === "hidden") {
359
+ return false;
360
+ }
361
+ if (!displayedFn(elem2)) {
362
+ return false;
363
+ }
364
+ if (!ignoreOpacity && getOpacity(elem2) === 0) {
365
+ return false;
366
+ }
367
+ function positiveSize(element) {
368
+ var rect = getClientRect2(element);
369
+ if (rect.height > 0 && rect.width > 0) {
370
+ return true;
371
+ }
372
+ if (isElement(element, "PATH") && (rect.height > 0 || rect.width > 0)) {
373
+ var strokeWidth = getEffectiveStyle2(element, "stroke-width");
374
+ return !!strokeWidth && parseInt(strokeWidth, 10) > 0;
375
+ }
376
+ var elementVisibility = getEffectiveStyle2(element, "visibility");
377
+ if (elementVisibility === "collapse" || elementVisibility === "hidden") {
378
+ return false;
379
+ }
380
+ if (!displayedFn(element)) {
381
+ return false;
382
+ }
383
+ if (getEffectiveStyle2(element, "overflow") === "hidden") {
384
+ return false;
385
+ }
386
+ for (var index = 0; index < element.childNodes.length; index += 1) {
387
+ var child = element.childNodes[index];
388
+ if (child.nodeType === Node.TEXT_NODE) {
389
+ var text = child.nodeValue || "";
390
+ if (/^[\s]*$/.test(text) && /[\n\r\t]/.test(text)) {
391
+ continue;
183
392
  }
184
393
  return true;
185
- }
186
- function getOverflowParent(current) {
187
- var position = getEffectiveStyle(current, 'position');
188
- if (position === 'fixed') {
189
- treatAsFixedPosition = true;
190
- return current === htmlElem ? null : htmlElem;
191
- }
192
- var parent = getParentElement(current);
193
- while (parent && !canBeOverflowed(parent, position)) {
194
- parent = getParentElement(parent);
195
- }
196
- return parent;
197
- }
198
- function getOverflowStyles(current) {
199
- var overflowElem = current;
200
- if (htmlOverflowStyle === 'visible') {
201
- if (current === htmlElem && bodyElem) {
202
- overflowElem = bodyElem;
203
- }
204
- else if (current === bodyElem) {
205
- return { x: 'visible', y: 'visible' };
206
- }
207
- }
208
- var overflow = {
209
- x: getEffectiveStyle(overflowElem, 'overflow-x') || 'visible',
210
- y: getEffectiveStyle(overflowElem, 'overflow-y') || 'visible',
211
- };
212
- if (current === htmlElem) {
213
- overflow.x = overflow.x === 'visible' ? 'auto' : overflow.x;
214
- overflow.y = overflow.y === 'visible' ? 'auto' : overflow.y;
215
- }
216
- return overflow;
217
- }
218
- function getScroll(current) {
219
- if (current === htmlElem) {
220
- return {
221
- x: ownerDoc.defaultView ? ownerDoc.defaultView.pageXOffset : 0,
222
- y: ownerDoc.defaultView ? ownerDoc.defaultView.pageYOffset : 0,
223
- };
224
- }
225
- return { x: current.scrollLeft, y: current.scrollTop };
226
- }
227
- for (var container = getOverflowParent(elem); container; container = getOverflowParent(container)) {
228
- var containerOverflow = getOverflowStyles(container);
229
- if (containerOverflow.x === 'visible' && containerOverflow.y === 'visible') {
230
- continue;
231
- }
232
- var containerRect = getClientRect(container);
233
- if (containerRect.width === 0 || containerRect.height === 0) {
234
- return 'hidden';
235
- }
236
- var underflowsX = region.right < containerRect.left;
237
- var underflowsY = region.bottom < containerRect.top;
238
- if ((underflowsX && containerOverflow.x === 'hidden') || (underflowsY && containerOverflow.y === 'hidden')) {
239
- return 'hidden';
240
- }
241
- if ((underflowsX && containerOverflow.x !== 'visible') || (underflowsY && containerOverflow.y !== 'visible')) {
242
- var containerScroll = getScroll(container);
243
- var unscrollableX = region.right < containerRect.left - containerScroll.x;
244
- var unscrollableY = region.bottom < containerRect.top - containerScroll.y;
245
- if ((unscrollableX && containerOverflow.x !== 'visible') || (unscrollableY && containerOverflow.y !== 'visible')) {
246
- return 'hidden';
247
- }
248
- var containerUnderflowState = getOverflowState(container);
249
- return containerUnderflowState === 'hidden' ? 'hidden' : 'scroll';
250
- }
251
- var overflowsX = region.left >= containerRect.left + containerRect.width;
252
- var overflowsY = region.top >= containerRect.top + containerRect.height;
253
- if ((overflowsX && containerOverflow.x === 'hidden') || (overflowsY && containerOverflow.y === 'hidden')) {
254
- return 'hidden';
255
- }
256
- if ((overflowsX && containerOverflow.x !== 'visible') || (overflowsY && containerOverflow.y !== 'visible')) {
257
- if (treatAsFixedPosition) {
258
- var docScroll = getScroll(container);
259
- if (region.left >= htmlElem.scrollWidth - docScroll.x || region.right >= htmlElem.scrollHeight - docScroll.y) {
260
- return 'hidden';
261
- }
262
- }
263
- var containerOverflowState = getOverflowState(container);
264
- return containerOverflowState === 'hidden' ? 'hidden' : 'scroll';
265
- }
266
- }
267
- return 'none';
268
- }
269
- function isShownInternal(elem, ignoreOpacity, displayedFn) {
270
- if (!isElement(elem)) {
271
- throw new Error('Argument to isShown must be of type Element');
272
- }
273
- if (isElement(elem, 'BODY')) {
394
+ }
395
+ if (isElement(child) && positiveSize(child)) {
274
396
  return true;
275
- }
276
- if (isElement(elem, 'OPTION') || isElement(elem, 'OPTGROUP')) {
277
- var select = elem.closest('select');
278
- return !!select && isShownInternal(select, true, displayedFn);
279
- }
280
- var imageMap = maybeFindImageMap(elem);
281
- if (imageMap) {
282
- return !!imageMap.image && imageMap.rect.width > 0 && imageMap.rect.height > 0 &&
283
- isShownInternal(imageMap.image, ignoreOpacity, displayedFn);
284
- }
285
- if (isElement(elem, 'INPUT') && elem.type.toLowerCase() === 'hidden') {
286
- return false;
287
- }
288
- if (isElement(elem, 'NOSCRIPT')) {
289
- return false;
290
- }
291
- var visibility = getEffectiveStyle(elem, 'visibility');
292
- if (visibility === 'collapse' || visibility === 'hidden') {
293
- return false;
294
- }
295
- if (!displayedFn(elem)) {
296
- return false;
297
- }
298
- if (!ignoreOpacity && getOpacity(elem) === 0) {
299
- return false;
300
- }
301
- function positiveSize(element) {
302
- var rect = getClientRect(element);
303
- if (rect.height > 0 && rect.width > 0) {
304
- return true;
305
- }
306
- if (isElement(element, 'PATH') && (rect.height > 0 || rect.width > 0)) {
307
- var strokeWidth = getEffectiveStyle(element, 'stroke-width');
308
- return !!strokeWidth && parseInt(strokeWidth, 10) > 0;
309
- }
310
- var elementVisibility = getEffectiveStyle(element, 'visibility');
311
- if (elementVisibility === 'collapse' || elementVisibility === 'hidden') {
312
- return false;
313
- }
314
- if (!displayedFn(element)) {
315
- return false;
316
- }
317
- if (getEffectiveStyle(element, 'overflow') === 'hidden') {
318
- return false;
319
- }
320
- for (var index = 0; index < element.childNodes.length; index += 1) {
321
- var child = element.childNodes[index];
322
- if (child.nodeType === Node.TEXT_NODE) {
323
- var text = child.nodeValue || '';
324
- if (/^[\s]*$/.test(text) && /[\n\r\t]/.test(text)) {
325
- continue;
326
- }
327
- return true;
328
- }
329
- if (isElement(child) && positiveSize(child)) {
330
- return true;
331
- }
332
- }
333
- return false;
334
- }
335
- if (!positiveSize(elem)) {
397
+ }
398
+ }
399
+ return false;
400
+ }
401
+ if (!positiveSize(elem2)) {
402
+ return false;
403
+ }
404
+ function hiddenByOverflow(element) {
405
+ if (getOverflowState2(element) !== "hidden") {
406
+ return false;
407
+ }
408
+ for (var index = 0; index < element.childNodes.length; index += 1) {
409
+ var child = element.childNodes[index];
410
+ if (isElement(child) && !hiddenByOverflow(child) && positiveSize(child)) {
336
411
  return false;
412
+ }
337
413
  }
338
- function hiddenByOverflow(element) {
339
- if (getOverflowState(element) !== 'hidden') {
340
- return false;
341
- }
342
- for (var index = 0; index < element.childNodes.length; index += 1) {
343
- var child = element.childNodes[index];
344
- if (isElement(child) && !hiddenByOverflow(child) && positiveSize(child)) {
345
- return false;
346
- }
347
- }
348
- return true;
349
- }
350
- return !hiddenByOverflow(elem);
414
+ return true;
415
+ }
416
+ return !hiddenByOverflow(elem2);
351
417
  }
352
418
  function displayed(node) {
353
- var cached = displayedCache.get(node);
354
- if (cached !== undefined) {
355
- return cached;
356
- }
357
- if (isElement(node)) {
358
- var display = getEffectiveStyle(node, 'display');
359
- var contentVisibility = getEffectiveStyle(node, 'content-visibility');
360
- if (display === 'none' || contentVisibility === 'hidden') {
361
- displayedCache.set(node, false);
362
- return false;
363
- }
364
- }
365
- var parent = getParentNodeInComposedDom(node);
366
- if (typeof ShadowRoot === 'function' && parent instanceof ShadowRoot) {
367
- if (parent.host.shadowRoot && parent.host.shadowRoot !== parent) {
368
- displayedCache.set(node, false);
369
- return false;
370
- }
371
- parent = parent.host;
372
- }
373
- if (parent && (parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE)) {
374
- displayedCache.set(node, true);
375
- return true;
376
- }
377
- if (isElement(parent, 'DETAILS') && !parent.open && !isElement(node, 'SUMMARY')) {
378
- displayedCache.set(node, false);
379
- return false;
380
- }
381
- var result = !!parent && displayed(parent);
382
- displayedCache.set(node, result);
383
- return result;
419
+ var cached = displayedCache.get(node);
420
+ if (cached !== void 0) {
421
+ return cached;
422
+ }
423
+ if (isElement(node)) {
424
+ var display = getEffectiveStyle2(node, "display");
425
+ var contentVisibility = getEffectiveStyle2(node, "content-visibility");
426
+ if (display === "none" || contentVisibility === "hidden") {
427
+ displayedCache.set(node, false);
428
+ return false;
429
+ }
430
+ }
431
+ var parent = getParentNodeInComposedDom(node);
432
+ if (typeof ShadowRoot === "function" && parent instanceof ShadowRoot) {
433
+ if (parent.host.shadowRoot && parent.host.shadowRoot !== parent) {
434
+ displayedCache.set(node, false);
435
+ return false;
436
+ }
437
+ parent = parent.host;
438
+ }
439
+ if (parent && (parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE)) {
440
+ displayedCache.set(node, true);
441
+ return true;
442
+ }
443
+ if (isElement(parent, "DETAILS") && !parent.open && !isElement(node, "SUMMARY")) {
444
+ displayedCache.set(node, false);
445
+ return false;
446
+ }
447
+ var result = !!parent && displayed(parent);
448
+ displayedCache.set(node, result);
449
+ return result;
384
450
  }
385
451
  return isShownInternal(elem, !!optIgnoreOpacity, displayed);
386
- }
387
- return isShownElement;
388
- })()
452
+ }
453
+ var shown_default = isShownElement;
454
+ return __toCommonJS(is_displayed_exports);
455
+ })();
456
+ return __seleniumAtom.default;
457
+ })()