selenium-webdriver 4.39.0 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +13 -0
  3. data/Gemfile +1 -1
  4. data/LICENSE +1 -1
  5. data/NOTICE +1 -1
  6. data/bin/linux/selenium-manager +0 -0
  7. data/bin/macos/selenium-manager +0 -0
  8. data/bin/windows/selenium-manager.exe +0 -0
  9. data/lib/selenium/server.rb +29 -4
  10. data/lib/selenium/webdriver/atoms/findElements.js +62 -49
  11. data/lib/selenium/webdriver/atoms/getAttribute.js +17 -6
  12. data/lib/selenium/webdriver/atoms/isDisplayed.js +34 -23
  13. data/lib/selenium/webdriver/bidi/browser.rb +7 -0
  14. data/lib/selenium/webdriver/bidi/browsing_context.rb +2 -1
  15. data/lib/selenium/webdriver/bidi/log_handler.rb +5 -0
  16. data/lib/selenium/webdriver/bidi/network/cookies.rb +4 -0
  17. data/lib/selenium/webdriver/bidi/network/credentials.rb +4 -0
  18. data/lib/selenium/webdriver/bidi/network/headers.rb +4 -0
  19. data/lib/selenium/webdriver/bidi/network/intercepted_auth.rb +4 -0
  20. data/lib/selenium/webdriver/bidi/network/intercepted_item.rb +4 -0
  21. data/lib/selenium/webdriver/bidi/network/intercepted_request.rb +4 -0
  22. data/lib/selenium/webdriver/bidi/network/intercepted_response.rb +4 -0
  23. data/lib/selenium/webdriver/bidi/network/url_pattern.rb +4 -0
  24. data/lib/selenium/webdriver/bidi/network.rb +6 -0
  25. data/lib/selenium/webdriver/bidi/session.rb +4 -0
  26. data/lib/selenium/webdriver/chrome/driver.rb +3 -2
  27. data/lib/selenium/webdriver/common/driver.rb +0 -5
  28. data/lib/selenium/webdriver/common/local_driver.rb +11 -1
  29. data/lib/selenium/webdriver/common/options.rb +10 -0
  30. data/lib/selenium/webdriver/common/service_manager.rb +29 -3
  31. data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
  32. data/lib/selenium/webdriver/common/wait.rb +4 -1
  33. data/lib/selenium/webdriver/common/websocket_connection.rb +73 -37
  34. data/lib/selenium/webdriver/edge/driver.rb +3 -2
  35. data/lib/selenium/webdriver/firefox/driver.rb +3 -2
  36. data/lib/selenium/webdriver/ie/driver.rb +3 -2
  37. data/lib/selenium/webdriver/remote/bidi_bridge.rb +4 -2
  38. data/lib/selenium/webdriver/remote/bridge.rb +12 -4
  39. data/lib/selenium/webdriver/remote/http/common.rb +32 -0
  40. data/lib/selenium/webdriver/safari/driver.rb +3 -2
  41. data/lib/selenium/webdriver/version.rb +1 -1
  42. data/lib/selenium/webdriver.rb +1 -1
  43. metadata +2 -2
@@ -1,28 +1,39 @@
1
- function(){return (function(){var h=this||self;
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 ca(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};var da=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},ea=Array.prototype.some?function(a,b){return Array.prototype.some.call(a,b,void 0)}:function(a,b){for(var c=a.length,e="string"===typeof a?a.split(""):a,d=0;d<c;d++)if(d in e&&b.call(void 0,e[d],d,a))return!0;return!1},fa=Array.prototype.every?function(a,
4
- b){return Array.prototype.every.call(a,b,void 0)}:function(a,b){for(var c=a.length,e="string"===typeof a?a.split(""):a,d=0;d<c;d++)if(d in e&&!b.call(void 0,e[d],d,a))return!1;return!0};var ha={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",
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||{},g=this||self;/*
8
+
9
+ Copyright The Closure Library Authors.
10
+ SPDX-License-Identifier: Apache-2.0
11
+ */
12
+ var ca=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},da=Array.prototype.some?function(a,b){return Array.prototype.some.call(a,b,void 0)}:function(a,b){for(var c=a.length,e=typeof a==="string"?a.split(""):a,d=0;d<c;d++)if(d in e&&b.call(void 0,e[d],d,a))return!0;return!1},ea=Array.prototype.every?function(a,
13
+ b){return Array.prototype.every.call(a,b,void 0)}:function(a,b){for(var c=a.length,e=typeof a==="string"?a.split(""):a,d=0;d<c;d++)if(d in e&&!b.call(void 0,e[d],d,a))return!1;return!0};var fa={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",
5
14
  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",
6
15
  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",
7
16
  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",
8
17
  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",
9
- 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 ia="backgroundColor borderTopColor borderRightColor borderBottomColor borderLeftColor color outlineColor".split(" "),ja=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/,ka=/^#(?:[0-9a-f]{3}){1,2}$/i,la=/^(?:rgba)?\((\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3}),\s?(0|1|0\.\d*)\)$/i,ma=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;function m(a,b){this.code=a;this.a=p[a]||q;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||""}ca(m,Error);var q="unknown error",p={15:"element not selectable",11:"element not visible"};p[31]=q;p[30]=q;p[24]="invalid cookie domain";p[29]="invalid element coordinates";p[12]="invalid element state";
10
- p[32]="invalid selector";p[51]="invalid selector";p[52]="invalid selector";p[17]="javascript error";p[405]="unsupported operation";p[34]="move target out of bounds";p[27]="no such alert";p[7]="no such element";p[8]="no such frame";p[23]="no such window";p[28]="script timeout";p[33]="session not created";p[10]="stale element reference";p[21]="timeout";p[25]="unable to set cookie";p[26]="unexpected alert open";p[13]=q;p[9]="unknown command";var u=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};
11
- function na(a,b){var c=0;a=u(String(a)).split(".");b=u(String(b)).split(".");for(var e=Math.max(a.length,b.length),d=0;0==c&&d<e;d++){var f=a[d]||"",g=b[d]||"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(0==f[0].length&&0==g[0].length)break;c=v(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||v(0==f[2].length,0==g[2].length)||v(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c}function v(a,b){return a<b?-1:a>b?1:0};var w;a:{var oa=h.navigator;if(oa){var sa=oa.userAgent;if(sa){w=sa;break a}}w=""}function x(a){return-1!=w.indexOf(a)};function y(){return x("Firefox")||x("FxiOS")}function A(){return(x("Chrome")||x("CriOS"))&&!x("Edge")};function ta(a){return String(a).replace(/\-([a-z])/g,function(b,c){return c.toUpperCase()})};function B(){return x("iPhone")&&!x("iPod")&&!x("iPad")};function ua(a,b){var c=va;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var wa=x("Opera"),C=x("Trident")||x("MSIE"),xa=x("Edge"),ya=x("Gecko")&&!(-1!=w.toLowerCase().indexOf("webkit")&&!x("Edge"))&&!(x("Trident")||x("MSIE"))&&!x("Edge"),za=-1!=w.toLowerCase().indexOf("webkit")&&!x("Edge");function Aa(){var a=h.document;return a?a.documentMode:void 0}var E;
12
- a:{var F="",G=function(){var a=w;if(ya)return/rv:([^\);]+)(\)|;)/.exec(a);if(xa)return/Edge\/([\d\.]+)/.exec(a);if(C)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(za)return/WebKit\/(\S+)/.exec(a);if(wa)return/(?:Version)[ \/]?(\S+)/.exec(a)}();G&&(F=G?G[1]:"");if(C){var H=Aa();if(null!=H&&H>parseFloat(F)){E=String(H);break a}}E=F}var va={};function Ba(a){return ua(a,function(){return 0<=na(E,a)})}var I;I=h.document&&C?Aa():void 0;var Ca=y(),Da=B()||x("iPod"),Ea=x("iPad"),Fa=x("Android")&&!(A()||y()||x("Opera")||x("Silk")),Ga=A(),Ha=x("Safari")&&!(A()||x("Coast")||x("Opera")||x("Edge")||x("Edg/")||x("OPR")||y()||x("Silk")||x("Android"))&&!(B()||x("iPad")||x("iPod"));function J(a){return(a=a.exec(w))?a[1]:""}(function(){if(Ca)return J(/Firefox\/([0-9.]+)/);if(C||xa||wa)return E;if(Ga)return B()||x("iPad")||x("iPod")?J(/CriOS\/([0-9.]+)/):J(/Chrome\/([0-9.]+)/);if(Ha&&!(B()||x("iPad")||x("iPod")))return J(/Version\/([0-9.]+)/);if(Da||Ea){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(w);if(a)return a[1]+"."+a[2]}else if(Fa)return(a=J(/Android\s+([0-9.]+)/))?a:J(/Version\/([0-9.]+)/);return""})();var K;if(K=C)K=!(9<=Number(I));var Ia=K;function L(a,b){this.x=void 0!==a?a:0;this.y=void 0!==b?b:0}L.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};L.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};L.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};function M(a,b){this.width=a;this.height=b}M.prototype.aspectRatio=function(){return this.width/this.height};M.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};M.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};M.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};function N(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function Ja(a,b){a&&(a=a.parentNode);for(var c=0;a;){if(b(a))return a;a=a.parentNode;c++}return null}function Ka(a){this.a=a||h.document||document};function P(a,b){b&&"string"!==typeof b&&(b=b.toString());return a instanceof HTMLFormElement?!!a&&1==a.nodeType&&(!b||"FORM"==b):!!a&&1==a.nodeType&&(!b||a.tagName.toUpperCase()==b)};function Q(a,b,c,e){this.f=a;this.a=b;this.b=c;this.c=e}Q.prototype.ceil=function(){this.f=Math.ceil(this.f);this.a=Math.ceil(this.a);this.b=Math.ceil(this.b);this.c=Math.ceil(this.c);return this};Q.prototype.floor=function(){this.f=Math.floor(this.f);this.a=Math.floor(this.a);this.b=Math.floor(this.b);this.c=Math.floor(this.c);return this};Q.prototype.round=function(){this.f=Math.round(this.f);this.a=Math.round(this.a);this.b=Math.round(this.b);this.c=Math.round(this.c);return this};function R(a,b,c,e){this.a=a;this.b=b;this.width=c;this.height=e}R.prototype.ceil=function(){this.a=Math.ceil(this.a);this.b=Math.ceil(this.b);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};R.prototype.floor=function(){this.a=Math.floor(this.a);this.b=Math.floor(this.b);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
13
- R.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 La="function"===typeof ShadowRoot;function S(a){for(a=a.parentNode;a&&1!=a.nodeType&&9!=a.nodeType&&11!=a.nodeType;)a=a.parentNode;return P(a)?a:null}
14
- function T(a,b){b=ta(b);if("float"==b||"cssFloat"==b||"styleFloat"==b)b=Ia?"styleFloat":"cssFloat";a:{var c=b;var e=N(a);if(e.defaultView&&e.defaultView.getComputedStyle&&(e=e.defaultView.getComputedStyle(a,null))){c=e[c]||e.getPropertyValue(c)||"";break a}c=""}a=c||Ma(a,b);if(null===a)a=null;else if(0<=da(ia,b)){b:{var d=a.match(la);if(d&&(b=Number(d[1]),c=Number(d[2]),e=Number(d[3]),d=Number(d[4]),0<=b&&255>=b&&0<=c&&255>=c&&0<=e&&255>=e&&0<=d&&1>=d)){b=[b,c,e,d];break b}b=null}if(!b)b:{if(e=a.match(ma))if(b=
15
- Number(e[1]),c=Number(e[2]),e=Number(e[3]),0<=b&&255>=b&&0<=c&&255>=c&&0<=e&&255>=e){b=[b,c,e,1];break b}b=null}if(!b)b:{b=a.toLowerCase();c=ha[b.toLowerCase()];if(!c&&(c="#"==b.charAt(0)?b:"#"+b,4==c.length&&(c=c.replace(ja,"#$1$1$2$2$3$3")),!ka.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}
16
- function Ma(a,b){var c=a.currentStyle||a.style,e=c[b];void 0===e&&"function"==aa(c.getPropertyValue)&&(e=c.getPropertyValue(b));return"inherit"!=e?void 0!==e?e:null:(a=S(a))?Ma(a,b):null}
17
- function U(a,b,c){function e(g){var n=V(g);if(0<n.height&&0<n.width)return!0;if(P(g,"PATH")&&(0<n.height||0<n.width))return g=T(g,"stroke-width"),!!g&&0<parseInt(g,10);n=T(g,"visibility");return"collapse"!=n&&"hidden"!=n&&c(g)?"hidden"!=T(g,"overflow")&&ea(g.childNodes,function(D){return 3==D.nodeType||P(D)&&e(D)}):!1}function d(g){return Na(g)==W&&fa(g.childNodes,function(n){return!P(n)||d(n)||!e(n)})}if(!P(a))throw Error("Argument to isShown must be of type Element");if(P(a,"BODY"))return!0;if(P(a,
18
- "OPTION")||P(a,"OPTGROUP"))return a=Ja(a,function(g){return P(g,"SELECT")}),!!a&&U(a,!0,c);var f=Oa(a);if(f)return!!f.image&&0<f.rect.width&&0<f.rect.height&&U(f.image,b,c);if(P(a,"INPUT")&&"hidden"==a.type.toLowerCase()||P(a,"NOSCRIPT"))return!1;f=T(a,"visibility");return"collapse"!=f&&"hidden"!=f&&c(a)&&(b||0!=Pa(a))&&e(a)?!d(a):!1}var W="hidden";
19
- function Na(a){function b(k){function l(ba){if(ba==g)return!0;var pa=T(ba,"display");return 0==pa.lastIndexOf("inline",0)||"contents"==pa||"absolute"==qa&&"static"==T(ba,"position")?!1:!0}var qa=T(k,"position");if("fixed"==qa)return ra=!0,k==g?null:g;for(k=S(k);k&&!l(k);)k=S(k);return k}function c(k){var l=k;if("visible"==D)if(k==g&&n)l=n;else if(k==n)return{x:"visible",y:"visible"};l={x:T(l,"overflow-x"),y:T(l,"overflow-y")};k==g&&(l.x="visible"==l.x?"auto":l.x,l.y="visible"==l.y?"auto":l.y);return l}
20
- function e(k){if(k==g){var l=(new Ka(f)).a;k=l.scrollingElement?l.scrollingElement:za||"CSS1Compat"!=l.compatMode?l.body||l.documentElement:l.documentElement;l=l.parentWindow||l.defaultView;k=C&&Ba("10")&&l.pageYOffset!=k.scrollTop?new L(k.scrollLeft,k.scrollTop):new L(l.pageXOffset||k.scrollLeft,l.pageYOffset||k.scrollTop)}else k=new L(k.scrollLeft,k.scrollTop);return k}var d=Qa(a),f=N(a),g=f.documentElement,n=f.body,D=T(g,"overflow"),ra;for(a=b(a);a;a=b(a)){var r=c(a);if("visible"!=r.x||"visible"!=
21
- r.y){var t=V(a);if(0==t.width||0==t.height)return W;var z=d.a<t.a,O=d.b<t.b;if(z&&"hidden"==r.x||O&&"hidden"==r.y)return W;if(z&&"visible"!=r.x||O&&"visible"!=r.y){z=e(a);O=d.b<t.b-z.y;if(d.a<t.a-z.x&&"visible"!=r.x||O&&"visible"!=r.x)return W;d=Na(a);return d==W?W:"scroll"}z=d.c>=t.a+t.width;t=d.f>=t.b+t.height;if(z&&"hidden"==r.x||t&&"hidden"==r.y)return W;if(z&&"visible"!=r.x||t&&"visible"!=r.y){if(ra&&(r=e(a),d.c>=g.scrollWidth-r.x||d.a>=g.scrollHeight-r.y))return W;d=Na(a);return d==W?W:"scroll"}}}return"none"}
22
- function V(a){var b=Oa(a);if(b)return b.rect;if(P(a,"HTML"))return a=N(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a="CSS1Compat"==a.compatMode?a.documentElement:a.body,a=new M(a.clientWidth,a.clientHeight),new R(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(e){return new R(0,0,0,0)}b=new R(c.left,c.top,c.right-c.left,c.bottom-c.top);C&&a.ownerDocument.body&&(a=N(a),b.a-=a.documentElement.clientLeft+a.body.clientLeft,b.b-=a.documentElement.clientTop+a.body.clientTop);
18
+ 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 ha="backgroundColor borderTopColor borderRightColor borderBottomColor borderLeftColor color outlineColor".split(" "),ia=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/,ja=/^#(?:[0-9a-f]{3}){1,2}$/i,ka=/^(?:rgba)?\((\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3}),\s?(0|1|0\.\d*)\)$/i,la=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;function m(a,b){this.code=a;this.g=p[a]||q;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;m.prototype=new a;m.prototype.constructor=m})();var q="unknown error",p={15:"element not selectable",11:"element not visible"};p[31]=q;p[30]=q;p[24]="invalid cookie domain";
19
+ p[29]="invalid element coordinates";p[12]="invalid element state";p[32]="invalid selector";p[51]="invalid selector";p[52]="invalid selector";p[17]="javascript error";p[405]="unsupported operation";p[34]="move target out of bounds";p[27]="no such alert";p[7]="no such element";p[8]="no such frame";p[23]="no such window";p[28]="script timeout";p[33]="session not created";p[10]="stale element reference";p[21]="timeout";p[25]="unable to set cookie";p[26]="unexpected alert open";p[13]=q;p[9]="unknown command";var u=aa.i&&String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};
20
+ function ma(a){var b=0;a=u(String(a)).split(".");for(var c=u("8").split("."),e=Math.max(a.length,c.length),d=0;b==0&&d<e;d++){var f=a[d]||"",h=c[d]||"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];h=/(\d*)(\D*)(.*)/.exec(h)||["","","",""];if(f[0].length==0&&h[0].length==0)break;b=w(f[1].length==0?0:parseInt(f[1],10),h[1].length==0?0:parseInt(h[1],10))||w(f[2].length==0,h[2].length==0)||w(f[2],h[2]);f=f[3];h=h[3]}while(b==0)}return b}function w(a,b){return a<b?-1:a>b?1:0};function x(){var a=g.navigator;return a&&(a=a.userAgent)?a:""}function y(a){return x().indexOf(a)!=-1};function A(){return y("Firefox")||y("FxiOS")}function B(){return(y("Chrome")||y("CriOS"))&&!y("Edge")||y("Silk")};function na(a){return String(a).replace(/\-([a-z])/g,function(b,c){return c.toUpperCase()})};function C(){return y("iPhone")&&!y("iPod")&&!y("iPad")};function ra(a){var b=sa;return Object.prototype.hasOwnProperty.call(b,8)?b[8]:b[8]=a(8)};var ta=y("Opera"),D=y("Trident")||y("MSIE"),ua=y("Edge"),va=y("Gecko")&&!(x().toLowerCase().indexOf("webkit")!=-1&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),wa=x().toLowerCase().indexOf("webkit")!=-1&&!y("Edge");function xa(){var a=g.document;return a?a.documentMode:void 0}var E;
21
+ a:{var F="",G=function(){var a=x();if(va)return/rv:([^\);]+)(\)|;)/.exec(a);if(ua)return/Edge\/([\d\.]+)/.exec(a);if(D)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(wa)return/WebKit\/(\S+)/.exec(a);if(ta)return/(?:Version)[ \/]?(\S+)/.exec(a)}();G&&(F=G?G[1]:"");if(D){var H=xa();if(H!=null&&H>parseFloat(F)){E=String(H);break a}}E=F}var sa={};function ya(){return ra(function(){return ma(E)>=0})}var I;if(g.document&&D){var za=xa();I=za?za:parseInt(E,10)||void 0}else I=void 0;var Aa=I;var Ba=A(),Ca=C()||y("iPod"),Da=y("iPad"),Ea=y("Android")&&!(B()||A()||y("Opera")||y("Silk")),Fa=B(),Ga=y("Safari")&&!(B()||y("Coast")||y("Opera")||y("Edge")||y("Edg/")||y("OPR")||A()||y("Silk")||y("Android"))&&!(C()||y("iPad")||y("iPod"));function J(a){return(a=a.exec(x()))?a[1]:""}(function(){if(Ba)return J(/Firefox\/([0-9.]+)/);if(D||ua||ta)return E;if(Fa){if(C()||y("iPad")||y("iPod")||y("Macintosh")){var a=J(/CriOS\/([0-9.]+)/);if(a)return a}return J(/Chrome\/([0-9.]+)/)}if(Ga&&!(C()||y("iPad")||y("iPod")))return J(/Version\/([0-9.]+)/);if(Ca||Da){if(a=/Version\/(\S+).*Mobile\/(\S+)/.exec(x()))return a[1]+"."+a[2]}else if(Ea)return(a=J(/Android\s+([0-9.]+)/))?a:J(/Version\/([0-9.]+)/);return""})();var K;if(K=D)K=!(Number(Aa)>=9);var Ha=K;function L(a,b){this.x=a!==void 0?a:0;this.y=b!==void 0?b:0}L.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};L.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};L.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};function M(a,b){this.width=a;this.height=b}M.prototype.aspectRatio=function(){return this.width/this.height};M.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};M.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};M.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};function N(a){return a.nodeType==9?a:a.ownerDocument||a.document}function Ia(a,b){a&&(a=a.parentNode);for(var c=0;a;){if(b(a))return a;a=a.parentNode;c++}return null}function Ja(a){this.g=a||g.document||document};function O(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 Q(a,b,c,e){this.top=a;this.g=b;this.h=c;this.left=e}Q.prototype.ceil=function(){this.top=Math.ceil(this.top);this.g=Math.ceil(this.g);this.h=Math.ceil(this.h);this.left=Math.ceil(this.left);return this};Q.prototype.floor=function(){this.top=Math.floor(this.top);this.g=Math.floor(this.g);this.h=Math.floor(this.h);this.left=Math.floor(this.left);return this};
22
+ Q.prototype.round=function(){this.top=Math.round(this.top);this.g=Math.round(this.g);this.h=Math.round(this.h);this.left=Math.round(this.left);return this};function R(a,b,c,e){this.left=a;this.top=b;this.width=c;this.height=e}R.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};R.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};
23
+ R.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 Ka=typeof ShadowRoot==="function";function S(a){for(a=a.parentNode;a&&a.nodeType!=1&&a.nodeType!=9&&a.nodeType!=11;)a=a.parentNode;return O(a)?a:null}
24
+ function T(a,b){b=na(b);if(b=="float"||b=="cssFloat"||b=="styleFloat")b=Ha?"styleFloat":"cssFloat";a:{var c=b;var e=N(a);if(e.defaultView&&e.defaultView.getComputedStyle&&(e=e.defaultView.getComputedStyle(a,null))){c=e[c]||e.getPropertyValue(c)||"";break a}c=""}a=c||La(a,b);if(a===null)a=null;else if(ca(ha,b)>=0){b:{var d=a.match(ka);if(d&&(b=Number(d[1]),c=Number(d[2]),e=Number(d[3]),d=Number(d[4]),b>=0&&b<=255&&c>=0&&c<=255&&e>=0&&e<=255&&d>=0&&d<=1)){b=[b,c,e,d];break b}b=null}if(!b)b:{if(e=a.match(la))if(b=
25
+ Number(e[1]),c=Number(e[2]),e=Number(e[3]),b>=0&&b<=255&&c>=0&&c<=255&&e>=0&&e<=255){b=[b,c,e,1];break b}b=null}if(!b)b:{b=a.toLowerCase();c=fa[b.toLowerCase()];if(!c&&(c=b.charAt(0)=="#"?b:"#"+b,c.length==4&&(c=c.replace(ia,"#$1$1$2$2$3$3")),!ja.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}
26
+ function La(a,b){var c=a.currentStyle||a.style,e=c[b];e===void 0&&typeof c.getPropertyValue==="function"&&(e=c.getPropertyValue(b));return e!="inherit"?e!==void 0?e:null:(a=S(a))?La(a,b):null}
27
+ function U(a,b,c){function e(h){var n=V(h);if(n.height>0&&n.width>0)return!0;if(O(h,"PATH")&&(n.height>0||n.width>0))return h=T(h,"stroke-width"),!!h&&parseInt(h,10)>0;n=T(h,"visibility");return n!="collapse"&&n!="hidden"&&c(h)?T(h,"overflow")!="hidden"&&da(h.childNodes,function(v){return v.nodeType==3?(v=v.nodeValue,/^[\s]*$/.test(v)&&/[\n\r\t]/.test(v)?!1:!0):O(v)&&e(v)}):!1}function d(h){return Ma(h)==W&&ea(h.childNodes,function(n){return!O(n)||d(n)||!e(n)})}if(!O(a))throw Error("Argument to isShown must be of type Element");
28
+ if(O(a,"BODY"))return!0;if(O(a,"OPTION")||O(a,"OPTGROUP"))return a=Ia(a,function(h){return O(h,"SELECT")}),!!a&&U(a,!0,c);var f=Na(a);if(f)return!!f.image&&f.rect.width>0&&f.rect.height>0&&U(f.image,b,c);if(O(a,"INPUT")&&a.type.toLowerCase()=="hidden"||O(a,"NOSCRIPT"))return!1;f=T(a,"visibility");return f!="collapse"&&f!="hidden"&&c(a)&&(b||Oa(a)!=0)&&e(a)?!d(a):!1}var W="hidden";
29
+ function Ma(a){function b(k){function l(ba){if(ba==h)return!0;var oa=T(ba,"display");return oa.lastIndexOf("inline",0)==0||oa=="contents"||pa=="absolute"&&T(ba,"position")=="static"?!1:!0}var pa=T(k,"position");if(pa=="fixed")return qa=!0,k==h?null:h;for(k=S(k);k&&!l(k);)k=S(k);return k}function c(k){var l=k;if(v=="visible")if(k==h&&n)l=n;else if(k==n)return{x:"visible",y:"visible"};l={x:T(l,"overflow-x"),y:T(l,"overflow-y")};k==h&&(l.x=l.x=="visible"?"auto":l.x,l.y=l.y=="visible"?"auto":l.y);return l}
30
+ function e(k){if(k==h){var l=(new Ja(f)).g;k=l.scrollingElement?l.scrollingElement:wa||l.compatMode!="CSS1Compat"?l.body||l.documentElement:l.documentElement;l=l.parentWindow||l.defaultView;k=D&&l.pageYOffset!=k.scrollTop?new L(k.scrollLeft,k.scrollTop):new L(l.pageXOffset||k.scrollLeft,l.pageYOffset||k.scrollTop)}else k=new L(k.scrollLeft,k.scrollTop);return k}var d=Pa(a),f=N(a),h=f.documentElement,n=f.body,v=T(h,"overflow"),qa;for(a=b(a);a;a=b(a)){var r=c(a);if(r.x!="visible"||r.y!="visible"){var t=
31
+ V(a);if(t.width==0||t.height==0)return W;var z=d.g<t.left,P=d.h<t.top;if(z&&r.x=="hidden"||P&&r.y=="hidden")return W;if(z&&r.x!="visible"||P&&r.y!="visible"){z=e(a);P=d.h<t.top-z.y;if(d.g<t.left-z.x&&r.x!="visible"||P&&r.x!="visible")return W;d=Ma(a);return d==W?W:"scroll"}z=d.left>=t.left+t.width;t=d.top>=t.top+t.height;if(z&&r.x=="hidden"||t&&r.y=="hidden")return W;if(z&&r.x!="visible"||t&&r.y!="visible"){if(qa&&(r=e(a),d.left>=h.scrollWidth-r.x||d.g>=h.scrollHeight-r.y))return W;d=Ma(a);return d==
32
+ W?W:"scroll"}}}return"none"}
33
+ function V(a){var b=Na(a);if(b)return b.rect;if(O(a,"HTML"))return a=N(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a=a.compatMode=="CSS1Compat"?a.documentElement:a.body,a=new M(a.clientWidth,a.clientHeight),new R(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(e){return new R(0,0,0,0)}b=new R(c.left,c.top,c.right-c.left,c.bottom-c.top);D&&a.ownerDocument.body&&(a=N(a),b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);
23
34
  return b}
24
- function Oa(a){var b=P(a,"MAP");if(!b&&!P(a,"AREA"))return null;var c=b?a:P(a.parentNode,"MAP")?a.parentNode:null,e=null,d=null;if(c&&c.name){e='*[usemap="#'+c.name+'"]';c=N(c);var f;if(f="function"!=aa(c.querySelector)&&C&&(C?0<=na(I,8):Ba(8))){f=c.querySelector;var g=typeof f;f=!("object"==g&&null!=f||"function"==g)}if(f)throw Error("CSS selection is not supported");if(!e)throw new m(32,"No selector specified");e=u(e);try{var n=c.querySelector(e)}catch(D){throw new m(32,"An invalid or illegal selector was specified");}if(e=
25
- n&&1==n.nodeType?n:null)d=V(e),b||"default"==a.shape.toLowerCase()||(a=Ra(a),b=Math.min(Math.max(a.a,0),d.width),n=Math.min(Math.max(a.b,0),d.height),d=new R(b+d.a,n+d.b,Math.min(a.width,d.width-b),Math.min(a.height,d.height-n)))}return{image:e,rect:d||new R(0,0,0,0)}}
26
- function Ra(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 R(b,c,a[2]-b,a[3]-c)}if("circle"==b&&3==a.length)return b=a[2],new R(a[0]-b,a[1]-b,2*b,2*b);if("poly"==b&&2<a.length){b=a[0];c=a[1];for(var e=b,d=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),e=Math.max(e,a[f]),c=Math.min(c,a[f+1]),d=Math.max(d,a[f+1]);return new R(b,c,e-b,d-c)}return new R(0,0,0,0)}function Qa(a){a=V(a);return new Q(a.b,a.a+a.width,a.b+a.height,a.a)}
27
- function Pa(a){if(Ia){if("relative"==T(a,"position"))return 1;a=T(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Sa(a)}function Sa(a){var b=1,c=T(a,"opacity");c&&(b=Number(c));(a=S(a))&&(b*=Sa(a));return b};function Ta(a,b){function c(e){if(P(e)&&("none"==T(e,"display")||"hidden"==T(e,"content-visibility")))return!1;var d;if((d=e.parentNode)&&d.shadowRoot&&void 0!==e.assignedSlot)d=e.assignedSlot?e.assignedSlot.parentNode:null;else if(e.getDestinationInsertionPoints){var f=e.getDestinationInsertionPoints();0<f.length&&(d=f[f.length-1])}if(La&&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(e,
28
- "SUMMARY")?!1:!!d&&c(d):!0}return U(a,!!b,c)}var 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===Ta?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=Ta;; return this.se_exportedFunctionSymbol.apply(null,arguments);}).apply(window, arguments);}
35
+ function Na(a){var b=O(a,"MAP");if(!b&&!O(a,"AREA"))return null;var c=b?a:O(a.parentNode,"MAP")?a.parentNode:null,e=null,d=null;if(c&&c.name){e='*[usemap="#'+c.name+'"]';c=N(c);var f;if(f=typeof c.querySelector!=="function"&&D&&(D?ma(Aa)>=0:ya())){f=c.querySelector;var h=typeof f;f=!(h=="object"&&f!=null||h=="function")}if(f)throw Error("CSS selection is not supported");if(!e)throw new m(32,"No selector specified");e=u(e);try{var n=c.querySelector(e)}catch(v){throw new m(32,"An invalid or illegal selector was specified");}if(e=
36
+ n&&n.nodeType==1?n:null)d=V(e),b||a.shape.toLowerCase()=="default"||(a=Qa(a),b=Math.min(Math.max(a.left,0),d.width),n=Math.min(Math.max(a.top,0),d.height),d=new R(b+d.left,n+d.top,Math.min(a.width,d.width-b),Math.min(a.height,d.height-n)))}return{image:e,rect:d||new R(0,0,0,0)}}
37
+ function Qa(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 R(b,c,a[2]-b,a[3]-c)}if(b=="circle"&&a.length==3)return b=a[2],new R(a[0]-b,a[1]-b,2*b,2*b);if(b=="poly"&&a.length>2){b=a[0];c=a[1];for(var e=b,d=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),e=Math.max(e,a[f]),c=Math.min(c,a[f+1]),d=Math.max(d,a[f+1]);return new R(b,c,e-b,d-c)}return new R(0,0,0,0)}function Pa(a){a=V(a);return new Q(a.top,a.left+a.width,a.top+a.height,a.left)}
38
+ function Oa(a){if(Ha){if(T(a,"position")=="relative")return 1;a=T(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Ra(a)}function Ra(a){var b=1,c=T(a,"opacity");c&&(b=Number(c));(a=S(a))&&(b*=Ra(a));return b};function Sa(a,b){function c(e){if(O(e)&&(T(e,"display")=="none"||T(e,"content-visibility")=="hidden"))return!1;var d;if((d=e.parentNode)&&d.shadowRoot&&e.assignedSlot!==void 0)d=e.assignedSlot?e.assignedSlot.parentNode:null;else if(e.getDestinationInsertionPoints){var f=e.getDestinationInsertionPoints();f.length>0&&(d=f[f.length-1])}if(Ka&&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&&O(d,"DETAILS")&&!d.open&&!O(e,
39
+ "SUMMARY")?!1:!!d&&c(d):!0}return U(a,!!b,c)}var X=["se_exportedFunctionSymbol"],Y=g;X[0]in Y||typeof Y.execScript=="undefined"||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());)X.length||Sa===void 0?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=Sa;; return this.se_exportedFunctionSymbol.apply(null,arguments);}).apply(window, arguments);}
@@ -20,6 +20,13 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # BiDi Implementation of the Browser Module
25
+ # Continue to use functionality from existing `driver.manager.window` method
26
+ #
27
+ # @api private
28
+ #
29
+
23
30
  class Browser
24
31
  Window = Struct.new(:handle, :active, :height, :width, :x, :y, :state) do
25
32
  def active?
@@ -20,7 +20,8 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
- # Implements the browsingContext Module of the WebDriver-BiDi specification
23
+ # Implements the BrowsingContext Module of the WebDriver-BiDi specification
24
+ # Continue to use functionality from existing `driver.navigate` method
24
25
  #
25
26
  # @api private
26
27
  #
@@ -20,6 +20,11 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ # Implements the Log of the WebDriver-BiDi specification
24
+ # This functionality should be accessed through `driver.script` method
25
+ #
26
+ # @api private
27
+ #
23
28
  class LogHandler
24
29
  ConsoleLogEntry = BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source, :method, :args)
25
30
  JavaScriptLogEntry = BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source)
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # @api private
25
+ #
26
+
23
27
  class Cookies < Hash
24
28
  def as_json
25
29
  map do |name, val|
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # @api private
25
+ #
26
+
23
27
  class Credentials
24
28
  attr_accessor :username, :password
25
29
 
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # @api private
25
+ #
26
+
23
27
  class Headers < Hash
24
28
  def as_json
25
29
  map do |name, val|
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # @api private
25
+ #
26
+
23
27
  class InterceptedAuth < InterceptedItem
24
28
  def authenticate(username, password)
25
29
  network.continue_with_auth(id, username, password)
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ #
24
+ # @api private
25
+ #
26
+
23
27
  class InterceptedItem
24
28
  attr_reader :network, :request
25
29
 
@@ -23,6 +23,10 @@ require_relative 'headers'
23
23
  module Selenium
24
24
  module WebDriver
25
25
  class BiDi
26
+ #
27
+ # @api private
28
+ #
29
+
26
30
  class InterceptedRequest < InterceptedItem
27
31
  attr_accessor :method, :url
28
32
  attr_reader :body
@@ -24,6 +24,10 @@ require_relative 'cookies'
24
24
  module Selenium
25
25
  module WebDriver
26
26
  class BiDi
27
+ #
28
+ # @api private
29
+ #
30
+
27
31
  class InterceptedResponse < InterceptedItem
28
32
  attr_accessor :reason, :status
29
33
  attr_reader :body
@@ -22,6 +22,10 @@ require 'uri'
22
22
  module Selenium
23
23
  module WebDriver
24
24
  class BiDi
25
+ #
26
+ # @api private
27
+ #
28
+
25
29
  module UrlPattern
26
30
  module_function
27
31
 
@@ -21,6 +21,12 @@ require_relative 'network/url_pattern'
21
21
  module Selenium
22
22
  module WebDriver
23
23
  class BiDi
24
+ # Implements the Navigation Module of the WebDriver-BiDi specification
25
+ # Continue to use functionality from existing `driver.navigate` method
26
+ #
27
+ # @api private
28
+ #
29
+
24
30
  class Network
25
31
  EVENTS = {
26
32
  before_request: 'network.beforeRequestSent',
@@ -20,6 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class BiDi
23
+ # Implements the Session Module of the WebDriver-BiDi specification
24
+ #
25
+ # @api private
26
+ #
23
27
  class Session
24
28
  Status = Struct.new(:ready, :message)
25
29
 
@@ -31,8 +31,9 @@ module Selenium
31
31
  include LocalDriver
32
32
 
33
33
  def initialize(options: nil, service: nil, url: nil, **)
34
- caps, url = initialize_local_driver(options, service, url)
35
- super(caps: caps, url: url, **)
34
+ initialize_local_driver(options, service, url) do |caps, driver_url|
35
+ super(caps: caps, url: driver_url, **)
36
+ end
36
37
  end
37
38
 
38
39
  def browser
@@ -326,11 +326,6 @@ module Selenium
326
326
  end
327
327
  end
328
328
 
329
- def service_url(service)
330
- @service_manager = service.launch
331
- @service_manager.uri
332
- end
333
-
334
329
  def screenshot
335
330
  bridge.screenshot
336
331
  end
@@ -27,7 +27,17 @@ module Selenium
27
27
  caps = process_options(options, service)
28
28
  url = service_url(service)
29
29
 
30
- [caps, url]
30
+ begin
31
+ yield(caps, url) if block_given?
32
+ rescue Selenium::WebDriver::Error::WebDriverError
33
+ @service_manager&.stop
34
+ raise
35
+ end
36
+ end
37
+
38
+ def service_url(service)
39
+ @service_manager = service.launch
40
+ @service_manager.uri
31
41
  end
32
42
 
33
43
  def process_options(options, service)
@@ -71,6 +71,8 @@ module Selenium
71
71
  def initialize(**opts)
72
72
  self.class.set_capabilities
73
73
 
74
+ opts[:web_socket_url] = opts.delete(:bidi) if opts.key?(:bidi)
75
+
74
76
  @options = opts
75
77
  @options[:browser_name] = self.class::BROWSER
76
78
  end
@@ -91,6 +93,14 @@ module Selenium
91
93
  @options[name] = value
92
94
  end
93
95
 
96
+ def enable_bidi!
97
+ @options[:web_socket_url] = true
98
+ end
99
+
100
+ def bidi?
101
+ !!@options[:web_socket_url]
102
+ end
103
+
94
104
  def ==(other)
95
105
  return false unless other.is_a? self.class
96
106
 
@@ -127,10 +127,36 @@ module Selenium
127
127
  end
128
128
 
129
129
  def connect_until_stable
130
- socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
131
- return if socket_poller.connected?
130
+ deadline = current_time + START_TIMEOUT
132
131
 
133
- raise Error::WebDriverError, cannot_connect_error_text
132
+ loop do
133
+ error = check_connection_error
134
+ return unless error
135
+
136
+ raise Error::WebDriverError, "#{cannot_connect_error_text}: #{error}" if current_time > deadline
137
+
138
+ sleep 0.1
139
+ end
140
+ end
141
+
142
+ def check_connection_error
143
+ response = Net::HTTP.start(@host, @port, open_timeout: 0.5, read_timeout: 1) do |http|
144
+ http.get('/status', {'Connection' => 'close'})
145
+ end
146
+
147
+ return "status returned #{response.code}\n#{response.body}" unless response.is_a?(Net::HTTPSuccess)
148
+
149
+ status = JSON.parse(response.body)
150
+ ready = status['ready'] || status.dig('value', 'ready')
151
+ "driver not ready: #{response.body}" unless ready
152
+ rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT,
153
+ Errno::EADDRNOTAVAIL, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout,
154
+ EOFError, SocketError, Net::HTTPBadResponse, JSON::ParserError => e
155
+ "#{e.class}: #{e.message}"
156
+ end
157
+
158
+ def current_time
159
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
134
160
  end
135
161
 
136
162
  def cannot_connect_error_text
@@ -93,7 +93,7 @@ module Selenium
93
93
  true
94
94
  rescue *NOT_CONNECTED_ERRORS
95
95
  sock&.close
96
- WebDriver.logger.debug("polling for socket on #{[@host, @port].inspect}", id: :driver_service)
96
+ WebDriver.logger.debug("polling for socket on #{[@host, @port].inspect}", id: :socket_poller)
97
97
  false
98
98
  end
99
99
  end
@@ -37,7 +37,8 @@ module Selenium
37
37
  @timeout = opts.fetch(:timeout, DEFAULT_TIMEOUT)
38
38
  @interval = opts.fetch(:interval, DEFAULT_INTERVAL)
39
39
  @message = opts[:message]
40
- @ignored = Array(opts[:ignore] || Error::NoSuchElementError)
40
+ @message_provider = opts[:message_provider]
41
+ @ignored = Array(opts[:ignore] || Error::NoSuchElementError)
41
42
  end
42
43
 
43
44
  #
@@ -64,6 +65,8 @@ module Selenium
64
65
 
65
66
  msg = if @message
66
67
  @message.dup
68
+ elsif @message_provider
69
+ @message_provider.call
67
70
  else
68
71
  "timed out after #{@timeout} seconds"
69
72
  end