selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
19 lines (16 loc) • 6.33 kB
JavaScript
// GENERATED CODE - DO NOT EDIT
module.exports = function(){return (function(){/*
Copyright The Closure Library Authors.
Copyright The Closure Compiler Authors.
SPDX-License-Identifier: Apache-2.0
*/
var d=this||self;/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
var f=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},h=Array.prototype.forEach?function(a,b){Array.prototype.forEach.call(a,b,void 0)}:function(a,b){for(var c=a.length,e=typeof a==="string"?a.split(""):a,g=0;g<c;g++)g in e&&b.call(void 0,e[g],g,a)};function k(a,b){this.code=a;this.g=l[a]||m;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;k.prototype=new a;k.prototype.constructor=k})();var m="unknown error",l={15:"element not selectable",11:"element not visible"};l[31]=m;l[30]=m;l[24]="invalid cookie domain";
l[29]="invalid element coordinates";l[12]="invalid element state";l[32]="invalid selector";l[51]="invalid selector";l[52]="invalid selector";l[17]="javascript error";l[405]="unsupported operation";l[34]="move target out of bounds";l[27]="no such alert";l[7]="no such element";l[8]="no such frame";l[23]="no such window";l[28]="script timeout";l[33]="session not created";l[10]="stale element reference";l[21]="timeout";l[25]="unable to set cookie";l[26]="unexpected alert open";l[13]=m;l[9]="unknown command";function n(){var a=d.navigator;return a&&(a=a.userAgent)?a:""}function p(a){return n().indexOf(a)!=-1};function q(){return p("Firefox")||p("FxiOS")}function r(){return(p("Chrome")||p("CriOS"))&&!p("Edge")||p("Silk")};function t(){return p("iPhone")&&!p("iPod")&&!p("iPad")};var u=p("Opera"),v=p("Trident")||p("MSIE"),w=p("Edge"),x=p("Gecko")&&!(n().toLowerCase().indexOf("webkit")!=-1&&!p("Edge"))&&!(p("Trident")||p("MSIE"))&&!p("Edge"),y=n().toLowerCase().indexOf("webkit")!=-1&&!p("Edge");function A(){var a=d.document;return a?a.documentMode:void 0}var B;
a:{var C="",D=function(){var a=n();if(x)return/rv:([^\);]+)(\)|;)/.exec(a);if(w)return/Edge\/([\d\.]+)/.exec(a);if(v)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(y)return/WebKit\/(\S+)/.exec(a);if(u)return/(?:Version)[ \/]?(\S+)/.exec(a)}();D&&(C=D?D[1]:"");if(v){var E=A();if(E!=null&&E>parseFloat(C)){B=String(E);break a}}B=C}var F;if(d.document&&v){var G=A();F=G?G:parseInt(B,10)||void 0}else F=void 0;var H=F;var I=q(),J=t()||p("iPod"),K=p("iPad"),L=p("Android")&&!(r()||q()||p("Opera")||p("Silk")),M=r(),N=p("Safari")&&!(r()||p("Coast")||p("Opera")||p("Edge")||p("Edg/")||p("OPR")||q()||p("Silk")||p("Android"))&&!(t()||p("iPad")||p("iPod"));function O(a){return(a=a.exec(n()))?a[1]:""}(function(){if(I)return O(/Firefox\/([0-9.]+)/);if(v||w||u)return B;if(M){if(t()||p("iPad")||p("iPod")||p("Macintosh")){var a=O(/CriOS\/([0-9.]+)/);if(a)return a}return O(/Chrome\/([0-9.]+)/)}if(N&&!(t()||p("iPad")||p("iPod")))return O(/Version\/([0-9.]+)/);if(J||K){if(a=/Version\/(\S+).*Mobile\/(\S+)/.exec(n()))return a[1]+"."+a[2]}else if(L)return(a=O(/Android\s+([0-9.]+)/))?a:O(/Version\/([0-9.]+)/);return""})();var P=v&&!(Number(H)>=8),aa=v&&!(Number(H)>=9);var ba={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},Q={IMG:" ",BR:"\n"};function R(a,b,c){if(!(a.nodeName in ba))if(a.nodeType==3)c?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in Q)b.push(Q[a.nodeName]);else for(a=a.firstChild;a;)R(a,b,c),a=a.nextSibling};function S(a,b){b=b.toLowerCase();return b=="style"?ca(a.style.cssText):P&&b=="value"&&T(a,"INPUT")?a.value:aa&&a[b]===!0?String(a.getAttribute(b)):(a=a.getAttributeNode(b))&&a.specified?a.value:null}var da=RegExp("[;]+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\\([^()]*\\))*[^()]*$)");
function ca(a){var b=[];h(a.split(da),function(c){var e=c.indexOf(":");e>0&&(c=[c.slice(0,e),c.slice(e+1)],c.length==2&&b.push(c[0].toLowerCase(),":",c[1],";"))});b=b.join("");return b=b.charAt(b.length-1)==";"?b:b+";"}function U(a,b){P&&b=="value"&&T(a,"OPTION")&&S(a,"value")===null?(b=[],R(a,b,!1),a=b.join("")):a=a[b];return a}
function T(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 V(a){return T(a,"OPTION")?!0:T(a,"INPUT")?(a=a.type.toLowerCase(),a=="checkbox"||a=="radio"):!1};var ea={"class":"className",readonly:"readOnly"},fa="allowfullscreen allowpaymentrequest allowusermedia async autofocus autoplay checked compact complete controls declare default defaultchecked defaultselected defer disabled ended formnovalidate hidden indeterminate iscontenteditable ismap itemscope loop multiple muted nohref nomodule noresize noshade novalidate nowrap open paused playsinline pubdate readonly required reversed scoped seamless seeking selected truespeed typemustmatch willvalidate".split(" ");function W(a,b){var c=null,e=b.toLowerCase();if("style"==e)return(c=a.style)&&typeof c!=="string"&&(c=c.cssText),c;if(("selected"==e||"checked"==e)&&V(a)){if(!V(a))throw new k(15,"Element is not selectable");b="selected";c=a.type&&a.type.toLowerCase();if("checkbox"==c||"radio"==c)b="checked";return U(a,b)?"true":null}var g=T(a,"A");if(T(a,"IMG")&&e=="src"||g&&e=="href")return(c=S(a,e))&&(c=U(a,e)),c;if("spellcheck"==e){c=S(a,e);if(c!==null){if(c.toLowerCase()=="false")return"false";if(c.toLowerCase()==
"true")return"true"}return U(a,e)+""}g=ea[b]||b;if(f(fa,e)>=0)return(c=S(a,b)!==null||U(a,g))?"true":null;try{var z=U(a,g)}catch(ha){}(e=z==null)||(e=typeof z,e=e=="object"&&z!=null||e=="function");e?c=S(a,b):c=z;return c!=null?c.toString():null}var X=["se_exportedFunctionSymbol"],Y=d;X[0]in Y||typeof Y.execScript=="undefined"||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());)X.length||W===void 0?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=W;; return this.se_exportedFunctionSymbol.apply(null,arguments);}).apply(window, arguments);};