selenium-atoms
Version:
7 lines • 5.01 kB
JavaScript
function(){return function(){var b=this,d=Date.now||function(){return+new Date};function k(a,e){this.code=a;this.a=m[a]||n;this.message=e||"";var c=this.a.replace(/((?:^|\s+)[a-z])/g,function(a){return a.toUpperCase().replace(/^[\s\xa0]+/g,"")}),g=c.length-5;if(0>g||c.indexOf("Error",g)!=g)c+="Error";this.name=c;c=Error(this.message);c.name=this.name;this.stack=c.stack||""}
(function(){var a=Error;function e(){}e.prototype=a.prototype;k.c=a.prototype;k.prototype=new e;k.prototype.constructor=k;k.a=function(c,e,f){for(var h=Array(arguments.length-2),l=2;l<arguments.length;l++)h[l-2]=arguments[l];return a.prototype[e].apply(c,h)}})();var n="unknown error",m={15:"element not selectable",11:"element not visible"};m[31]=n;m[30]=n;m[24]="invalid cookie domain";m[29]="invalid element coordinates";m[12]="invalid element state";m[32]="invalid selector";m[51]="invalid selector";
m[52]="invalid selector";m[17]="javascript error";m[405]="unsupported operation";m[34]="move target out of bounds";m[27]="no such alert";m[7]="no such element";m[8]="no such frame";m[23]="no such window";m[28]="script timeout";m[33]="session not created";m[10]="stale element reference";m[21]="timeout";m[25]="unable to set cookie";m[26]="unexpected alert open";m[13]=n;m[9]="unknown command";k.prototype.toString=function(){return this.name+": "+this.message};var p=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
function q(a,e){for(var c=0,g=p(String(a)).split("."),f=p(String(e)).split("."),h=Math.max(g.length,f.length),l=0;0==c&&l<h;l++){var aa=g[l]||"",ba=f[l]||"",ca=RegExp("(\\d*)(\\D*)","g"),da=RegExp("(\\d*)(\\D*)","g");do{var t=ca.exec(aa)||["","",""],u=da.exec(ba)||["","",""];if(0==t[0].length&&0==u[0].length)break;c=r(0==t[1].length?0:parseInt(t[1],10),0==u[1].length?0:parseInt(u[1],10))||r(0==t[2].length,0==u[2].length)||r(t[2],u[2])}while(0==c)}return c}function r(a,e){return a<e?-1:a>e?1:0};var v;a:{var w=b.navigator;if(w){var x=w.userAgent;if(x){v=x;break a}}v=""}function y(a){return-1!=v.indexOf(a)};function z(){return y("Opera")||y("OPR")}function A(){return(y("Chrome")||y("CriOS"))&&!z()&&!y("Edge")};function B(){return y("iPhone")&&!y("iPod")&&!y("iPad")};var C=z(),D=y("Trident")||y("MSIE"),E=y("Edge"),F=y("Gecko")&&!(-1!=v.toLowerCase().indexOf("webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),G=-1!=v.toLowerCase().indexOf("webkit")&&!y("Edge");function ea(){var a=v;if(F)return/rv\:([^\);]+)(\)|;)/.exec(a);if(E)return/Edge\/([\d\.]+)/.exec(a);if(D)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(G)return/WebKit\/(\S+)/.exec(a)}function H(){var a=b.document;return a?a.documentMode:void 0}
var I=function(){if(C&&b.opera){var a;var e=b.opera.version;try{a=e()}catch(c){a=e}return a}a="";(e=ea())&&(a=e?e[1]:"");return D&&(e=H(),e>parseFloat(a))?String(e):a}(),J={},K=b.document,L=K&&D?H()||("CSS1Compat"==K.compatMode?parseInt(I,10):5):void 0;var fa=y("Firefox"),ga=B()||y("iPod"),ha=y("iPad"),M=y("Android")&&!(A()||y("Firefox")||z()||y("Silk")),ia=A(),N=y("Safari")&&!(A()||y("Coast")||z()||y("Edge")||y("Silk")||y("Android"))&&!(B()||y("iPad")||y("iPod"));function O(a){return(a=a.exec(v))?a[1]:""}var ja=function(){if(fa)return O(/Firefox\/([0-9.]+)/);if(D||E||C)return I;if(ia)return O(/Chrome\/([0-9.]+)/);if(N&&!(B()||y("iPad")||y("iPod")))return O(/Version\/([0-9.]+)/);if(ga||ha){var a;if(a=/Version\/(\S+).*Mobile\/(\S+)/.exec(v))return a[1]+"."+a[2]}else if(M)return(a=O(/Android\s+([0-9.]+)/))?a:O(/Version\/([0-9.]+)/);return""}();var P,Q;function R(a){S?Q(a):M?q(ka,a):q(ja,a)}var S=function(){if(!F)return!1;var a=b.Components;if(!a)return!1;try{if(!a.classes)return!1}catch(e){return!1}var c=a.classes,a=a.interfaces,g=c["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),c=c["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo),f=c.platformVersion,h=c.version;P=function(a){return 0<=g.compare(f,""+a)};Q=function(a){g.compare(h,""+a)};return!0}(),T;
if(M){var U=/Android\s+([0-9\.]+)/.exec(v);T=U?U[1]:"0"}else T="0";var ka=T;M&&R(2.3);M&&R(4);N&&R(6);G||F&&(S?P(3.5):D?0<=q(L,3.5):J[3.5]||(J[3.5]=0<=q(I,3.5)))||D&&(S?P(8):D?q(L,8):J[8]||(J[8]=0<=q(I,8)));function V(a,e){a=decodeURIComponent(a);var c=e||document,g;g=c||document;var f=g.$wdc_;f||(f=g.$wdc_={},f.b=d());f.b||(f.b=d());g=f;if(!(null!==g&&a in g))throw new k(10,"Element does not exist in cache");f=g[a];if(null!==f&&"setInterval"in f){if(f.closed)throw delete g[a],new k(23,"Window has been closed.");return f}for(var h=f;h;){if(h==c.documentElement)return f;h=h.parentNode}delete g[a];throw new k(10,"Element is no longer attached to the DOM");}var W=["_"],X=b;
W[0]in X||!X.execScript||X.execScript("var "+W[0]);for(var Y;W.length&&(Y=W.shift());){var Z;if(Z=!W.length)Z=void 0!==V;Z?X[Y]=V:X[Y]?X=X[Y]:X=X[Y]={}};; return this._.apply(null,arguments);}.apply({navigator:typeof window!=undefined?window.navigator:null,document:typeof window!=undefined?window.document:null}, arguments);}