selenium-webdriver 4.44.0 → 4.45.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 338c4f4b065ecf290be0ab172218f7acddf22b3cab15e97c00de530b5aa49074
4
- data.tar.gz: bb8c3bb3424d3e82292fabf82f205bf990b86bb0e3a8c0412416ee2070d0bf6a
3
+ metadata.gz: b441a6e8d993250a3931dd136edc5749b16ab9b0b08bdb673d1e8b4f734418f0
4
+ data.tar.gz: 784b3693ca66a564c57d68cab9b132e84c44225fb5615fb6d4587d9abaf2643c
5
5
  SHA512:
6
- metadata.gz: e46ddc09ebbbba3d64acf7e283134e4e4d21ec8452b7cc94b44589a7522802fd9f1b9c25d25b93b9d17274f8d3affcf9381f365a5dc92e90657042a98ed00da2
7
- data.tar.gz: 991177266a82f9486eafde5f04545618b4df1b0ce708904193c80f25859616228c72b28fed13d829a81f641b012172379bd62d35dcbdb38bbcb6adaeda7ff7fd
6
+ metadata.gz: e317799f8e4cae55972263b3c866f08d48cf9029df08e3d1263cebc65da213e5e5758637d38edbf27fd36fe8f7c852b7358022e4ab8b860438fa41d1dbf465a2
7
+ data.tar.gz: 94213e5c29e70daf13fc950994531983e1e453ebe169f8e43888e76dfa5a85ea1ee854653b516456547f467ce3ca7bb1c7e6d5e9a41380e1de55ced708f79c54
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ 4.45.0 (2026-06-15)
2
+ =========================
3
+ * Support CDP versions: v147, v148, v149
4
+ * deprecate curb http client support (#17443)
5
+ * move Ruby bindings to use typescript get attribute atom (#17524)
6
+ * Move atoms to use the typescript versions (#17532)
7
+ * deprecate Chromium Profile classes (#17557)
8
+ * update bazel test tags (#17558)
9
+ * separate concerns between Service, DriverFinder, and Options (#17564)
10
+ * fix using environment variables to set drivers (#17571)
11
+ * create more obvious test guard keywords as aliases (#17636)
12
+
1
13
  4.44.0 (2026-05-12)
2
14
  =========================
3
15
  * Support CDP versions: v146, v147, v148
data/Gemfile CHANGED
@@ -5,8 +5,5 @@ Dir["#{__dir__}/*.gemspec"].each do |spec|
5
5
  gemspec name: File.basename(spec, '.gemspec')
6
6
  end
7
7
 
8
- # ActiveSupport 8.x requires Ruby 3.2+ (dependency of Steep)
9
- gem 'activesupport', '~> 7.0', require: false, platforms: %i[mri mingw x64_mingw]
10
- gem 'curb', '~> 1.0.5', require: false, platforms: %i[mri mingw x64_mingw]
11
8
  gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw]
12
- gem 'steep', '~> 1.10.0', require: false, platforms: %i[mri mingw x64_mingw]
9
+ gem 'steep', '~> 2.0', require: false, platforms: %i[mri mingw x64_mingw]
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Ruby language bindings for [Selenium WebDriver](https://www.selenium.dev).
4
4
  Selenium automates browsers for testing and web-based task automation.
5
5
 
6
- Supports MRI >= 3.2.
6
+ Supports MRI >= 3.3.
7
7
 
8
8
  ## Installation
9
9
 
Binary file
Binary file
Binary file
@@ -1,68 +1,272 @@
1
- function(){return (function(){/*
2
-
3
- Copyright The Closure Library Authors.
4
- Copyright The Closure Compiler Authors.
5
- SPDX-License-Identifier: Apache-2.0
6
- */
7
- var aa=aa||{},h=this||self;try{var ba=window}catch(a){ba=h};/*
8
-
9
- Copyright The Closure Library Authors.
10
- SPDX-License-Identifier: Apache-2.0
11
- */
12
- function k(a){var b=typeof a;return b=="object"&&a!=null||b=="function"}
13
- function ca(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(c=="[object Window]")return"object";if(c=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(c=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
14
- else if(b=="function"&&typeof a.call=="undefined")return"object";return b};function n(a,b){this.code=a;this.g=q[a]||r;this.message=b||"";a=this.g.replace(/((?:^|\s+)[a-z])/g,function(c){return c.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(b<0||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}(function(){function a(){}a.prototype=Error.prototype;n.prototype=new a;n.prototype.constructor=n})();var r="unknown error",q={15:"element not selectable",11:"element not visible"};q[31]=r;q[30]=r;q[24]="invalid cookie domain";
15
- q[29]="invalid element coordinates";q[12]="invalid element state";q[32]="invalid selector";q[51]="invalid selector";q[52]="invalid selector";q[17]="javascript error";q[405]="unsupported operation";q[34]="move target out of bounds";q[27]="no such alert";q[7]="no such element";q[8]="no such frame";q[23]="no such window";q[28]="script timeout";q[33]="session not created";q[10]="stale element reference";q[21]="timeout";q[25]="unable to set cookie";q[26]="unexpected alert open";q[13]=r;q[9]="unknown command";var da;var ea=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(typeof a==="string")return typeof b!=="string"||b.length!=1?-1:a.indexOf(b,0);for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},t=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=typeof a==="string"?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},fa=Array.prototype.filter?function(a,b){return Array.prototype.filter.call(a,
16
- b,void 0)}:function(a,b){for(var c=a.length,d=[],e=0,f=typeof a==="string"?a.split(""):a,g=0;g<c;g++)if(g in f){var m=f[g];b.call(void 0,m,g,a)&&(d[e++]=m)}return d},ha=Array.prototype.map?function(a,b){return Array.prototype.map.call(a,b,void 0)}:function(a,b){for(var c=a.length,d=Array(c),e=typeof a==="string"?a.split(""):a,f=0;f<c;f++)f in e&&(d[f]=b.call(void 0,e[f],f,a));return d},ia=Array.prototype.some?function(a,b){return Array.prototype.some.call(a,b,void 0)}:function(a,b){for(var c=a.length,
17
- d=typeof a==="string"?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a))return!0;return!1},ja=Array.prototype.every?function(a,b,c){return Array.prototype.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=typeof a==="string"?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};
18
- function ka(a,b){a:{for(var c=a.length,d=typeof a==="string"?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return b<0?null:typeof a==="string"?a.charAt(b):a[b]}function la(a,b){a.sort(b||ma)}function ma(a,b){return a>b?1:a<b?-1:0};function na(a){var b=a.length-1;return b>=0&&a.indexOf(" ",b)==b}var y=aa.S&&String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};
19
- function oa(a,b){var c=0;a=y(String(a)).split(".");b=y(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;c==0&&e<d;e++){var f=a[e]||"",g=b[e]||"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(f[0].length==0&&g[0].length==0)break;c=pa(f[1].length==0?0:parseInt(f[1],10),g[1].length==0?0:parseInt(g[1],10))||pa(f[2].length==0,g[2].length==0)||pa(f[2],g[2]);f=f[3];g=g[3]}while(c==0)}return c}function pa(a,b){return a<b?-1:a>b?1:0};function z(){var a=h.navigator;return a&&(a=a.userAgent)?a:""}function A(a){return z().indexOf(a)!=-1};function qa(){return A("Firefox")||A("FxiOS")}function ra(){return(A("Chrome")||A("CriOS"))&&!A("Edge")||A("Silk")};function C(){return A("iPhone")&&!A("iPod")&&!A("iPad")};function sa(a,b){var c=ta;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var ua=A("Opera"),D=A("Trident")||A("MSIE"),va=A("Edge"),wa=A("Gecko")&&!(z().toLowerCase().indexOf("webkit")!=-1&&!A("Edge"))&&!(A("Trident")||A("MSIE"))&&!A("Edge"),ya=z().toLowerCase().indexOf("webkit")!=-1&&!A("Edge");function za(){var a=h.document;return a?a.documentMode:void 0}var E;
20
- a:{var Aa="",Ba=function(){var a=z();if(wa)return/rv:([^\);]+)(\)|;)/.exec(a);if(va)return/Edge\/([\d\.]+)/.exec(a);if(D)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(ya)return/WebKit\/(\S+)/.exec(a);if(ua)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Ba&&(Aa=Ba?Ba[1]:"");if(D){var Ca=za();if(Ca!=null&&Ca>parseFloat(Aa)){E=String(Ca);break a}}E=Aa}var ta={};function Da(a){return sa(a,function(){return oa(E,a)>=0})}var Ea;if(h.document&&D){var Fa=za();Ea=Fa?Fa:parseInt(E,10)||void 0}else Ea=void 0;
21
- var F=Ea;function G(a,b){this.x=a!==void 0?a:0;this.y=b!==void 0?b:0}G.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};G.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};G.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};function H(a,b){this.width=a;this.height=b}H.prototype.aspectRatio=function(){return this.width/this.height};H.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};H.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};H.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};function Ga(a){return String(a).replace(/\-([a-z])/g,function(b,c){return c.toUpperCase()})};function I(a){return a?new Ha(K(a)):da||(da=new Ha)}function Ia(a,b){return typeof b==="string"?a.getElementById(b):b}function Ja(a){for(;a&&a.nodeType!=1;)a=a.previousSibling;return a}function Ka(a,b){if(!a||!b)return!1;if(a.contains&&b.nodeType==1)return a==b||a.contains(b);if(typeof a.compareDocumentPosition!="undefined")return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function K(a){return a.nodeType==9?a:a.ownerDocument||a.document}
22
- function La(a,b){a&&(a=a.parentNode);for(var c=0;a;){if(b(a))return a;a=a.parentNode;c++}return null}function Ha(a){this.g=a||h.document||document}
23
- function L(a,b,c,d){a=a.g;d=d||a;var e=b&&b!="*"?String(b).toUpperCase():"";if(d.querySelectorAll&&d.querySelector&&(e||c))c=d.querySelectorAll(e+(c?"."+c:""));else if(c&&d.getElementsByClassName)if(b=d.getElementsByClassName(c),e){d={};for(var f=a=0,g;g=b[f];f++)e==g.nodeName&&(d[a++]=g);d.length=a;c=d}else c=b;else if(b=d.getElementsByTagName(e||"*"),c){d={};for(f=a=0;g=b[f];f++){e=g.className;var m;if(m=typeof e.split=="function")m=ea(e.split(/\s+/),c)>=0;m&&(d[a++]=g)}d.length=a;c=d}else c=b;
24
- return c};var Ma={o:function(a){return!(!a.querySelectorAll||!a.querySelector)},j:function(a,b){if(!a)throw new n(32,"No class name specified");a=y(a);if(a.indexOf(" ")!==-1)throw new n(32,"Compound class names not permitted");if(Ma.o(b))try{return b.querySelector("."+a.replace(/\./g,"\\."))||null}catch(c){throw new n(32,"An invalid or illegal class name was specified");}a=L(I(b),"*",a,b);return a.length?a[0]:null},h:function(a,b){if(!a)throw new n(32,"No class name specified");a=y(a);if(a.indexOf(" ")!==-1)throw new n(32,
25
- "Compound class names not permitted");if(Ma.o(b))try{return b.querySelectorAll("."+a.replace(/\./g,"\\."))}catch(c){throw new n(32,"An invalid or illegal class name was specified");}return L(I(b),"*",a,b)}};var Na=qa(),Qa=C()||A("iPod"),Ra=A("iPad"),Sa=A("Android")&&!(ra()||qa()||A("Opera")||A("Silk")),Ta=ra(),Ua=A("Safari")&&!(ra()||A("Coast")||A("Opera")||A("Edge")||A("Edg/")||A("OPR")||qa()||A("Silk")||A("Android"))&&!(C()||A("iPad")||A("iPod"));function M(a){return(a=a.exec(z()))?a[1]:""}(function(){if(Na)return M(/Firefox\/([0-9.]+)/);if(D||va||ua)return E;if(Ta){if(C()||A("iPad")||A("iPod")||A("Macintosh")){var a=M(/CriOS\/([0-9.]+)/);if(a)return a}return M(/Chrome\/([0-9.]+)/)}if(Ua&&!(C()||A("iPad")||A("iPod")))return M(/Version\/([0-9.]+)/);if(Qa||Ra){if(a=/Version\/(\S+).*Mobile\/(\S+)/.exec(z()))return a[1]+"."+a[2]}else if(Sa)return(a=M(/Android\s+([0-9.]+)/))?a:M(/Version\/([0-9.]+)/);return""})();var Va=D&&!(Number(F)>=8),Wa=D&&!(Number(F)>=9);var N={j:function(a,b){if(typeof b.querySelector!=="function"&&D&&(D?oa(F,8)>=0:Da(8))&&!k(b.querySelector))throw Error("CSS selection is not supported");if(!a)throw new n(32,"No selector specified");a=y(a);try{var c=b.querySelector(a)}catch(d){throw new n(32,"An invalid or illegal selector was specified");}return c&&c.nodeType==1?c:null},h:function(a,b){if(typeof b.querySelectorAll!=="function"&&D&&(D?oa(F,8)>=0:Da(8))&&!k(b.querySelector))throw Error("CSS selection is not supported");if(!a)throw new n(32,
26
- "No selector specified");a=y(a);try{return b.querySelectorAll(a)}catch(c){throw new n(32,"An invalid or illegal selector was specified");}}};var Xa={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",
27
- darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",
28
- ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",
29
- lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",
30
- moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",
31
- seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};var Ya="backgroundColor borderTopColor borderRightColor borderBottomColor borderLeftColor color outlineColor".split(" "),Za=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/,$a=/^#(?:[0-9a-f]{3}){1,2}$/i,ab=/^(?:rgba)?\((\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3}),\s?(0|1|0\.\d*)\)$/i,bb=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;function O(a,b){b=b.toLowerCase();return b=="style"?cb(a.style.cssText):Va&&b=="value"&&P(a,"INPUT")?a.value:Wa&&a[b]===!0?String(a.getAttribute(b)):(a=a.getAttributeNode(b))&&a.specified?a.value:null}var db=RegExp("[;]+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\\([^()]*\\))*[^()]*$)");
32
- function cb(a){var b=[];t(a.split(db),function(c){var d=c.indexOf(":");d>0&&(c=[c.slice(0,d),c.slice(d+1)],c.length==2&&b.push(c[0].toLowerCase(),":",c[1],";"))});b=b.join("");return b=b.charAt(b.length-1)==";"?b:b+";"}function P(a,b){b&&typeof b!=="string"&&(b=b.toString());return a instanceof HTMLFormElement?!!a&&a.nodeType==1&&(!b||"FORM"==b):!!a&&a.nodeType==1&&(!b||a.tagName.toUpperCase()==b)};function eb(a,b,c,d){this.top=a;this.g=b;this.l=c;this.left=d}eb.prototype.ceil=function(){this.top=Math.ceil(this.top);this.g=Math.ceil(this.g);this.l=Math.ceil(this.l);this.left=Math.ceil(this.left);return this};eb.prototype.floor=function(){this.top=Math.floor(this.top);this.g=Math.floor(this.g);this.l=Math.floor(this.l);this.left=Math.floor(this.left);return this};
33
- eb.prototype.round=function(){this.top=Math.round(this.top);this.g=Math.round(this.g);this.l=Math.round(this.l);this.left=Math.round(this.left);return this};function Q(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}Q.prototype.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};Q.prototype.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
34
- Q.prototype.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};var fb=typeof ShadowRoot==="function";function gb(a){for(a=a.parentNode;a&&a.nodeType!=1&&a.nodeType!=9&&a.nodeType!=11;)a=a.parentNode;return P(a)?a:null}
35
- function R(a,b){b=Ga(b);if(b=="float"||b=="cssFloat"||b=="styleFloat")b=Wa?"styleFloat":"cssFloat";a:{var c=b;var d=K(a);if(d.defaultView&&d.defaultView.getComputedStyle&&(d=d.defaultView.getComputedStyle(a,null))){c=d[c]||d.getPropertyValue(c)||"";break a}c=""}a=c||hb(a,b);if(a===null)a=null;else if(ea(Ya,b)>=0){b:{var e=a.match(ab);if(e&&(b=Number(e[1]),c=Number(e[2]),d=Number(e[3]),e=Number(e[4]),b>=0&&b<=255&&c>=0&&c<=255&&d>=0&&d<=255&&e>=0&&e<=1)){b=[b,c,d,e];break b}b=null}if(!b)b:{if(d=a.match(bb))if(b=
36
- Number(d[1]),c=Number(d[2]),d=Number(d[3]),b>=0&&b<=255&&c>=0&&c<=255&&d>=0&&d<=255){b=[b,c,d,1];break b}b=null}if(!b)b:{b=a.toLowerCase();c=Xa[b.toLowerCase()];if(!c&&(c=b.charAt(0)=="#"?b:"#"+b,c.length==4&&(c=c.replace(Za,"#$1$1$2$2$3$3")),!$a.test(c))){b=null;break b}b=[parseInt(c.substr(1,2),16),parseInt(c.substr(3,2),16),parseInt(c.substr(5,2),16),1]}a=b?"rgba("+b.join(", ")+")":a}return a}
37
- function hb(a,b){var c=a.currentStyle||a.style,d=c[b];d===void 0&&typeof c.getPropertyValue==="function"&&(d=c.getPropertyValue(b));return d!="inherit"?d!==void 0?d:null:(a=gb(a))?hb(a,b):null}
38
- function ib(a,b,c){function d(g){var m=S(g);if(m.height>0&&m.width>0)return!0;if(P(g,"PATH")&&(m.height>0||m.width>0))return g=R(g,"stroke-width"),!!g&&parseInt(g,10)>0;m=R(g,"visibility");return m!="collapse"&&m!="hidden"&&c(g)?R(g,"overflow")!="hidden"&&ia(g.childNodes,function(x){return x.nodeType==3?(x=x.nodeValue,/^[\s]*$/.test(x)&&/[\n\r\t]/.test(x)?!1:!0):P(x)&&d(x)}):!1}function e(g){return jb(g)==T&&ja(g.childNodes,function(m){return!P(m)||e(m)||!d(m)})}if(!P(a))throw Error("Argument to isShown must be of type Element");
39
- if(P(a,"BODY"))return!0;if(P(a,"OPTION")||P(a,"OPTGROUP"))return a=La(a,function(g){return P(g,"SELECT")}),!!a&&ib(a,!0,c);var f=kb(a);if(f)return!!f.image&&f.rect.width>0&&f.rect.height>0&&ib(f.image,b,c);if(P(a,"INPUT")&&a.type.toLowerCase()=="hidden"||P(a,"NOSCRIPT"))return!1;f=R(a,"visibility");return f!="collapse"&&f!="hidden"&&c(a)&&(b||lb(a)!=0)&&d(a)?!e(a):!1}
40
- function mb(a){function b(c){if(P(c)&&(R(c,"display")=="none"||R(c,"content-visibility")=="hidden"))return!1;var d;if((d=c.parentNode)&&d.shadowRoot&&c.assignedSlot!==void 0)d=c.assignedSlot?c.assignedSlot.parentNode:null;else if(c.getDestinationInsertionPoints){var e=c.getDestinationInsertionPoints();e.length>0&&(d=e[e.length-1])}if(fb&&d instanceof ShadowRoot){if(d.host.shadowRoot&&d.host.shadowRoot!==d)return!1;d=d.host}return!d||d.nodeType!=9&&d.nodeType!=11?d&&P(d,"DETAILS")&&!d.open&&!P(c,"SUMMARY")?
41
- !1:!!d&&b(d):!0}return ib(a,!1,b)}var T="hidden";
42
- function jb(a){function b(l){function p(xa){if(xa==g)return!0;var Oa=R(xa,"display");return Oa.lastIndexOf("inline",0)==0||Oa=="contents"||Pa=="absolute"&&R(xa,"position")=="static"?!1:!0}var Pa=R(l,"position");if(Pa=="fixed")return v=!0,l==g?null:g;for(l=gb(l);l&&!p(l);)l=gb(l);return l}function c(l){var p=l;if(x=="visible")if(l==g&&m)p=m;else if(l==m)return{x:"visible",y:"visible"};p={x:R(p,"overflow-x"),y:R(p,"overflow-y")};l==g&&(p.x=p.x=="visible"?"auto":p.x,p.y=p.y=="visible"?"auto":p.y);return p}
43
- function d(l){if(l==g){var p=(new Ha(f)).g;l=p.scrollingElement?p.scrollingElement:ya||p.compatMode!="CSS1Compat"?p.body||p.documentElement:p.documentElement;p=p.parentWindow||p.defaultView;l=D&&p.pageYOffset!=l.scrollTop?new G(l.scrollLeft,l.scrollTop):new G(p.pageXOffset||l.scrollLeft,p.pageYOffset||l.scrollTop)}else l=new G(l.scrollLeft,l.scrollTop);return l}var e=nb(a),f=K(a),g=f.documentElement,m=f.body,x=R(g,"overflow"),v;for(a=b(a);a;a=b(a)){var u=c(a);if(u.x!="visible"||u.y!="visible"){var w=
44
- S(a);if(w.width==0||w.height==0)return T;var B=e.g<w.left,J=e.l<w.top;if(B&&u.x=="hidden"||J&&u.y=="hidden")return T;if(B&&u.x!="visible"||J&&u.y!="visible"){B=d(a);J=e.l<w.top-B.y;if(e.g<w.left-B.x&&u.x!="visible"||J&&u.x!="visible")return T;e=jb(a);return e==T?T:"scroll"}B=e.left>=w.left+w.width;w=e.top>=w.top+w.height;if(B&&u.x=="hidden"||w&&u.y=="hidden")return T;if(B&&u.x!="visible"||w&&u.y!="visible"){if(v&&(u=d(a),e.left>=g.scrollWidth-u.x||e.g>=g.scrollHeight-u.y))return T;e=jb(a);return e==
45
- T?T:"scroll"}}}return"none"}
46
- function S(a){var b=kb(a);if(b)return b.rect;if(P(a,"HTML"))return a=K(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a=a.compatMode=="CSS1Compat"?a.documentElement:a.body,a=new H(a.clientWidth,a.clientHeight),new Q(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(d){return new Q(0,0,0,0)}b=new Q(c.left,c.top,c.right-c.left,c.bottom-c.top);D&&a.ownerDocument.body&&(a=K(a),b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);
47
- return b}function kb(a){var b=P(a,"MAP");if(!b&&!P(a,"AREA"))return null;var c=b?a:P(a.parentNode,"MAP")?a.parentNode:null,d=null,e=null;c&&c.name&&(d=N.j('*[usemap="#'+c.name+'"]',K(c)))&&(e=S(d),b||a.shape.toLowerCase()=="default"||(a=ob(a),b=Math.min(Math.max(a.left,0),e.width),c=Math.min(Math.max(a.top,0),e.height),e=new Q(b+e.left,c+e.top,Math.min(a.width,e.width-b),Math.min(a.height,e.height-c))));return{image:d,rect:e||new Q(0,0,0,0)}}
48
- function ob(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if(b=="rect"&&a.length==4){b=a[0];var c=a[1];return new Q(b,c,a[2]-b,a[3]-c)}if(b=="circle"&&a.length==3)return b=a[2],new Q(a[0]-b,a[1]-b,2*b,2*b);if(b=="poly"&&a.length>2){b=a[0];c=a[1];for(var d=b,e=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),d=Math.max(d,a[f]),c=Math.min(c,a[f+1]),e=Math.max(e,a[f+1]);return new Q(b,c,d-b,e-c)}return new Q(0,0,0,0)}function nb(a){a=S(a);return new eb(a.top,a.left+a.width,a.top+a.height,a.left)}
49
- function pb(a){return a.replace(/^[^\S\xa0]+|[^\S\xa0]+$/g,"")}function qb(a){var b=[];fb?rb(a,b):sb(a,b);a=ha(b,pb);return pb(a.join("\n")).replace(/\xa0/g," ")}
50
- function tb(a,b,c){if(P(a,"BR"))b.push("");else{var d=P(a,"TD"),e=R(a,"display"),f=!d&&!(ea(ub,e)>=0),g=a.previousElementSibling!==void 0?a.previousElementSibling:Ja(a.previousSibling);g=g?R(g,"display"):"";var m=R(a,"float")||R(a,"cssFloat")||R(a,"styleFloat");!f||g=="run-in"&&m=="none"||/^[\s\xa0]*$/.test(b[b.length-1]||"")||b.push("");var x=mb(a),v=null,u=null;x&&(v=R(a,"white-space"),u=R(a,"text-transform"));t(a.childNodes,function(w){c(w,b,x,v,u)});a=b[b.length-1]||"";!d&&e!="table-cell"||!a||
51
- na(a)||(b[b.length-1]+=" ");f&&e!="run-in"&&!/^[\s\xa0]*$/.test(a)&&b.push("")}}function sb(a,b){tb(a,b,function(c,d,e,f,g){c.nodeType==3&&e?vb(c,d,f,g):P(c)&&sb(c,d)})}var ub="inline inline-block inline-table none table-cell table-column table-column-group".split(" ");
52
- function vb(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if(c=="normal"||c=="nowrap")a=a.replace(/\n/g," ");a=c=="pre"||c=="pre-wrap"?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");d=="capitalize"?(c=/(^|[^'_0-9A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24B6-\u24E9\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF])([A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24B6-\u24E9])/g,a=a.replace(c,function(){return arguments[1]+arguments[2].toUpperCase()}),
53
- c=/(^|[^'_0-9A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24B6-\u24E9])([_*])([A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24D0-\u24E9])/g,a=a.replace(c,function(){return arguments[1]+arguments[2]+arguments[3].toUpperCase()})):d=="uppercase"?a=a.toUpperCase():d=="lowercase"&&(a=a.toLowerCase());c=b.pop()||"";na(c)&&a.lastIndexOf(" ",0)==0&&(a=a.substr(1));b.push(c+a)}
54
- function lb(a){if(Wa){if(R(a,"position")=="relative")return 1;a=R(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return wb(a)}function wb(a){var b=1,c=R(a,"opacity");c&&(b=Number(c));(a=gb(a))&&(b*=wb(a));return b}
55
- function xb(a,b,c,d,e){if(a.nodeType==3&&c)vb(a,b,d,e);else if(P(a))if(P(a,"CONTENT")||P(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(f=P(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),t(f.length>0?f:a.childNodes,function(g){xb(g,b,c,d,e)})):rb(a,b)}else if(P(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)t(a.childNodes,function(g){xb(g,b,c,d,e)}),a=a.olderShadowRoot}else rb(a,b)}
56
- function rb(a,b){if(a.shadowRoot){var c=R(a,"white-space"),d=R(a,"text-transform");t(a.shadowRoot.childNodes,function(e){xb(e,b,!0,c,d)})}tb(a,b,function(e,f,g,m,x){var v=null;e.nodeType==1?v=e:e.nodeType==3&&(v=e);v!=null&&(v.assignedSlot!=null||v.getDestinationInsertionPoints&&v.getDestinationInsertionPoints().length>0)||xb(e,f,g,m,x)})};var yb={o:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},j:function(a,b){var c=I(b),d=Ia(c.g,a);return d?O(d,"id")==a&&b!=d&&Ka(b,d)?d:ka(L(c,"*"),function(e){return O(e,"id")==a&&b!=e&&Ka(b,e)}):null},h:function(a,b){if(!a)return[];if(yb.o(b,a))try{return b.querySelectorAll("#"+yb.H(a))}catch(c){return[]}b=L(I(b),"*",null,b);return fa(b,function(c){return O(c,"id")==a})},H:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,"\\$1")}};var U={},zb={};U.B=function(a,b,c){try{var d=N.h("a",b)}catch(e){d=L(I(b),"A",null,b)}return ka(d,function(e){e=qb(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&e.indexOf(a)!=-1||e==a})};U.A=function(a,b,c){try{var d=N.h("a",b)}catch(e){d=L(I(b),"A",null,b)}return fa(d,function(e){e=qb(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&e.indexOf(a)!=-1||e==a})};U.j=function(a,b){return U.B(a,b,!1)};U.h=function(a,b){return U.A(a,b,!1)};zb.j=function(a,b){return U.B(a,b,!0)};
57
- zb.h=function(a,b){return U.A(a,b,!0)};var V={m:function(a,b){return function(c){var d=V.i(a);d=S(d);c=S(c);return b.call(null,d,c)}},F:function(a){return V.m(a,function(b,c){return c.top+c.height<=b.top})},G:function(a){return V.m(a,function(b,c){return c.top>=b.top+b.height})},J:function(a){return V.m(a,function(b,c){return c.left+c.width<=b.left})},L:function(a){return V.m(a,function(b,c){return c.left>=b.left+b.width})},N:function(a){return V.m(a,function(b,c){return c.left<b.left+b.width&&c.left+c.width>b.left&&c.top+c.height<=b.top})},
58
- O:function(a){return V.m(a,function(b,c){return c.left<b.left+b.width&&c.left+c.width>b.left&&c.top>=b.top+b.height})},P:function(a){return V.m(a,function(b,c){return c.top<b.top+b.height&&c.top+c.height>b.top&&c.left+c.width<=b.left})},R:function(a){return V.m(a,function(b,c){return c.top<b.top+b.height&&c.top+c.height>b.top&&c.left>=b.left+b.width})},K:function(a,b){var c;b?c=b:typeof a.distance==="number"&&(c=a.distance);c||(c=50);return function(d){var e=V.i(a);if(e===d)return!1;e=S(e);d=S(d);
59
- e=new Q(e.left-c,e.top-c,e.width+c*2,e.height+c*2);return e.left<=d.left+d.width&&d.left<=e.left+e.width&&e.top<=d.top+d.height&&d.top<=e.top+e.height}},i:function(a){if(k(a)&&a.nodeType==1)return a;if(typeof a==="function")return V.i(a.call(null));if(k(a)){var b;a:{if(b=Ab(a)){var c=Bb[b];if(c&&typeof c.j==="function"){b=c.j(a[b],ba.document);break a}}throw new n(61,"Unsupported locator strategy: "+b);}if(!b)throw new n(7,"No element has been found by "+JSON.stringify(a));return b}throw new n(61,
60
- "Selector is of wrong type: "+JSON.stringify(a));}};V.D={above:V.F,below:V.G,left:V.J,near:V.K,right:V.L,straightAbove:V.N,straightBelow:V.O,straightLeft:V.P,straightRight:V.R};V.C={above:V.i,below:V.i,left:V.i,near:V.i,right:V.i,straightAbove:V.i,straightBelow:V.i,straightLeft:V.i,straightRight:V.i};
61
- V.I=function(a,b){var c=[];t(a,function(e){e&&ja(b,function(f){var g=f.kind,m=V.D[g];if(!m)throw new n(61,"Cannot find filter suitable for "+g);return m.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=V.C[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?V.M(a,c):c:c};
62
- V.M=function(a,b){function c(f){f=S(f);return Math.sqrt(Math.pow(d-(f.left+Math.max(1,f.width)/2),2)+Math.pow(e-(f.top+Math.max(1,f.height)/2),2))}a=S(a);var d=a.left+Math.max(1,a.width)/2,e=a.top+Math.max(1,a.height)/2;la(b,function(f,g){return c(f)-c(g)});return b};V.j=function(a,b){a=V.h(a,b);return a.length==0?null:a[0]};
63
- V.h=function(a,b){if(!a.hasOwnProperty("root")||!a.hasOwnProperty("filters"))throw new n(61,"Locator not suitable for relative locators: "+JSON.stringify(a));var c=a.filters,d=ca(c);if(d!="array"&&(d!="object"||typeof c.length!="number"))throw new n(61,"Targets should be an array: "+JSON.stringify(a));var e;P(a.root)?e=[a.root]:e=Cb(a.root,b);return e.length==0?[]:V.I(e,a.filters)};var Db={j:function(a,b){if(a==="")throw new n(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)[0]||null},h:function(a,b){if(a==="")throw new n(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)}};var W={};W.s=function(){var a={T:"http://www.w3.org/2000/svg"};return function(b){return a[b]||null}}();
64
- W.v=function(a,b,c){var d=K(a);if(!d.documentElement)return null;try{var e=d.createNSResolver?d.createNSResolver(d.documentElement):W.s;if(D&&!Da(7))return d.evaluate.call(d,b,a,e,c,null);if(!D||Number(F)>=9){for(var f={},g=d.getElementsByTagName("*"),m=0;m<g.length;++m){var x=g[m],v=x.namespaceURI;if(v&&!f[v]){var u=x.lookupPrefix(v);if(!u){var w=v.match(".*/(\\w+)/?$");u=w?w[1]:"xhtml"}f[v]=u}}var B={},J;for(J in f)B[f[J]]=J;e=function(l){return B[l]||null}}try{return d.evaluate(b,a,e,c,null)}catch(l){if(l.name===
65
- "TypeError")return e=d.createNSResolver?d.createNSResolver(d.documentElement):W.s,d.evaluate(b,a,e,c,null);throw l;}}catch(l){if(!wa||l.name!="NS_ERROR_ILLEGAL_VALUE")throw new n(32,"Unable to locate an element with the xpath expression "+b+" because of the following error:\n"+l);}};W.u=function(a,b){if(!a||a.nodeType!=1)throw new n(32,'The result of the xpath expression "'+b+'" is: '+a+". It should be an element.");};
66
- W.j=function(a,b){var c=function(){var d=W.v(b,a,9);return d?d.singleNodeValue||null:b.selectSingleNode?(d=K(b),d.setProperty&&d.setProperty("SelectionLanguage","XPath"),b.selectSingleNode(a)):null}();c!==null&&W.u(c,a);return c};
67
- W.h=function(a,b){var c=function(){var d=W.v(b,a,7);if(d){for(var e=d.snapshotLength,f=[],g=0;g<e;++g)f.push(d.snapshotItem(g));return f}return b.selectNodes?(d=K(b),d.setProperty&&d.setProperty("SelectionLanguage","XPath"),b.selectNodes(a)):[]}();t(c,function(d){W.u(d,a)});return c};var Bb={className:Ma,"class name":Ma,css:N,"css selector":N,relative:V,id:yb,linkText:U,"link text":U,name:{j:function(a,b){b=L(I(b),"*",null,b);return ka(b,function(c){return O(c,"name")==a})},h:function(a,b){b=L(I(b),"*",null,b);return fa(b,function(c){return O(c,"name")==a})}},partialLinkText:zb,"partial link text":zb,tagName:Db,"tag name":Db,xpath:W};function Ab(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null}
68
- function Cb(a,b){var c=Ab(a);if(c){var d=Bb[c];if(d&&typeof d.h==="function")return d.h(a[c],b||ba.document)}throw new n(61,"Unsupported locator strategy: "+c);};var Eb=Cb,X=["se_exportedFunctionSymbol"],Y=h;X[0]in Y||typeof Y.execScript=="undefined"||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());)X.length||Eb===void 0?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=Eb;; return this.se_exportedFunctionSymbol.apply(null,arguments);}).apply(window, arguments);}
1
+ (function findElements(target, root) {
2
+ const INVALID_SELECTOR = 'invalid selector';
3
+ const INVALID_ARGUMENT = 'invalid argument';
4
+ const NO_SUCH_ELEMENT = 'no such element';
5
+ function botError(code, message) {
6
+ const err = new Error(message);
7
+ err['code'] = code;
8
+ return err;
9
+ }
10
+ function cssEscapeId(s) {
11
+ return s.replace(/[\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-/\[\]()]/g, (c) => '\\' + c);
12
+ }
13
+ function classNameMany(target, root) {
14
+ if (!target) {
15
+ throw botError(INVALID_SELECTOR, 'No class name specified');
16
+ }
17
+ target = target.trim();
18
+ if (target.indexOf(' ') !== -1) {
19
+ throw botError(INVALID_SELECTOR, 'Compound class names not permitted');
20
+ }
21
+ try {
22
+ return Array.from(root.querySelectorAll('.' + target.replace(/\\/g, '\\\\').replace(/\./g, '\\.')));
23
+ }
24
+ catch (_e) {
25
+ throw botError(INVALID_SELECTOR, 'An invalid or illegal class name was specified');
26
+ }
27
+ }
28
+ function cssMany(target, root) {
29
+ try {
30
+ return Array.from(root.querySelectorAll(target));
31
+ }
32
+ catch (_e) {
33
+ throw botError(INVALID_SELECTOR, 'An invalid or illegal CSS selector was specified: ' + target);
34
+ }
35
+ }
36
+ function idMany(target, root) {
37
+ if (!target) {
38
+ return [];
39
+ }
40
+ if (!/^\d/.test(target)) {
41
+ try {
42
+ return Array.from(root.querySelectorAll('#' + cssEscapeId(target)));
43
+ }
44
+ catch (_e) {
45
+ return [];
46
+ }
47
+ }
48
+ return Array.from(root.querySelectorAll('*')).filter(el => el.getAttribute('id') === target);
49
+ }
50
+ function getLinkText(el) {
51
+ const text = el.innerText !== undefined ? el.innerText : el.textContent || '';
52
+ return text.replace(/^[\s]+|[\s]+$/g, '');
53
+ }
54
+ function linkTextMany(target, root, partial) {
55
+ return Array.from(root.querySelectorAll('a')).filter(el => {
56
+ const text = getLinkText(el);
57
+ return partial ? text.indexOf(target) !== -1 : text === target;
58
+ });
59
+ }
60
+ function nameMany(target, root) {
61
+ return Array.from(root.querySelectorAll('[name="' + target.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"]'));
62
+ }
63
+ function tagNameMany(target, root) {
64
+ if (target === '') {
65
+ throw botError(INVALID_SELECTOR, 'Unable to locate an element with the tagName ""');
66
+ }
67
+ return Array.from(root.getElementsByTagName(target));
68
+ }
69
+ const DEFAULT_NS_RESOLVER = (function () {
70
+ const ns = { svg: 'http://www.w3.org/2000/svg' };
71
+ return (prefix) => ns[prefix] || null;
72
+ })();
73
+ const ORDERED_NODE_SNAPSHOT_TYPE = 7;
74
+ function xpathMany(target, root) {
75
+ const doc = root.documentElement ? root : root.ownerDocument;
76
+ if (!doc.documentElement) {
77
+ return [];
78
+ }
79
+ try {
80
+ let resolver = null;
81
+ if (target.indexOf(':') !== -1) {
82
+ const reversedNs = {};
83
+ const allNodes = doc.getElementsByTagName('*');
84
+ for (let i = 0; i < allNodes.length; i++) {
85
+ const n = allNodes[i];
86
+ const ns = n.namespaceURI;
87
+ if (ns && !reversedNs[ns]) {
88
+ let prefix = n.lookupPrefix(ns);
89
+ if (!prefix) {
90
+ const m = ns.match('.*/(\\w+)/?$');
91
+ prefix = m ? m[1] : 'xhtml';
92
+ }
93
+ reversedNs[ns] = prefix;
94
+ }
95
+ }
96
+ const namespaces = {};
97
+ for (const key in reversedNs) {
98
+ namespaces[reversedNs[key]] = key;
99
+ }
100
+ resolver = (prefix) => namespaces[prefix || ''] || null;
101
+ }
102
+ let result = null;
103
+ try {
104
+ result = doc.evaluate(target, root, resolver, ORDERED_NODE_SNAPSHOT_TYPE, null);
105
+ }
106
+ catch (te) {
107
+ if (te.name === 'TypeError') {
108
+ const fallback = doc.createNSResolver ? doc.createNSResolver(doc.documentElement) : DEFAULT_NS_RESOLVER;
109
+ result = doc.evaluate(target, root, fallback, ORDERED_NODE_SNAPSHOT_TYPE, null);
110
+ }
111
+ else {
112
+ throw te;
113
+ }
114
+ }
115
+ if (!result) {
116
+ return [];
117
+ }
118
+ const results = [];
119
+ for (let i = 0; i < result.snapshotLength; i++) {
120
+ const node = result.snapshotItem(i);
121
+ if (!node || node.nodeType !== Node.ELEMENT_NODE) {
122
+ throw botError(INVALID_SELECTOR, 'The result of the xpath expression "' + target + '" is: ' + node + '. It should be an element.');
123
+ }
124
+ results.push(node);
125
+ }
126
+ return results;
127
+ }
128
+ catch (ex) {
129
+ if (ex.name === 'NS_ERROR_ILLEGAL_VALUE') {
130
+ return [];
131
+ }
132
+ if (ex.code === INVALID_SELECTOR) {
133
+ throw ex;
134
+ }
135
+ throw botError(INVALID_SELECTOR, 'Unable to locate an element with the xpath expression ' + target + ' because of the following error:\n' + ex);
136
+ }
137
+ }
138
+ function getClientRect(element) {
139
+ const r = element.getBoundingClientRect();
140
+ return { left: r.left, top: r.top, width: r.width, height: r.height };
141
+ }
142
+ function resolveAnchor(selector) {
143
+ if (selector instanceof Element) {
144
+ return selector;
145
+ }
146
+ if (typeof selector === 'function') {
147
+ return resolveAnchor(selector());
148
+ }
149
+ if (selector && typeof selector === 'object') {
150
+ const found = findElements(selector);
151
+ if (!found.length) {
152
+ throw botError(NO_SUCH_ELEMENT, 'No element has been found by ' + JSON.stringify(selector));
153
+ }
154
+ return found[0];
155
+ }
156
+ throw botError(INVALID_ARGUMENT, 'Selector is of wrong type: ' + JSON.stringify(selector));
157
+ }
158
+ function makeProximityFilter(selector, test) {
159
+ return (candidate) => test(getClientRect(resolveAnchor(selector)), getClientRect(candidate));
160
+ }
161
+ const RELATIVE_STRATEGIES = {
162
+ above: (sel) => makeProximityFilter(sel, (a, c) => c.top + c.height <= a.top),
163
+ below: (sel) => makeProximityFilter(sel, (a, c) => c.top >= a.top + a.height),
164
+ left: (sel) => makeProximityFilter(sel, (a, c) => c.left + c.width <= a.left),
165
+ right: (sel) => makeProximityFilter(sel, (a, c) => c.left >= a.left + a.width),
166
+ near: (sel, distArg) => {
167
+ const distFromSelector = typeof sel['distance'] === 'number'
168
+ ? sel['distance']
169
+ : 0;
170
+ const distance = typeof distArg === 'number' && distArg > 0 ? distArg : distFromSelector || 50;
171
+ return (candidate) => {
172
+ const anchor = resolveAnchor(sel);
173
+ if (anchor === candidate)
174
+ return false;
175
+ const a = getClientRect(anchor);
176
+ const c = getClientRect(candidate);
177
+ const expanded = { left: a.left - distance, top: a.top - distance, width: a.width + distance * 2, height: a.height + distance * 2 };
178
+ return (c.left < expanded.left + expanded.width &&
179
+ c.left + c.width > expanded.left &&
180
+ c.top < expanded.top + expanded.height &&
181
+ c.top + c.height > expanded.top);
182
+ };
183
+ },
184
+ straightAbove: (sel) => makeProximityFilter(sel, (a, c) => c.left < a.left + a.width && c.left + c.width > a.left && c.top + c.height <= a.top),
185
+ straightBelow: (sel) => makeProximityFilter(sel, (a, c) => c.left < a.left + a.width && c.left + c.width > a.left && c.top >= a.top + a.height),
186
+ straightLeft: (sel) => makeProximityFilter(sel, (a, c) => c.top < a.top + a.height && c.top + c.height > a.top && c.left + c.width <= a.left),
187
+ straightRight: (sel) => makeProximityFilter(sel, (a, c) => c.top < a.top + a.height && c.top + c.height > a.top && c.left >= a.left + a.width),
188
+ };
189
+ function sortByProximity(anchor, elements) {
190
+ const ar = getClientRect(anchor);
191
+ const acx = ar.left + Math.max(1, ar.width) / 2;
192
+ const acy = ar.top + Math.max(1, ar.height) / 2;
193
+ return elements.slice().sort((a, b) => {
194
+ const ra = getClientRect(a);
195
+ const rb = getClientRect(b);
196
+ const da = Math.sqrt(Math.pow(acx - (ra.left + Math.max(1, ra.width) / 2), 2) + Math.pow(acy - (ra.top + Math.max(1, ra.height) / 2), 2));
197
+ const db = Math.sqrt(Math.pow(acx - (rb.left + Math.max(1, rb.width) / 2), 2) + Math.pow(acy - (rb.top + Math.max(1, rb.height) / 2), 2));
198
+ return da - db;
199
+ });
200
+ }
201
+ function relativeMany(target, root) {
202
+ if (!Object.prototype.hasOwnProperty.call(target, 'root') || !Object.prototype.hasOwnProperty.call(target, 'filters')) {
203
+ throw botError(INVALID_ARGUMENT, 'Locator not suitable for relative locators: ' + JSON.stringify(target));
204
+ }
205
+ const filters = target['filters'];
206
+ if (!Array.isArray(filters)) {
207
+ throw botError(INVALID_ARGUMENT, 'Targets should be an array: ' + JSON.stringify(target));
208
+ }
209
+ let elements;
210
+ const rootTarget = target['root'];
211
+ if (rootTarget instanceof Element) {
212
+ elements = [rootTarget];
213
+ }
214
+ else {
215
+ elements = findElements(rootTarget, root);
216
+ }
217
+ if (!elements.length) {
218
+ return [];
219
+ }
220
+ const matched = elements.filter(el => {
221
+ if (!el)
222
+ return false;
223
+ return filters.every(filter => {
224
+ const strategy = RELATIVE_STRATEGIES[filter.kind];
225
+ if (!strategy) {
226
+ throw botError(INVALID_ARGUMENT, 'Cannot find filter suitable for ' + filter.kind);
227
+ }
228
+ return strategy(...filter.args)(el);
229
+ });
230
+ });
231
+ const finalFilter = filters[filters.length - 1];
232
+ if (!finalFilter || !RELATIVE_STRATEGIES[finalFilter.kind]) {
233
+ return matched;
234
+ }
235
+ const lastAnchor = resolveAnchor(finalFilter.args[0]);
236
+ return sortByProximity(lastAnchor, matched);
237
+ }
238
+ const actualRoot = root || document;
239
+ const keys = Object.keys(target).filter(k => Object.prototype.hasOwnProperty.call(target, k));
240
+ if (!keys.length) {
241
+ throw botError(INVALID_ARGUMENT, 'Unsupported locator strategy: (empty)');
242
+ }
243
+ const key = keys[0];
244
+ const value = target[key];
245
+ switch (key) {
246
+ case 'className':
247
+ case 'class name':
248
+ return classNameMany(value, actualRoot);
249
+ case 'css':
250
+ case 'css selector':
251
+ return cssMany(value, actualRoot);
252
+ case 'id':
253
+ return idMany(value, actualRoot);
254
+ case 'linkText':
255
+ case 'link text':
256
+ return linkTextMany(value, actualRoot, false);
257
+ case 'partialLinkText':
258
+ case 'partial link text':
259
+ return linkTextMany(value, actualRoot, true);
260
+ case 'name':
261
+ return nameMany(value, actualRoot);
262
+ case 'tagName':
263
+ case 'tag name':
264
+ return tagNameMany(value, actualRoot);
265
+ case 'xpath':
266
+ return xpathMany(value, actualRoot);
267
+ case 'relative':
268
+ return relativeMany(value, actualRoot);
269
+ default:
270
+ throw botError(INVALID_ARGUMENT, 'Unsupported locator strategy: ' + key);
271
+ }
272
+ })