selenium-webdriver 4.35.0 → 4.38.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 +4 -4
- data/CHANGES +22 -0
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/webdriver/atoms/findElements.js +17 -16
- data/lib/selenium/webdriver/bidi/browser.rb +64 -0
- data/lib/selenium/webdriver/bidi/browsing_context.rb +1 -1
- data/lib/selenium/webdriver/bidi/network/cookies.rb +5 -8
- data/lib/selenium/webdriver/bidi/network/intercepted_request.rb +16 -4
- data/lib/selenium/webdriver/bidi/network/intercepted_response.rb +20 -6
- data/lib/selenium/webdriver/bidi/network.rb +12 -9
- data/lib/selenium/webdriver/bidi.rb +1 -1
- data/lib/selenium/webdriver/common/error.rb +3 -3
- data/lib/selenium/webdriver/common/manager.rb +2 -0
- data/lib/selenium/webdriver/common/options.rb +10 -1
- data/lib/selenium/webdriver/common/platform.rb +1 -3
- data/lib/selenium/webdriver/version.rb +1 -1
- metadata +3 -8
- data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +0 -35
- data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +0 -35
- data/lib/selenium/webdriver/bidi/log/filter_by.rb +0 -40
- data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +0 -33
- data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +0 -33
- data/lib/selenium/webdriver/bidi/log_inspector.rb +0 -147
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: caf0a29e3ecaf75eb2b31e1babd1849bc0427b17f94df59eeb8956e51b3217df
|
|
4
|
+
data.tar.gz: 5123da31c348a31ea0d03e037a6a57f151edef00c2ca414e469d7ade7ee9348b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f98f8df74d2f9e90d9041f97fb330cae1dfcf15e832005477ec2010568219f8f0ca059b1b2a5a0ee5b9662faf573f134b010331cdc30d6846fdeede558c1d4b4
|
|
7
|
+
data.tar.gz: a3b30b77b2b4695f6061a76492ec2621a0b2af7bc551fca217b7a55afcb4d858b7583176e43783d404372840d8b96cb4e6c94af052a373f88df7abb5888457cd
|
data/CHANGES
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
4.38.0 (2025-10-24)
|
|
2
|
+
=========================
|
|
3
|
+
* Fix BiDi Network issue by removing nil values on network requests (#16442)
|
|
4
|
+
* Remove cruft from old CI environment (#16473)
|
|
5
|
+
* [bidi] remove deprecated classes for log inspector (#16474)
|
|
6
|
+
* update devtools versions
|
|
7
|
+
|
|
8
|
+
4.37.0 (2025-10-16)
|
|
9
|
+
=========================
|
|
10
|
+
* Add CDP for Chrome 141 and remove 138
|
|
11
|
+
* Update Chrome/Edge args for test environment (#16376)
|
|
12
|
+
* Remove `prism` dependency (#16437)
|
|
13
|
+
* Remove `json` version constraint (#16436)
|
|
14
|
+
|
|
15
|
+
4.36.0 (2025-09-18)
|
|
16
|
+
=========================
|
|
17
|
+
* Add CDP for Chrome 140 and remove 137
|
|
18
|
+
* [BiDi] Create browser module, added user context related methods (#15371)
|
|
19
|
+
* BiDi get client windows (#16211)
|
|
20
|
+
* Fix links to exception documentation on website (#16305)
|
|
21
|
+
* Update `unhandled_prompt_behavior` capability to support hash syntax (#16289)
|
|
22
|
+
|
|
1
23
|
4.35.0 (2025-08-12)
|
|
2
24
|
=========================
|
|
3
25
|
* Add CDP for Chrome 139 and remove 136
|
data/bin/linux/selenium-manager
CHANGED
|
Binary file
|
data/bin/macos/selenium-manager
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
function(){return (function(){var h=this||self;
|
|
2
2
|
function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
|
|
3
|
-
b&&"undefined"==typeof a.call)return"object";return b}function
|
|
3
|
+
b&&"undefined"==typeof a.call)return"object";return b}function l(a){return"function"==aa(a)}function n(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ba(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};var ca=window;function q(a,b){this.code=a;this.a=r[a]||u;this.message=b||"";a=this.a.replace(/((?:^|\s+)[a-z])/g,function(c){return c.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(0>b||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}ba(q,Error);var u="unknown error",r={15:"element not selectable",11:"element not visible"};r[31]=u;r[30]=u;r[24]="invalid cookie domain";r[29]="invalid element coordinates";r[12]="invalid element state";
|
|
4
4
|
r[32]="invalid selector";r[51]="invalid selector";r[52]="invalid selector";r[17]="javascript error";r[405]="unsupported operation";r[34]="move target out of bounds";r[27]="no such alert";r[7]="no such element";r[8]="no such frame";r[23]="no such window";r[28]="script timeout";r[33]="session not created";r[10]="stale element reference";r[21]="timeout";r[25]="unable to set cookie";r[26]="unexpected alert open";r[13]=u;r[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("string"===typeof a)return"string"!==typeof b||1!=b.length?-1:a.indexOf(b,0);for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},w=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e="string"===typeof a?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,
|
|
5
|
-
b,void 0)}:function(a,b){for(var c=a.length,d=[],e=0,f="string"===typeof a?a.split(""):a,g=0;g<c;g++)if(g in f){var
|
|
5
|
+
b,void 0)}:function(a,b){for(var c=a.length,d=[],e=0,f="string"===typeof a?a.split(""):a,g=0;g<c;g++)if(g in f){var k=f[g];b.call(void 0,k,g,a)&&(d[e++]=k)}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="string"===typeof a?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,
|
|
6
6
|
d="string"===typeof a?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="string"===typeof a?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};
|
|
7
7
|
function ka(a,b){a:{for(var c=a.length,d="string"===typeof a?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 0>b?null:"string"===typeof a?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 0<=b&&a.indexOf(" ",b)==b}var x=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};
|
|
8
8
|
function oa(a,b){var c=0;a=x(String(a)).split(".");b=x(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;0==c&&e<d;e++){var f=a[e]||"",g=b[e]||"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(0==f[0].length&&0==g[0].length)break;c=pa(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||pa(0==f[2].length,0==g[2].length)||pa(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c}function pa(a,b){return a<b?-1:a>b?1:0};var y;a:{var qa=h.navigator;if(qa){var ra=qa.userAgent;if(ra){y=ra;break a}}y=""}function C(a){return-1!=y.indexOf(a)};function sa(){return C("Firefox")||C("FxiOS")}function ta(){return(C("Chrome")||C("CriOS"))&&!C("Edge")};function ua(a){return String(a).replace(/\-([a-z])/g,function(b,c){return c.toUpperCase()})};function D(){return C("iPhone")&&!C("iPod")&&!C("iPad")};function va(a,b){var c=xa;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var ya=C("Opera"),E=C("Trident")||C("MSIE"),za=C("Edge"),Aa=C("Gecko")&&!(-1!=y.toLowerCase().indexOf("webkit")&&!C("Edge"))&&!(C("Trident")||C("MSIE"))&&!C("Edge"),Ba=-1!=y.toLowerCase().indexOf("webkit")&&!C("Edge");function Ca(){var a=h.document;return a?a.documentMode:void 0}var Da;
|
|
9
9
|
a:{var Ea="",Fa=function(){var a=y;if(Aa)return/rv:([^\);]+)(\)|;)/.exec(a);if(za)return/Edge\/([\d\.]+)/.exec(a);if(E)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Ba)return/WebKit\/(\S+)/.exec(a);if(ya)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Fa&&(Ea=Fa?Fa[1]:"");if(E){var Ga=Ca();if(null!=Ga&&Ga>parseFloat(Ea)){Da=String(Ga);break a}}Da=Ea}var xa={};function Ha(a){return va(a,function(){return 0<=oa(Da,a)})}var F;F=h.document&&E?Ca():void 0;function G(a,b){this.x=void 0!==a?a:0;this.y=void 0!==b?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 I(a){return a?new Ia(J(a)):da||(da=new Ia)}function Ja(a){for(;a&&1!=a.nodeType;)a=a.previousSibling;return a}function Ka(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function J(a){return 9==a.nodeType?a:a.ownerDocument||a.document}
|
|
10
10
|
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 Ia(a){this.a=a||h.document||document}
|
|
11
|
-
function L(a,b,c,d){a=d||a.a;var e=b&&"*"!=b?String(b).toUpperCase():"";if(a.querySelectorAll&&a.querySelector&&(e||c))c=a.querySelectorAll(e+(c?"."+c:""));else if(c&&a.getElementsByClassName)if(b=a.getElementsByClassName(c),e){a={};for(var f=d=0,g;g=b[f];f++)e==g.nodeName&&(a[d++]=g);a.length=d;c=a}else c=b;else if(b=a.getElementsByTagName(e||"*"),c){a={};for(f=d=0;g=b[f];f++){e=g.className;var
|
|
11
|
+
function L(a,b,c,d){a=d||a.a;var e=b&&"*"!=b?String(b).toUpperCase():"";if(a.querySelectorAll&&a.querySelector&&(e||c))c=a.querySelectorAll(e+(c?"."+c:""));else if(c&&a.getElementsByClassName)if(b=a.getElementsByClassName(c),e){a={};for(var f=d=0,g;g=b[f];f++)e==g.nodeName&&(a[d++]=g);a.length=d;c=a}else c=b;else if(b=a.getElementsByTagName(e||"*"),c){a={};for(f=d=0;g=b[f];f++){e=g.className;var k;if(k="function"==typeof e.split)k=0<=ea(e.split(/\s+/),c);k&&(a[d++]=g)}a.length=d;c=a}else c=b;return c}
|
|
12
12
|
;var Ma={l:function(a){return!(!a.querySelectorAll||!a.querySelector)},g:function(a,b){if(!a)throw new q(32,"No class name specified");a=x(a);if(-1!==a.indexOf(" "))throw new q(32,"Compound class names not permitted");if(Ma.l(b))try{return b.querySelector("."+a.replace(/\./g,"\\."))||null}catch(c){throw new q(32,"An invalid or illegal class name was specified");}a=L(I(b),"*",a,b);return a.length?a[0]:null},c:function(a,b){if(!a)throw new q(32,"No class name specified");a=x(a);if(-1!==a.indexOf(" "))throw new q(32,
|
|
13
|
-
"Compound class names not permitted");if(Ma.l(b))try{return b.querySelectorAll("."+a.replace(/\./g,"\\."))}catch(c){throw new q(32,"An invalid or illegal class name was specified");}return L(I(b),"*",a,b)}};var Na=sa(),Oa=D()||C("iPod"),Ra=C("iPad"),Sa=C("Android")&&!(ta()||sa()||C("Opera")||C("Silk")),Ta=ta(),Ua=C("Safari")&&!(ta()||C("Coast")||C("Opera")||C("Edge")||C("Edg/")||C("OPR")||sa()||C("Silk")||C("Android"))&&!(D()||C("iPad")||C("iPod"));function M(a){return(a=a.exec(y))?a[1]:""}(function(){if(Na)return M(/Firefox\/([0-9.]+)/);if(E||za||ya)return Da;if(Ta)return D()||C("iPad")||C("iPod")?M(/CriOS\/([0-9.]+)/):M(/Chrome\/([0-9.]+)/);if(Ua&&!(D()||C("iPad")||C("iPod")))return M(/Version\/([0-9.]+)/);if(Oa||Ra){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(y);if(a)return a[1]+"."+a[2]}else if(Sa)return(a=M(/Android\s+([0-9.]+)/))?a:M(/Version\/([0-9.]+)/);return""})();var Va=E&&!(8<=Number(F)),Wa=E&&!(9<=Number(F));var N={g:function(a,b){if(!
|
|
13
|
+
"Compound class names not permitted");if(Ma.l(b))try{return b.querySelectorAll("."+a.replace(/\./g,"\\."))}catch(c){throw new q(32,"An invalid or illegal class name was specified");}return L(I(b),"*",a,b)}};var Na=sa(),Oa=D()||C("iPod"),Ra=C("iPad"),Sa=C("Android")&&!(ta()||sa()||C("Opera")||C("Silk")),Ta=ta(),Ua=C("Safari")&&!(ta()||C("Coast")||C("Opera")||C("Edge")||C("Edg/")||C("OPR")||sa()||C("Silk")||C("Android"))&&!(D()||C("iPad")||C("iPod"));function M(a){return(a=a.exec(y))?a[1]:""}(function(){if(Na)return M(/Firefox\/([0-9.]+)/);if(E||za||ya)return Da;if(Ta)return D()||C("iPad")||C("iPod")?M(/CriOS\/([0-9.]+)/):M(/Chrome\/([0-9.]+)/);if(Ua&&!(D()||C("iPad")||C("iPod")))return M(/Version\/([0-9.]+)/);if(Oa||Ra){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(y);if(a)return a[1]+"."+a[2]}else if(Sa)return(a=M(/Android\s+([0-9.]+)/))?a:M(/Version\/([0-9.]+)/);return""})();var Va=E&&!(8<=Number(F)),Wa=E&&!(9<=Number(F));var N={g:function(a,b){if(!l(b.querySelector)&&E&&(E?0<=oa(F,8):Ha(8))&&!n(b.querySelector))throw Error("CSS selection is not supported");if(!a)throw new q(32,"No selector specified");a=x(a);try{var c=b.querySelector(a)}catch(d){throw new q(32,"An invalid or illegal selector was specified");}return c&&1==c.nodeType?c:null},c:function(a,b){if(!l(b.querySelectorAll)&&E&&(E?0<=oa(F,8):Ha(8))&&!n(b.querySelector))throw Error("CSS selection is not supported");if(!a)throw new q(32,"No selector specified");
|
|
14
14
|
a=x(a);try{return b.querySelectorAll(a)}catch(c){throw new q(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",
|
|
15
15
|
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",
|
|
16
16
|
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",
|
|
@@ -21,34 +21,35 @@ function cb(a){var b=[];w(a.split(db),function(c){var d=c.indexOf(":");0<d&&(c=[
|
|
|
21
21
|
Q.prototype.round=function(){this.a=Math.round(this.a);this.b=Math.round(this.b);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};var fb="function"===typeof ShadowRoot;function gb(a){for(a=a.parentNode;a&&1!=a.nodeType&&9!=a.nodeType&&11!=a.nodeType;)a=a.parentNode;return P(a)?a:null}
|
|
22
22
|
function R(a,b){b=ua(b);if("float"==b||"cssFloat"==b||"styleFloat"==b)b=Wa?"styleFloat":"cssFloat";a:{var c=b;var d=J(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(null===a)a=null;else if(0<=ea(Ya,b)){b:{var e=a.match(ab);if(e&&(b=Number(e[1]),c=Number(e[2]),d=Number(e[3]),e=Number(e[4]),0<=b&&255>=b&&0<=c&&255>=c&&0<=d&&255>=d&&0<=e&&1>=e)){b=[b,c,d,e];break b}b=null}if(!b)b:{if(d=a.match(bb))if(b=
|
|
23
23
|
Number(d[1]),c=Number(d[2]),d=Number(d[3]),0<=b&&255>=b&&0<=c&&255>=c&&0<=d&&255>=d){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,4==c.length&&(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}
|
|
24
|
-
function hb(a,b){var c=a.currentStyle||a.style,d=c[b];void 0===d&&
|
|
25
|
-
function ib(a,b,c){function d(g){var
|
|
24
|
+
function hb(a,b){var c=a.currentStyle||a.style,d=c[b];void 0===d&&l(c.getPropertyValue)&&(d=c.getPropertyValue(b));return"inherit"!=d?void 0!==d?d:null:(a=gb(a))?hb(a,b):null}
|
|
25
|
+
function ib(a,b,c){function d(g){var k=S(g);return 0<k.height&&0<k.width?!0:P(g,"PATH")&&(0<k.height||0<k.width)?(g=R(g,"stroke-width"),!!g&&0<parseInt(g,10)):"hidden"!=R(g,"overflow")&&ia(g.childNodes,function(z){return 3==z.nodeType||P(z)&&d(z)})}function e(g){return jb(g)==T&&ja(g.childNodes,function(k){return!P(k)||e(k)||!d(k)})}if(!P(a))throw Error("Argument to isShown must be of type Element");if(P(a,"BODY"))return!0;if(P(a,"OPTION")||P(a,"OPTGROUP"))return a=La(a,function(g){return P(g,"SELECT")}),
|
|
26
26
|
!!a&&ib(a,!0,c);var f=kb(a);if(f)return!!f.image&&0<f.rect.width&&0<f.rect.height&&ib(f.image,b,c);if(P(a,"INPUT")&&"hidden"==a.type.toLowerCase()||P(a,"NOSCRIPT"))return!1;f=R(a,"visibility");return"collapse"!=f&&"hidden"!=f&&c(a)&&(b||0!=lb(a))&&d(a)?!e(a):!1}
|
|
27
27
|
function mb(a){function b(c){if(P(c)&&("none"==R(c,"display")||"hidden"==R(c,"content-visibility")))return!1;var d;if((d=c.parentNode)&&d.shadowRoot&&void 0!==c.assignedSlot)d=c.assignedSlot?c.assignedSlot.parentNode:null;else if(c.getDestinationInsertionPoints){var e=c.getDestinationInsertionPoints();0<e.length&&(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||9!=d.nodeType&&11!=d.nodeType?d&&P(d,"DETAILS")&&!d.open&&!P(c,"SUMMARY")?
|
|
28
28
|
!1:!!d&&b(d):!0}return ib(a,!1,b)}var T="hidden";
|
|
29
|
-
function jb(a){function b(m){function p(wa){if(wa==g)return!0;var Pa=R(wa,"display");return 0==Pa.lastIndexOf("inline",0)||"contents"==Pa||"absolute"==Qa&&"static"==R(wa,"position")?!1:!0}var Qa=R(m,"position");if("fixed"==Qa)return A=!0,m==g?null:g;for(m=gb(m);m&&!p(m);)m=gb(m);return m}function c(m){var p=m;if("visible"==z)if(m==g&&
|
|
30
|
-
function d(m){if(m==g){var p=(new Ia(f)).a;m=p.scrollingElement?p.scrollingElement:Ba||"CSS1Compat"!=p.compatMode?p.body||p.documentElement:p.documentElement;p=p.parentWindow||p.defaultView;m=E&&Ha("10")&&p.pageYOffset!=m.scrollTop?new G(m.scrollLeft,m.scrollTop):new G(p.pageXOffset||m.scrollLeft,p.pageYOffset||m.scrollTop)}else m=new G(m.scrollLeft,m.scrollTop);return m}var e=nb(a),f=J(a),g=f.documentElement,
|
|
29
|
+
function jb(a){function b(m){function p(wa){if(wa==g)return!0;var Pa=R(wa,"display");return 0==Pa.lastIndexOf("inline",0)||"contents"==Pa||"absolute"==Qa&&"static"==R(wa,"position")?!1:!0}var Qa=R(m,"position");if("fixed"==Qa)return A=!0,m==g?null:g;for(m=gb(m);m&&!p(m);)m=gb(m);return m}function c(m){var p=m;if("visible"==z)if(m==g&&k)p=k;else if(m==k)return{x:"visible",y:"visible"};p={x:R(p,"overflow-x"),y:R(p,"overflow-y")};m==g&&(p.x="visible"==p.x?"auto":p.x,p.y="visible"==p.y?"auto":p.y);return p}
|
|
30
|
+
function d(m){if(m==g){var p=(new Ia(f)).a;m=p.scrollingElement?p.scrollingElement:Ba||"CSS1Compat"!=p.compatMode?p.body||p.documentElement:p.documentElement;p=p.parentWindow||p.defaultView;m=E&&Ha("10")&&p.pageYOffset!=m.scrollTop?new G(m.scrollLeft,m.scrollTop):new G(p.pageXOffset||m.scrollLeft,p.pageYOffset||m.scrollTop)}else m=new G(m.scrollLeft,m.scrollTop);return m}var e=nb(a),f=J(a),g=f.documentElement,k=f.body,z=R(g,"overflow"),A;for(a=b(a);a;a=b(a)){var t=c(a);if("visible"!=t.x||"visible"!=
|
|
31
31
|
t.y){var v=S(a);if(0==v.width||0==v.height)return T;var B=e.a<v.a,K=e.b<v.b;if(B&&"hidden"==t.x||K&&"hidden"==t.y)return T;if(B&&"visible"!=t.x||K&&"visible"!=t.y){B=d(a);K=e.b<v.b-B.y;if(e.a<v.a-B.x&&"visible"!=t.x||K&&"visible"!=t.x)return T;e=jb(a);return e==T?T:"scroll"}B=e.h>=v.a+v.width;v=e.j>=v.b+v.height;if(B&&"hidden"==t.x||v&&"hidden"==t.y)return T;if(B&&"visible"!=t.x||v&&"visible"!=t.y){if(A&&(t=d(a),e.h>=g.scrollWidth-t.x||e.a>=g.scrollHeight-t.y))return T;e=jb(a);return e==T?T:"scroll"}}}return"none"}
|
|
32
32
|
function S(a){var b=kb(a);if(b)return b.rect;if(P(a,"HTML"))return a=J(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a="CSS1Compat"==a.compatMode?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);E&&a.ownerDocument.body&&(a=J(a),b.a-=a.documentElement.clientLeft+a.body.clientLeft,b.b-=a.documentElement.clientTop+a.body.clientTop);
|
|
33
33
|
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.g('*[usemap="#'+c.name+'"]',J(c)))&&(e=S(d),b||"default"==a.shape.toLowerCase()||(a=ob(a),b=Math.min(Math.max(a.a,0),e.width),c=Math.min(Math.max(a.b,0),e.height),e=new Q(b+e.a,c+e.b,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)}}
|
|
34
34
|
function ob(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if("rect"==b&&4==a.length){b=a[0];var c=a[1];return new Q(b,c,a[2]-b,a[3]-c)}if("circle"==b&&3==a.length)return b=a[2],new Q(a[0]-b,a[1]-b,2*b,2*b);if("poly"==b&&2<a.length){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.b,a.a+a.width,a.b+a.height,a.a)}
|
|
35
35
|
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," ")}
|
|
36
|
-
function tb(a,b,c){if(P(a,"BR"))b.push("");else{var d=P(a,"TD"),e=R(a,"display"),f=!d&&!(0<=ea(ub,e)),g=void 0!==a.previousElementSibling?a.previousElementSibling:Ja(a.previousSibling);g=g?R(g,"display"):"";var
|
|
36
|
+
function tb(a,b,c){if(P(a,"BR"))b.push("");else{var d=P(a,"TD"),e=R(a,"display"),f=!d&&!(0<=ea(ub,e)),g=void 0!==a.previousElementSibling?a.previousElementSibling:Ja(a.previousSibling);g=g?R(g,"display"):"";var k=R(a,"float")||R(a,"cssFloat")||R(a,"styleFloat");!f||"run-in"==g&&"none"==k||/^[\s\xa0]*$/.test(b[b.length-1]||"")||b.push("");var z=mb(a),A=null,t=null;z&&(A=R(a,"white-space"),t=R(a,"text-transform"));w(a.childNodes,function(v){c(v,b,z,A,t)});a=b[b.length-1]||"";!d&&"table-cell"!=e||!a||
|
|
37
37
|
na(a)||(b[b.length-1]+=" ");f&&"run-in"!=e&&!/^[\s\xa0]*$/.test(a)&&b.push("")}}function sb(a,b){tb(a,b,function(c,d,e,f,g){3==c.nodeType&&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(" ");
|
|
38
|
-
function vb(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if("normal"==c||"nowrap"==c)a=a.replace(/\n/g," ");a="pre"==c||"pre-wrap"==c?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");"capitalize"==d?
|
|
39
|
-
b.push(c+a)}function lb(a){if(Wa){if("relative"==R(a,"position"))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)}
|
|
38
|
+
function vb(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if("normal"==c||"nowrap"==c)a=a.replace(/\n/g," ");a="pre"==c||"pre-wrap"==c?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");"capitalize"==d?(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(e,f,g){return f+g.toUpperCase()}),c=/(^|[^'_0-9A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24B6-\u24E9])([_*])([A-Za-z\u00C0-\u02AF\u1E00-\u1EFF\u24D0-\u24E9])/g,
|
|
39
|
+
a=a.replace(c,function(e,f,g,k){return f+g+k.toUpperCase()})):"uppercase"==d?a=a.toUpperCase():"lowercase"==d&&(a=a.toLowerCase());c=b.pop()||"";na(c)&&0==a.lastIndexOf(" ",0)&&(a=a.substr(1));b.push(c+a)}function lb(a){if(Wa){if("relative"==R(a,"position"))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)}
|
|
40
|
+
function wb(a){var b=1,c=R(a,"opacity");c&&(b=Number(c));(a=gb(a))&&(b*=wb(a));return b}
|
|
40
41
|
function xb(a,b,c,d,e){if(3==a.nodeType&&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(),w(0<f.length?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;)w(a.childNodes,function(g){xb(g,b,c,d,e)}),a=a.olderShadowRoot}else rb(a,b)}
|
|
41
|
-
function rb(a,b){a.shadowRoot&&w(a.shadowRoot.childNodes,function(c){xb(c,b,!0,null,null)});tb(a,b,function(c,d,e,f,g){var
|
|
42
|
+
function rb(a,b){a.shadowRoot&&w(a.shadowRoot.childNodes,function(c){xb(c,b,!0,null,null)});tb(a,b,function(c,d,e,f,g){var k=null;1==c.nodeType?k=c:3==c.nodeType&&(k=c);null!=k&&(null!=k.assignedSlot||k.getDestinationInsertionPoints&&0<k.getDestinationInsertionPoints().length)||xb(c,d,e,f,g)})};var yb={l:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},g:function(a,b){var c=I(b),d="string"===typeof a?c.a.getElementById(a):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},c:function(a,b){if(!a)return[];if(yb.l(b,a))try{return b.querySelectorAll("#"+yb.F(a))}catch(c){return[]}b=L(I(b),"*",null,b);return fa(b,function(c){return O(c,"id")==a})},F:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,
|
|
42
43
|
"\\$1")}};var U={},zb={};U.v=function(a,b,c){try{var d=N.c("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&&-1!=e.indexOf(a)||e==a})};U.u=function(a,b,c){try{var d=N.c("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&&-1!=e.indexOf(a)||e==a})};U.g=function(a,b){return U.v(a,b,!1)};U.c=function(a,b){return U.u(a,b,!1)};zb.g=function(a,b){return U.v(a,b,!0)};
|
|
43
44
|
zb.c=function(a,b){return U.u(a,b,!0)};var V={i:function(a,b){return function(c){var d=V.f(a);d=S(d);c=S(c);return b.call(null,d,c)}},C:function(a){return V.i(a,function(b,c){return c.b+c.height<=b.b})},D:function(a){return V.i(a,function(b,c){return c.b>=b.b+b.height})},H:function(a){return V.i(a,function(b,c){return c.a+c.width<=b.a})},J:function(a){return V.i(a,function(b,c){return c.a>=b.a+b.width})},L:function(a){return V.i(a,function(b,c){return c.a<b.a+b.width&&c.a+c.width>b.a&&c.b+c.height<=b.b})},M:function(a){return V.i(a,function(b,
|
|
44
45
|
c){return c.a<b.a+b.width&&c.a+c.width>b.a&&c.b>=b.b+b.height})},N:function(a){return V.i(a,function(b,c){return c.b<b.b+b.height&&c.b+c.height>b.b&&c.a+c.width<=b.a})},O:function(a){return V.i(a,function(b,c){return c.b<b.b+b.height&&c.b+c.height>b.b&&c.a>=b.a+b.width})},I:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=50);return function(d){var e=V.f(a);if(e===d)return!1;e=S(e);d=S(d);e=new Q(e.a-c,e.b-c,e.width+2*c,e.height+2*c);return e.a<=d.a+d.width&&d.a<=e.a+e.width&&
|
|
45
|
-
e.b<=d.b+d.height&&d.b<=e.b+e.height}},f:function(a){if(n(a)&&1==a.nodeType)return a;if(
|
|
46
|
+
e.b<=d.b+d.height&&d.b<=e.b+e.height}},f:function(a){if(n(a)&&1==a.nodeType)return a;if(l(a))return V.f(a.call(null));if(n(a)){var b;a:{if(b=Ab(a)){var c=Bb[b];if(c&&l(c.g)){b=c.g(a[b],ca.document);break a}}throw new q(61,"Unsupported locator strategy: "+b);}if(!b)throw new q(7,"No element has been found by "+JSON.stringify(a));return b}throw new q(61,"Selector is of wrong type: "+JSON.stringify(a));}};
|
|
46
47
|
V.B={above:V.C,below:V.D,left:V.H,near:V.I,right:V.J,straightAbove:V.L,straightBelow:V.M,straightLeft:V.N,straightRight:V.O};V.A={above:V.f,below:V.f,left:V.f,near:V.f,right:V.f,straightAbove:V.f,straightBelow:V.f,straightLeft:V.f,straightRight:V.f};
|
|
47
|
-
V.G=function(a,b){var c=[];w(a,function(e){e&&ja(b,function(f){var g=f.kind,
|
|
48
|
+
V.G=function(a,b){var c=[];w(a,function(e){e&&ja(b,function(f){var g=f.kind,k=V.B[g];if(!k)throw new q(61,"Cannot find filter suitable for "+g);return k.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=V.A[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?V.K(a,c):c:c};
|
|
48
49
|
V.K=function(a,b){function c(f){f=S(f);return Math.sqrt(Math.pow(d-(f.a+Math.max(1,f.width)/2),2)+Math.pow(e-(f.b+Math.max(1,f.height)/2),2))}a=S(a);var d=a.a+Math.max(1,a.width)/2,e=a.b+Math.max(1,a.height)/2;la(b,function(f,g){return c(f)-c(g)});return b};V.g=function(a,b){a=V.c(a,b);return 0==a.length?null:a[0]};
|
|
49
50
|
V.c=function(a,b){if(!a.hasOwnProperty("root")||!a.hasOwnProperty("filters"))throw new q(61,"Locator not suitable for relative locators: "+JSON.stringify(a));var c=a.filters,d=aa(c);if("array"!=d&&("object"!=d||"number"!=typeof c.length))throw new q(61,"Targets should be an array: "+JSON.stringify(a));var e;P(a.root)?e=[a.root]:e=Cb(a.root,b);return 0==e.length?[]:V.G(e,a.filters)};var Db={g:function(a,b){if(""===a)throw new q(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)[0]||null},c:function(a,b){if(""===a)throw new q(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)}};var W={};W.m=function(){var a={P:"http://www.w3.org/2000/svg"};return function(b){return a[b]||null}}();
|
|
50
|
-
W.s=function(a,b,c){var d=J(a);if(!d.documentElement)return null;try{var e=d.createNSResolver?d.createNSResolver(d.documentElement):W.m;if(E&&!Ha(7))return d.evaluate.call(d,b,a,e,c,null);if(!E||9<=Number(F)){for(var f={},g=d.getElementsByTagName("*"),
|
|
51
|
+
W.s=function(a,b,c){var d=J(a);if(!d.documentElement)return null;try{var e=d.createNSResolver?d.createNSResolver(d.documentElement):W.m;if(E&&!Ha(7))return d.evaluate.call(d,b,a,e,c,null);if(!E||9<=Number(F)){for(var f={},g=d.getElementsByTagName("*"),k=0;k<g.length;++k){var z=g[k],A=z.namespaceURI;if(A&&!f[A]){var t=z.lookupPrefix(A);if(!t){var v=A.match(".*/(\\w+)/?$");t=v?v[1]:"xhtml"}f[A]=t}}var B={},K;for(K in f)B[f[K]]=K;e=function(m){return B[m]||null}}try{return d.evaluate(b,a,e,c,null)}catch(m){if("TypeError"===
|
|
51
52
|
m.name)return e=d.createNSResolver?d.createNSResolver(d.documentElement):W.m,d.evaluate(b,a,e,c,null);throw m;}}catch(m){if(!Aa||"NS_ERROR_ILLEGAL_VALUE"!=m.name)throw new q(32,"Unable to locate an element with the xpath expression "+b+" because of the following error:\n"+m);}};W.o=function(a,b){if(!a||1!=a.nodeType)throw new q(32,'The result of the xpath expression "'+b+'" is: '+a+". It should be an element.");};
|
|
52
53
|
W.g=function(a,b){var c=function(){var d=W.s(b,a,9);return d?d.singleNodeValue||null:b.selectSingleNode?(d=J(b),d.setProperty&&d.setProperty("SelectionLanguage","XPath"),b.selectSingleNode(a)):null}();null===c||W.o(c,a);return c};
|
|
53
54
|
W.c=function(a,b){var c=function(){var d=W.s(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=J(b),d.setProperty&&d.setProperty("SelectionLanguage","XPath"),b.selectNodes(a)):[]}();w(c,function(d){W.o(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:{g:function(a,b){b=L(I(b),"*",null,b);return ka(b,function(c){return O(c,"name")==a})},c: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}
|
|
54
|
-
function Cb(a,b){var c=Ab(a);if(c){var d=Bb[c];if(d&&
|
|
55
|
+
function Cb(a,b){var c=Ab(a);if(c){var d=Bb[c];if(d&&l(d.c))return d.c(a[c],b||ca.document)}throw new q(61,"Unsupported locator strategy: "+c);};var Eb=Cb,X=["se_exportedFunctionSymbol"],Y=h;X[0]in Y||"undefined"==typeof Y.execScript||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());)X.length||void 0===Eb?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);}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
|
|
20
|
+
module Selenium
|
|
21
|
+
module WebDriver
|
|
22
|
+
class BiDi
|
|
23
|
+
class Browser
|
|
24
|
+
Window = Struct.new(:handle, :active, :height, :width, :x, :y, :state) do
|
|
25
|
+
def active?
|
|
26
|
+
active
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
def initialize(bidi)
|
|
30
|
+
@bidi = bidi
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def create_user_context
|
|
34
|
+
@bidi.send_cmd('browser.createUserContext')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def user_contexts
|
|
38
|
+
@bidi.send_cmd('browser.getUserContexts')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def remove_user_context(user_context)
|
|
42
|
+
@bidi.send_cmd('browser.removeUserContext', userContext: user_context)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def windows
|
|
46
|
+
response = @bidi.send_cmd('browser.getClientWindows')
|
|
47
|
+
|
|
48
|
+
response['clientWindows'].map do |win_data|
|
|
49
|
+
attributes = {
|
|
50
|
+
handle: win_data['clientWindow'],
|
|
51
|
+
active: win_data['active'],
|
|
52
|
+
height: win_data['height'],
|
|
53
|
+
width: win_data['width'],
|
|
54
|
+
x: win_data['x'],
|
|
55
|
+
y: win_data['y'],
|
|
56
|
+
state: win_data['state']
|
|
57
|
+
}
|
|
58
|
+
Window.new(**attributes)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end # Browser
|
|
62
|
+
end # BiDi
|
|
63
|
+
end # WebDriver
|
|
64
|
+
end # Selenium
|
|
@@ -21,16 +21,13 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class BiDi
|
|
23
23
|
class Cookies < Hash
|
|
24
|
-
def initialize(cookies = {})
|
|
25
|
-
super()
|
|
26
|
-
merge!(cookies)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
24
|
def as_json
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
map do |name, val|
|
|
26
|
+
self[:name] = name.to_s
|
|
27
|
+
self[:value] = {type: 'string', value: val.to_s}
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
[compact]
|
|
30
|
+
end
|
|
34
31
|
end
|
|
35
32
|
end
|
|
36
33
|
end # BiDi
|
|
@@ -32,14 +32,18 @@ module Selenium
|
|
|
32
32
|
@method = nil
|
|
33
33
|
@url = nil
|
|
34
34
|
@body = nil
|
|
35
|
+
@headers = nil
|
|
36
|
+
@cookies = nil
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def continue
|
|
40
|
+
cookies = @cookies&.as_json
|
|
41
|
+
headers = @headers&.as_json
|
|
38
42
|
network.continue_request(
|
|
39
43
|
id: id,
|
|
40
44
|
body: body,
|
|
41
|
-
cookies: cookies
|
|
42
|
-
headers: headers
|
|
45
|
+
cookies: cookies,
|
|
46
|
+
headers: headers,
|
|
43
47
|
method: method,
|
|
44
48
|
url: url
|
|
45
49
|
)
|
|
@@ -56,13 +60,21 @@ module Selenium
|
|
|
56
60
|
}
|
|
57
61
|
end
|
|
58
62
|
|
|
59
|
-
def headers
|
|
60
|
-
@headers
|
|
63
|
+
def headers=(headers = {})
|
|
64
|
+
@headers = Headers.new(headers)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def headers(headers = {})
|
|
68
|
+
@headers ||= Headers.new(headers)
|
|
61
69
|
end
|
|
62
70
|
|
|
63
71
|
def cookies(cookies = {})
|
|
64
72
|
@cookies ||= Cookies.new(cookies)
|
|
65
73
|
end
|
|
74
|
+
|
|
75
|
+
def cookies=(cookies = {})
|
|
76
|
+
@cookies = Cookies.new(cookies)
|
|
77
|
+
end
|
|
66
78
|
end
|
|
67
79
|
end # BiDi
|
|
68
80
|
end # WebDriver
|
|
@@ -33,13 +33,17 @@ module Selenium
|
|
|
33
33
|
@reason = nil
|
|
34
34
|
@status = nil
|
|
35
35
|
@body = nil
|
|
36
|
+
@headers = nil
|
|
37
|
+
@cookies = nil
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def continue
|
|
41
|
+
cookies = @cookies&.as_json
|
|
42
|
+
headers = @headers&.as_json
|
|
39
43
|
network.continue_response(
|
|
40
44
|
id: id,
|
|
41
|
-
cookies: cookies
|
|
42
|
-
headers: headers
|
|
45
|
+
cookies: cookies,
|
|
46
|
+
headers: headers,
|
|
43
47
|
credentials: credentials.as_json,
|
|
44
48
|
reason: reason,
|
|
45
49
|
status: status
|
|
@@ -47,10 +51,12 @@ module Selenium
|
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
def provide_response
|
|
54
|
+
cookies = @cookies&.as_json
|
|
55
|
+
headers = @headers&.as_json
|
|
50
56
|
network.provide_response(
|
|
51
57
|
id: id,
|
|
52
|
-
cookies: cookies
|
|
53
|
-
headers: headers
|
|
58
|
+
cookies: cookies,
|
|
59
|
+
headers: headers,
|
|
54
60
|
body: body,
|
|
55
61
|
reason: reason,
|
|
56
62
|
status: status
|
|
@@ -61,14 +67,22 @@ module Selenium
|
|
|
61
67
|
@credentials ||= Credentials.new(username: username, password: password)
|
|
62
68
|
end
|
|
63
69
|
|
|
64
|
-
def headers
|
|
65
|
-
@headers ||= Headers.new
|
|
70
|
+
def headers(headers = {})
|
|
71
|
+
@headers ||= Headers.new(headers)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def headers=(*headers)
|
|
75
|
+
@headers = Headers.new(headers)
|
|
66
76
|
end
|
|
67
77
|
|
|
68
78
|
def cookies(cookies = {})
|
|
69
79
|
@cookies ||= Cookies.new(cookies)
|
|
70
80
|
end
|
|
71
81
|
|
|
82
|
+
def cookies=(cookies = {})
|
|
83
|
+
@cookies ||= Cookies.new(cookies)
|
|
84
|
+
end
|
|
85
|
+
|
|
72
86
|
def body=(value)
|
|
73
87
|
@body = {
|
|
74
88
|
type: 'string',
|
|
@@ -82,15 +82,16 @@ module Selenium
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def continue_request(**args)
|
|
85
|
-
|
|
86
|
-
'network.continueRequest',
|
|
85
|
+
args = {
|
|
87
86
|
request: args[:id],
|
|
88
87
|
body: args[:body],
|
|
89
88
|
cookies: args[:cookies],
|
|
90
89
|
headers: args[:headers],
|
|
91
90
|
method: args[:method],
|
|
92
91
|
url: args[:url]
|
|
93
|
-
|
|
92
|
+
}.compact
|
|
93
|
+
|
|
94
|
+
@bidi.send_cmd('network.continueRequest', **args)
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
def fail_request(request_id)
|
|
@@ -101,27 +102,29 @@ module Selenium
|
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def continue_response(**args)
|
|
104
|
-
|
|
105
|
-
'network.continueResponse',
|
|
105
|
+
args = {
|
|
106
106
|
request: args[:id],
|
|
107
107
|
cookies: args[:cookies],
|
|
108
108
|
credentials: args[:credentials],
|
|
109
109
|
headers: args[:headers],
|
|
110
110
|
reasonPhrase: args[:reason],
|
|
111
111
|
statusCode: args[:status]
|
|
112
|
-
|
|
112
|
+
}.compact
|
|
113
|
+
|
|
114
|
+
@bidi.send_cmd('network.continueResponse', **args)
|
|
113
115
|
end
|
|
114
116
|
|
|
115
117
|
def provide_response(**args)
|
|
116
|
-
|
|
117
|
-
'network.provideResponse',
|
|
118
|
+
args = {
|
|
118
119
|
request: args[:id],
|
|
119
120
|
body: args[:body],
|
|
120
121
|
cookies: args[:cookies],
|
|
121
122
|
headers: args[:headers],
|
|
122
123
|
reasonPhrase: args[:reason],
|
|
123
124
|
statusCode: args[:status]
|
|
124
|
-
|
|
125
|
+
}.compact
|
|
126
|
+
|
|
127
|
+
@bidi.send_cmd('network.provideResponse', **args)
|
|
125
128
|
end
|
|
126
129
|
|
|
127
130
|
def set_cache_behavior(behavior, *contexts)
|
|
@@ -21,8 +21,8 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class BiDi
|
|
23
23
|
autoload :Session, 'selenium/webdriver/bidi/session'
|
|
24
|
-
autoload :LogInspector, 'selenium/webdriver/bidi/log_inspector'
|
|
25
24
|
autoload :LogHandler, 'selenium/webdriver/bidi/log_handler'
|
|
25
|
+
autoload :Browser, 'selenium/webdriver/bidi/browser'
|
|
26
26
|
autoload :BrowsingContext, 'selenium/webdriver/bidi/browsing_context'
|
|
27
27
|
autoload :Struct, 'selenium/webdriver/bidi/struct'
|
|
28
28
|
autoload :Network, 'selenium/webdriver/bidi/network'
|
|
@@ -38,9 +38,9 @@ module Selenium
|
|
|
38
38
|
ERROR_URL = 'https://www.selenium.dev/documentation/webdriver/troubleshooting/errors'
|
|
39
39
|
|
|
40
40
|
URLS = {
|
|
41
|
-
NoSuchElementError: "#{ERROR_URL}#
|
|
42
|
-
StaleElementReferenceError: "#{ERROR_URL}#
|
|
43
|
-
InvalidSelectorError: "#{ERROR_URL}#
|
|
41
|
+
NoSuchElementError: "#{ERROR_URL}#nosuchelementexception",
|
|
42
|
+
StaleElementReferenceError: "#{ERROR_URL}#staleelementreferenceexception",
|
|
43
|
+
InvalidSelectorError: "#{ERROR_URL}#invalidselectorexception",
|
|
44
44
|
NoSuchDriverError: "#{ERROR_URL}/driver_location"
|
|
45
45
|
}.freeze
|
|
46
46
|
|
|
@@ -131,11 +131,20 @@ module Selenium
|
|
|
131
131
|
|
|
132
132
|
def process_w3c_options(options)
|
|
133
133
|
w3c_options = options.select { |key, val| w3c?(key) && !val.nil? }
|
|
134
|
-
w3c_options[:unhandled_prompt_behavior] &&=
|
|
134
|
+
w3c_options[:unhandled_prompt_behavior] &&=
|
|
135
|
+
process_unhandled_prompt_behavior_value(w3c_options[:unhandled_prompt_behavior])
|
|
135
136
|
options.delete_if { |key, _val| w3c?(key) }
|
|
136
137
|
w3c_options
|
|
137
138
|
end
|
|
138
139
|
|
|
140
|
+
def process_unhandled_prompt_behavior_value(value)
|
|
141
|
+
if value.is_a?(Hash)
|
|
142
|
+
value.transform_values { |v| process_unhandled_prompt_behavior_value(v) }
|
|
143
|
+
else
|
|
144
|
+
value&.to_s&.tr('_', ' ')
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
139
148
|
def process_browser_options(_browser_options)
|
|
140
149
|
nil
|
|
141
150
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: selenium-webdriver
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.38.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Rodionov
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2025-
|
|
13
|
+
date: 2025-10-25 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: base64
|
|
@@ -283,14 +283,9 @@ files:
|
|
|
283
283
|
- lib/selenium/webdriver/atoms/isDisplayed.js
|
|
284
284
|
- lib/selenium/webdriver/atoms/mutationListener.js
|
|
285
285
|
- lib/selenium/webdriver/bidi.rb
|
|
286
|
+
- lib/selenium/webdriver/bidi/browser.rb
|
|
286
287
|
- lib/selenium/webdriver/bidi/browsing_context.rb
|
|
287
|
-
- lib/selenium/webdriver/bidi/log/base_log_entry.rb
|
|
288
|
-
- lib/selenium/webdriver/bidi/log/console_log_entry.rb
|
|
289
|
-
- lib/selenium/webdriver/bidi/log/filter_by.rb
|
|
290
|
-
- lib/selenium/webdriver/bidi/log/generic_log_entry.rb
|
|
291
|
-
- lib/selenium/webdriver/bidi/log/javascript_log_entry.rb
|
|
292
288
|
- lib/selenium/webdriver/bidi/log_handler.rb
|
|
293
|
-
- lib/selenium/webdriver/bidi/log_inspector.rb
|
|
294
289
|
- lib/selenium/webdriver/bidi/network.rb
|
|
295
290
|
- lib/selenium/webdriver/bidi/network/cookies.rb
|
|
296
291
|
- lib/selenium/webdriver/bidi/network/credentials.rb
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class BiDi
|
|
23
|
-
class BaseLogEntry
|
|
24
|
-
attr_accessor :level, :text, :timestamp, :stack_trace
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, stack_trace:)
|
|
27
|
-
@level = level
|
|
28
|
-
@text = text
|
|
29
|
-
@timestamp = timestamp
|
|
30
|
-
@stack_trace = stack_trace
|
|
31
|
-
end
|
|
32
|
-
end # BaseLogEntry
|
|
33
|
-
end # BiDi
|
|
34
|
-
end # WebDriver
|
|
35
|
-
end # Selenium
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class BiDi
|
|
23
|
-
class ConsoleLogEntry < GenericLogEntry
|
|
24
|
-
attr_accessor :method, :realm, :args
|
|
25
|
-
|
|
26
|
-
def initialize(method:, realm:, args:, **)
|
|
27
|
-
super(**)
|
|
28
|
-
@method = method
|
|
29
|
-
@realm = realm
|
|
30
|
-
@args = args
|
|
31
|
-
end
|
|
32
|
-
end # ConsoleLogEntry
|
|
33
|
-
end # BiDi
|
|
34
|
-
end # WebDriver
|
|
35
|
-
end # Selenium
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class BiDi
|
|
23
|
-
class FilterBy
|
|
24
|
-
attr_accessor :level
|
|
25
|
-
|
|
26
|
-
def initialize(level)
|
|
27
|
-
@level = level
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.log_level(level = nil)
|
|
31
|
-
unless %w[debug error info warning].include?(level)
|
|
32
|
-
raise Error::WebDriverError,
|
|
33
|
-
"Valid log levels are 'debug', 'error', 'info' and 'warning'. Received: #{level}"
|
|
34
|
-
end
|
|
35
|
-
FilterBy.new(level)
|
|
36
|
-
end
|
|
37
|
-
end # FilterBy
|
|
38
|
-
end # BiDi
|
|
39
|
-
end # WebDriver
|
|
40
|
-
end # Selenium
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class BiDi
|
|
23
|
-
class GenericLogEntry < BaseLogEntry
|
|
24
|
-
attr_accessor :type
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, type:, stack_trace:)
|
|
27
|
-
super(level: level, text: text, timestamp: timestamp, stack_trace: stack_trace)
|
|
28
|
-
@type = type
|
|
29
|
-
end
|
|
30
|
-
end # GenericLogEntry
|
|
31
|
-
end # BiDi
|
|
32
|
-
end # WebDriver
|
|
33
|
-
end # Selenium
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class BiDi
|
|
23
|
-
class JavascriptLogEntry < GenericLogEntry
|
|
24
|
-
attr_accessor :type
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, type:, stack_trace:)
|
|
27
|
-
super
|
|
28
|
-
@type = 'javascript'
|
|
29
|
-
end
|
|
30
|
-
end # JavascriptLogEntry
|
|
31
|
-
end # BiDi
|
|
32
|
-
end # WebDriver
|
|
33
|
-
end # Selenium
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
# This file is automatically generated. Any changes will be lost!
|
|
21
|
-
|
|
22
|
-
require_relative 'log/base_log_entry'
|
|
23
|
-
require_relative 'log/generic_log_entry'
|
|
24
|
-
require_relative 'log/console_log_entry'
|
|
25
|
-
require_relative 'log/javascript_log_entry'
|
|
26
|
-
require_relative 'log/filter_by'
|
|
27
|
-
|
|
28
|
-
module Selenium
|
|
29
|
-
module WebDriver
|
|
30
|
-
class BiDi
|
|
31
|
-
class LogInspector
|
|
32
|
-
EVENTS = {
|
|
33
|
-
entry_added: 'entryAdded'
|
|
34
|
-
}.freeze
|
|
35
|
-
|
|
36
|
-
LOG_LEVEL = {
|
|
37
|
-
DEBUG: 'debug',
|
|
38
|
-
ERROR: 'error',
|
|
39
|
-
INFO: 'info',
|
|
40
|
-
WARNING: 'warning'
|
|
41
|
-
}.freeze
|
|
42
|
-
|
|
43
|
-
def initialize(driver, browsing_context_ids = nil)
|
|
44
|
-
WebDriver.logger.deprecate('LogInspector class',
|
|
45
|
-
'Script class with driver.script',
|
|
46
|
-
id: :log_inspector)
|
|
47
|
-
|
|
48
|
-
unless driver.capabilities.web_socket_url
|
|
49
|
-
raise Error::WebDriverError,
|
|
50
|
-
'WebDriver instance must support BiDi protocol'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
@bidi = driver.bidi
|
|
54
|
-
@bidi.session.subscribe('log.entryAdded', browsing_context_ids)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def on_console_entry(filter_by = nil, &block)
|
|
58
|
-
check_valid_filter(filter_by)
|
|
59
|
-
|
|
60
|
-
on_log do |params|
|
|
61
|
-
type = params['type']
|
|
62
|
-
console_log_events(params, filter_by, &block) if type.eql?('console')
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def on_javascript_log(filter_by = nil, &block)
|
|
67
|
-
check_valid_filter(filter_by)
|
|
68
|
-
|
|
69
|
-
on_log do |params|
|
|
70
|
-
type = params['type']
|
|
71
|
-
javascript_log_events(params, filter_by, &block) if type.eql?('javascript')
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def on_javascript_exception(&block)
|
|
76
|
-
on_log do |params|
|
|
77
|
-
type = params['type']
|
|
78
|
-
javascript_log_events(params, FilterBy.log_level('error'), &block) if type.eql?('javascript')
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def on_log(filter_by = nil, &block)
|
|
83
|
-
unless filter_by.nil?
|
|
84
|
-
check_valid_filter(filter_by)
|
|
85
|
-
|
|
86
|
-
on(:entry_added) do |params|
|
|
87
|
-
yield(params) if params['level'] == filter_by.level
|
|
88
|
-
end
|
|
89
|
-
return
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
on(:entry_added, &block)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
private
|
|
96
|
-
|
|
97
|
-
def on(event, &block)
|
|
98
|
-
event = EVENTS[event] if event.is_a?(Symbol)
|
|
99
|
-
@bidi.add_callback("log.#{event}", &block)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def check_valid_filter(filter_by)
|
|
103
|
-
return if filter_by.nil? || filter_by.instance_of?(FilterBy)
|
|
104
|
-
|
|
105
|
-
raise "Pass valid FilterBy object. Received: #{filter_by.inspect}"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def console_log_events(params, filter_by)
|
|
109
|
-
event = ConsoleLogEntry.new(
|
|
110
|
-
level: params['level'],
|
|
111
|
-
text: params['text'],
|
|
112
|
-
timestamp: params['timestamp'],
|
|
113
|
-
type: params['type'],
|
|
114
|
-
method: params['method'],
|
|
115
|
-
realm: params['realm'],
|
|
116
|
-
args: params['args'],
|
|
117
|
-
stack_trace: params['stackTrace']
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
unless filter_by.nil?
|
|
121
|
-
yield(event) if params['level'] == filter_by.level
|
|
122
|
-
return
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
yield(event)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def javascript_log_events(params, filter_by)
|
|
129
|
-
event = JavascriptLogEntry.new(
|
|
130
|
-
level: params['level'],
|
|
131
|
-
text: params['text'],
|
|
132
|
-
timestamp: params['timestamp'],
|
|
133
|
-
type: params['type'],
|
|
134
|
-
stack_trace: params['stackTrace']
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
unless filter_by.nil?
|
|
138
|
-
yield(event) if params['level'] == filter_by.level
|
|
139
|
-
return
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
yield(event)
|
|
143
|
-
end
|
|
144
|
-
end # LogInspector
|
|
145
|
-
end # Bidi
|
|
146
|
-
end # WebDriver
|
|
147
|
-
end # Selenium
|