UNPKG

@browserstack/testcafe

Version:

Automated browser testing for the modern web development stack.

1 lines 78.9 kB
!function ll(cl){var ul=cl.document;!function(l,w,_,n){var o="default"in l?l.default:l,t="default"in w?w.default:w,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function e(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=Math.floor(1399),a="ready",i="ready-for-browser-manipulation",c={click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",setTestSpeed:"set-test-speed",setPageLoadTimeout:"set-page-load-timeout",debug:"debug",assertion:"assertion",useRole:"useRole",testDone:"test-done",backupStorages:"backup-storages",executeExpression:"execute-expression",executeAsyncExpression:"execute-async-expression",unlockPage:"unlock-page",recorder:"recorder"};function u(t){return!(function(t){return t.type===c.executeClientFunction||t.type===c.executeSelector}(r=t)||r.type===c.wait||r.type===c.assertion||r.type===c.executeExpression||h(t)||(n=t).type===c.testDone||n.type===c.showAssertionRetriesStatus||n.type===c.hideAssertionRetriesStatus||n.type===c.setBreakpoint||n.type===c.takeScreenshotOnFail||n.type===c.recorder)||d(t)&&!((e=t).type===c.switchToIframe||e.type===c.switchToMainWindow);var e,n,r}function d(t){return t.type===c.resizeWindow||t.type===c.resizeWindowToFitDevice||t.type===c.maximizeWindow}function h(t){return(e=t).type===c.takeScreenshot||e.type===c.takeElementScreenshot||e.type===c.takeScreenshotOnFail||d(t);var e}function m(t){this.code=t,this.isTestCafeError=!0,this.callsite=null}var f,p="E1",g="E2",v="E3",y="E4",E="E5",C="E6",I="E7",S="E8",T="E9",b="E10",x="E11",D="E12",N="E14",M="E15",P="E16",W="E17",A="E18",R="E19",k="E20",F="E21",O="E22",L="E23",U="E24",H="E26",G="E27",B="E28",V="E29",z="E30",X="E31",j="E32",q="E33",Y="E34",K="E35",J="E36",$="E37",Q="E38",Z="E39",tt="E40",et="E41",nt="E42",rt="E43",it="E44",ot="E45",st="E46",at="E47",lt="E48",ct="E49",ut="E50",dt="E51",ht="E52",mt="E53",ft="E54",pt="E55",gt="E56",vt="E57",yt="E58",wt="E59",_t="E60",Et="E61",Ct="E62",It="E63",St="E64",Tt="E65",bt="E66",xt="E67",Dt="E68",Nt="E69",Mt="E70",Pt="E71",Wt="E72",At=(e(Rt,f=m),Rt);function Rt(t,e,n){var r=f.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var kt,Ft,Ot=(e(Lt,kt=m),Lt);function Lt(t,e,n){var r=kt.call(this,t)||this;return r.argumentName=e,r.actualValue=n,r}function Ut(t){var e=Ft.call(this,S)||this;return e.callsite=t,e}e(Ut,Ft=m);var Ht,Gt=(e(Bt,Ht=m),Bt);function Bt(t){var e=Ht.call(this,ct)||this;return e.instantiationCallsiteName=t,e}var Vt,zt=(e(Xt,Vt=m),Xt);function Xt(t){var e=Vt.call(this,ut)||this;return e.instantiationCallsiteName=t,e}var jt,qt=(e(Yt,jt=m),Yt);function Yt(t,e){var n=e.apiFnChain,r=e.apiFnIndex,i=jt.call(this,t)||this;return i.apiFnChain=n,i.apiFnIndex=r,i}var Kt,Jt=(e($t,Kt=m),$t);function $t(){return Kt.call(this,dt)||this}var Qt,Zt,te=(e(ee,Qt=qt),ee);function ee(t,e){var n=Qt.call(this,ht,e)||this;return n.callsite=t,n}function ne(t,e){var n=Zt.call(this,ft)||this;return n.url=e,n.errMsg=t,n}e(ne,Zt=m);var re,ie,oe,se=(e(ae,re=m),ae);function ae(t,e){var n=re.call(this,p)||this;return n.errStack=t,n.pageDestUrl=e,n}function le(t,e){var n=ie.call(this,g)||this;return n.errMsg=String(t.rawMessage||t),n.callsite=t.callsite||e,n.originError=t,n}function ce(t){var e=oe.call(this,v)||this;return e.objType=typeof t,e.objStr=String(t),e}e(le,ie=m),e(ce,oe=m);var ue,de=(e(he,ue=m),he);function he(t,e){var n=ue.call(this,y)||this;return n.errMsg=String(e),n.instantiationCallsiteName=t,n}var me,fe,pe,ge=(e(ve,me=m),ve);function ve(t,e,n){var r=me.call(this,E,e,n)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}function ye(t){var e=fe.call(this,C)||this;return e.errMsg=String(t),e}function we(t){var e=pe.call(this,I)||this;return e.errMsg=String(t),e}e(ye,fe=m),e(we,pe=m);var _e,Ee=(e(Ce,_e=m),Ce);function Ce(t){var e=_e.call(this,St)||this;return e.errMsg=String(t),e}var Ie,Se,Te,be,xe,De=(e(Ne,Ie=m),Ne);function Ne(t,e){var n=Ie.call(this,Tt)||this;return n.errMsg=String(t),n.moduleName=e,n}function Me(t,e){var n=Se.call(this,mt)||this;return n.errMsg=String(t),n.callsite=e,n}function Pe(t,e,n,r){var i=Te.call(this,wt,t,e)||this;return i.errMsg=r?n.rawMessage:n.message,i.originError=n,i}function We(t){var e=be.call(this,_t)||this;return e.callsite=t,e}function Ae(t){var e=xe.call(this,Et)||this;return e.callsite=t,e}e(Me,Se=m),e(Pe,Te=Ot),e(We,be=m),e(Ae,xe=m);var Re,ke=(e(Fe,Re=At),Fe);function Fe(t,e){return Re.call(this,T,t,e)||this}var Oe,Le=(e(Ue,Oe=At),Ue);function Ue(t,e){return Oe.call(this,b,t,e)||this}var He,Ge,Be=(e(Ve,He=At),Ve);function Ve(t,e){return He.call(this,x,t,e)||this}function ze(t,e){return Ge.call(this,M,t,e)||this}e(ze,Ge=Ot);var Xe,je,qe,Ye,Ke,Je,$e,Qe,Ze,tn,en,nn,rn=(e(on,Xe=At),on);function on(t,e){return Xe.call(this,D,t,e)||this}function sn(t){var e=je.call(this,N)||this;return e.actualType=t,e}function an(t,e){return qe.call(this,P,t,e)||this}function ln(t,e){return Ye.call(this,W,t,e)||this}function cn(t,e){return Ke.call(this,k,t,e)||this}function un(t,e){return Je.call(this,F,t,e)||this}function dn(t,e){return $e.call(this,O,t,e)||this}function hn(t,e){return Qe.call(this,A,t,e)||this}function mn(t,e,n){var r=Ze.call(this,R,t,e)||this;return r.elementIndex=n,r}function fn(t,e){return tn.call(this,at,t,e)||this}function pn(t,e){return en.call(this,Q,t,e)||this}function gn(t,e,n){var r=nn.call(this,L)||this;return r.selectorName=t,r.errMsg=n?e.rawMessage:e.message,r.originError=e,r}e(sn,je=m),e(an,qe=Ot),e(ln,Ye=Ot),e(cn,Ke=Ot),e(un,Je=Ot),e(dn,$e=Ot),e(hn,Qe=Ot),e(mn,Ze=Ot),e(fn,tn=Ot),e(pn,en=Ot),e(gn,nn=m);var vn,yn=(e(wn,vn=qt),wn);function wn(t){return vn.call(this,U,t)||this}var _n,En=(e(Cn,_n=m),Cn);function Cn(){return _n.call(this,H)||this}var In,Sn=(e(Tn,In=m),Tn);function Tn(t){var e=In.call(this,G)||this;return e.nodeDescription=t,e}var bn,xn=(e(Dn,bn=qt),Dn);function Dn(t,e){var n=bn.call(this,B,e)||this;return n.argumentName=t,n}var Nn,Mn=(e(Pn,Nn=m),Pn);function Pn(t){var e=Nn.call(this,V)||this;return e.argumentName=t,e}var Wn,An=(e(Rn,Wn=m),Rn);function Rn(t,e){var n=Wn.call(this,z)||this;return n.argumentName=t,n.nodeDescription=e,n}var kn,Fn=(e(On,kn=m),On);function On(){return kn.call(this,X)||this}var Ln,Un=(e(Hn,Ln=m),Hn);function Hn(){return Ln.call(this,j)||this}var Gn,Bn=(e(Vn,Gn=m),Vn);function Vn(t){var e=Gn.call(this,q)||this;return e.argumentName=t,e}var zn,Xn=(e(jn,zn=m),jn);function jn(){return zn.call(this,K)||this}var qn,Yn=(e(Kn,qn=m),Kn);function Kn(t){var e=qn.call(this,J)||this;return e.argumentName=t,e}var Jn,$n=(e(Qn,Jn=m),Qn);function Qn(t,e){var n=Jn.call(this,$)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var Zn,tr=(e(er,Zn=m),er);function er(){return Zn.call(this,Y)||this}var nr,rr,ir,or,sr=(e(ar,nr=m),ar);function ar(t,e){var n=nr.call(this,et)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}function lr(t,e,n,r,i){var o=rr.call(this,bt)||this;return o.callsite=i,o.expression=e,o.line=n,o.column=r,o.originError=t,o.errMsg=t.message||String(t),o}function cr(t,e,n,r,i){var o=ir.call(this,xt)||this;return o.callsite=i,o.expression=e,o.line=n,o.column=r,o.originError=t,o.errCallsite=t.callsite,o}function ur(t){var e=or.call(this,pt)||this;return e.callsite=t,e}e(lr,rr=m),e(cr,ir=m),e(ur,or=m);var dr,hr,mr,fr=(e(pr,dr=m),pr);function pr(t,e){var n=dr.call(this,vt)||this;return t<=0?e<=0?(n.verb="are",n.dimensions="width and height"):(n.verb="is",n.dimensions="width"):(n.verb="is",n.dimensions="height"),n}function gr(t,e){var n=hr.call(this,gt)||this;return n.screenshotPath=t,n.forbiddenCharsList=e,n}function vr(t){var e=mr.call(this,yt)||this;return e.callsite=t,e}e(gr,hr=m),e(vr,mr=m);var yr,wr=(e(_r,yr=m),_r);function _r(){return yr.call(this,tt)||this}var Er,Cr=(e(Ir,Er=m),Ir);function Ir(){return Er.call(this,Z)||this}var Sr,Tr=(e(br,Sr=m),br);function br(){return Sr.call(this,nt)||this}var xr,Dr=(e(Nr,xr=m),Nr);function Nr(){return xr.call(this,Nt)||this}var Mr,Pr=(e(Wr,Mr=m),Wr);function Wr(){return Mr.call(this,Dt)||this}var Ar,Rr=(e(kr,Ar=m),kr);function kr(){return Ar.call(this,Mt)||this}var Fr,Or=(e(Lr,Fr=m),Lr);function Lr(){return Fr.call(this,Pt)||this}var Ur,Hr=(e(Gr,Ur=m),Gr);function Gr(){return Ur.call(this,rt)||this}var Br,Vr=(e(zr,Br=m),zr);function zr(){return Br.call(this,it)||this}var Xr,jr=(e(qr,Xr=m),qr);function qr(t,e){var n=Xr.call(this,ot)||this;return n.dialogType=t,n.pageUrl=e,n}var Yr,Kr,Jr,$r,Qr=(e(Zr,Yr=m),Zr);function Zr(t,e,n){var r=Yr.call(this,st)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}function ti(t){var e=Kr.call(this,lt)||this;return e.actualType=t,e}function ei(t,e,n){var r=Jr.call(this,It)||this;return r.errMsg=String(t),r.hookClassName=e,r.methodName=n,r}function ni(t,e){var n=$r.call(this,Ct)||this;return n.methodName=t,n.hookClassName=e,n}e(ti,Kr=m),e(ei,Jr=m),e(ni,$r=m);var ri,ii=(e(oi,ri=m),oi);function oi(){return ri.call(this,Wt)||this}var si=(ai.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},ai.prototype.concat=function(e){var n=this;return e&&Object.keys(e).forEach(function(t){n.ensureMessageContainer(t),n[t].log=n[t].log.concat(e[t].log),n[t].info=n[t].info.concat(e[t].info),n[t].warn=n[t].warn.concat(e[t].warn),n[t].error=n[t].error.concat(e[t].error)}),this},ai.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},ai.prototype.getCopy=function(){var e=this,n={};return Object.keys(this).forEach(function(t){n[t]={log:e[t].log.slice(),info:e[t].info.slice(),warn:e[t].warn.slice(),error:e[t].error.slice()}}),n},ai);function ai(t){this.concat(t)}var li=(ci.prototype._getAssignableProperties=function(){throw new Error("Not implemented")},ci.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t)for(var r=this._getAssignableProperties(),i=0;i<r.length;i++){for(var o,s=r[i],a=s.name,l=s.type,c=s.required,u=s.init,d=s.defaultValue,h=a.split("."),m=h.length-1,f=h[m],p=t,g=this,v=0;v<m&&p&&g;v++)p=p[h[v]],g=g[h[v]];g&&"defaultValue"in r[i]&&(g[a]=d),p&&g&&(void 0===(o=p[f])&&!c||(e&&l&&l(a,o),g[f]=u?u(a,o,n):o))}},ci);function ci(){}function ui(){return l.nativeMethods.performanceNow().toString()}var di,hi=(e(mi,di=li),mi.prototype._getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isFirstRequestAfterWindowSwitching"}]},mi);function mi(t){var e=di.call(this,t)||this;return e.id=ui(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isFirstRequestAfterWindowSwitching=!1,e._assignFrom(t,!0),e}var fi,pi=(function(t){function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),n="function"==typeof ArrayBuffer,s="function"==typeof Map,a="function"==typeof Set,l=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],c=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function u(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},u.prototype._handlePlainObject=function(e){var n=this,r=Object.create(null),t=Object.getOwnPropertyNames(e);for(var i in t.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[i]=r[i]},u.prototype._handleTransformedObject=function(t,e,n){var r=t["@t"],i=this.transformMap[r];if(!i)throw new Error("Can't find transform for \""+r+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=i.fromSerializable(t.data)},u.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var r=this.references,i=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===i&&(i=r[t]),i},set:function(t){return i=t}})},u.prototype._handleCircularRef=function(t,e,n){-1<this.activeTransformsStack.indexOf(this.references[t])?this._handleCircularSelfRefDuringTransform(t,e,n):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),e[n]=this.references[t])},u.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var r=t["@r"];if(void 0!==r)this._handleCircularRef(r,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var i=0;i<t.length;i++)this._handleValue(t[i],t,i);else this._handlePlainObject(t)}},u.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var d=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return n&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return c.call(e)},fromSerializable:function(t){if(n){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){for(var n=0;n<l.length;n++){var r=l[n];if("function"==typeof i[r]&&e instanceof i[r])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:c.call(t)}},fromSerializable:function(t){return"function"==typeof i[t.ctorName]?new i[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return s&&e instanceof Map},toSerializable:function(t){var n=[];return t.forEach(function(t,e){n.push(e),n.push(t)}),n},fromSerializable:function(t){if(s){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return a&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(a){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],h=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(d)};h.prototype.addTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},h.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],r=this.transforms.indexOf(n);-1<r&&this.transforms.splice(r,1),delete this.transformsMap[n.type]}return this},h.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},h.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new u(e,this.transformsMap).transform()}}(fi={exports:{}}),fi.exports);function gi(t,e){return new l.nativeMethods.Function("fnCode","__dependencies$","Promise",'"use strict"; return eval(fnCode)')(t,e,l.Promise)}var vi=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],yi=["tagName","attributes"],wi=["tagName","visible","focused","attributes","boundingClientRect","classNames","style","innerText","namespaceURI","id","value","checked","selected","selectedIndex","scrollWidth","scrollHeight","scrollLeft","scrollTop","offsetWidth","offsetHeight","offsetLeft","offsetTop","clientWidth","clientHeight","clientLeft","clientTop"],_i={textContent:function(t){return t.textContent},childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!_i.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!_i.childElementCount(t)}},Ei=(Ci.prototype._initializeProperties=function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r],o=n[i];this[i]=o?o(t):t[i]}},Ci);function Ci(){}var Ii,Si=(e(Ti,Ii=Ei),Ti);function Ti(t){var e=Ii.call(this)||this;return e._initializeProperties(t,vi,_i),e}var bi,xi={tagName:function(t){return t.tagName.toLowerCase()},visible:w.positionUtils.isElementVisible,focused:function(t){return w.domUtils.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},r=e.length-1;0<=r;r--)n[e[r].name]=e[r].value;return n},boundingClientRect:function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width,height:e.height}},classNames:function(t){var e=t.className;return(e="string"==typeof e.animVal?e.animVal:e).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=cl.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Di=(e(Ni,bi=Ei),Ni);function Ni(t){var e=bi.call(this,t)||this;return e._initializeProperties(t,yi,xi),e}var Mi,Pi=(e(Wi,Mi=Si),Wi);function Wi(t){var e=Mi.call(this,t)||this;return e._initializeProperties(t,wi,xi),e}function Ai(t){return t}var Ri=cl.Node;function ki(t){return new pi({serialize:Ai,deserialize:Ai}).addTransforms(t)}var Fi=(Oi.prototype.shouldTransform=function(t){return"function"===t},Oi.prototype.toSerializable=function(){return""},Oi.prototype.fromSerializable=function(t){return gi(t.fnCode,t.dependencies)},Oi);function Oi(){this.type="Function"}var Li=(Ui.prototype.shouldTransform=function(t,e){return e instanceof Ri},Ui.prototype.toSerializable=function(t){return new Di(t)},Ui);function Ui(){this.type="Node"}var Hi=(Gi.prototype._extend=function(t,n){var r=this;o.nativeMethods.objectKeys.call(cl.Object,this.customDOMProperties).forEach(function(e){try{t[e]=r.customDOMProperties[e](n)}catch(t){throw new ge(r.instantiationCallsiteName,t,e)}})},Gi.prototype.shouldTransform=function(t,e){return e instanceof Ri},Gi.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Pi:Si)(t);return this._extend(e,t),e},Gi);function Gi(t){this.type="Node",this.customDOMProperties=t||{}}var Bi=(Vi.prototype.shouldTransform=function(t,e){if(e instanceof Ri)throw new zt(this.instantiationCallsiteName)},Vi);function Vi(t){this.type="Node",this.instantiationCallsiteName=t}var zi=(Xi.prototype.getResult=function(){var e=this;return l.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new de(e.command.instantiationCallsiteName,t)),t})},Xi.prototype.getResultDriverStatus=function(){var e=this;return this.getResult().then(function(t){return new hi({isCommandResult:!0,result:e.replicator.encode(t)})}).catch(function(t){return new hi({isCommandResult:!0,executionError:t})})},Xi.prototype._createReplicator=function(){return ki([new Bi(this.command.instantiationCallsiteName),new Fi])},Xi.prototype._executeFn=function(t){return this.fn.apply(cl,t)},Xi);function Xi(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=gi(this.command.fnCode,this.dependencies)}var ji="appeared-dialog",qi="unexpected-dialog",Yi="handler-error",Ki=o.eventSandbox.message,Ji=o.processScript,$i=o.nativeMethods,Qi="testcafe|native-dialog-tracker|appeared-dialogs",Zi="testcafe|native-dialog-tracker|unexpected-dialog",to="testcafe|native-dialog-tracker|error-in-handler",eo=Ji("window.location.href"),no=(Object.defineProperty(ro.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Qi);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Qi,t)},enumerable:!0,configurable:!0}),Object.defineProperty(ro.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Zi)},set:function(t){this.contextStorage.setItem(Zi,t)},enumerable:!0,configurable:!0}),Object.defineProperty(ro.prototype,"handlerError",{get:function(){return this.contextStorage.getItem(to)},set:function(t){this.contextStorage.setItem(to,t)},enumerable:!0,configurable:!0}),ro._getPageUrl=function(){return $i.eval(eo)},ro.prototype._initListening=function(){var n=this;Ki.on(Ki.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===ji?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==qi||n.unexpectedDialog?e.type!==Yi||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},ro.prototype._init=function(){var e=this;o.on(o.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),cl.alert=function(){return e._defaultDialogHandler("alert")},cl.confirm=function(){return e._defaultDialogHandler("confirm")},cl.prompt=function(){return e._defaultDialogHandler("prompt")}},ro.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=ro._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new zi(o.dialogHandler),r=null;try{r=n.fn.apply(cl,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},ro.prototype._defaultDialogHandler=function(t){var e=ro._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},ro.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},ro.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},ro.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){cl[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},ro.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new jr(t.type,t.url):e?new Qr(e.type,e.message,e.url):null},ro);function ro(t,e){this.contextStorage=t,this.dialogHandler=e,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(e)}function io(t){this.type=t,this.id=ui()}var oo,so="driver|establish-connection",ao="driver|command-executed",lo="driver|execute-command",co="driver|confirmation",uo="driver|set-native-dialog-handler",ho="driver|set-as-master",mo="driver|close-all-child-windows",fo=(e(po,oo=io),po);function po(){return oo.call(this,so)||this}var go,vo=(e(yo,go=io),yo);function yo(t){var e=go.call(this,ao)||this;return e.driverStatus=t,e}var wo,_o=(e(Eo,wo=io),Eo);function Eo(t,e){var n=wo.call(this,lo)||this;return n.command=t,n.testSpeed=e,n}var Co,Io=(e(So,Co=io),So);function So(t,e){var n=Co.call(this,co)||this;return n.requestMessageId=t,n.result=e,n}var To,bo=(e(xo,To=io),xo);function xo(t){var e=To.call(this,uo)||this;return e.dialogHandler=t,e}var Do,No=(e(Mo,Do=io),Mo);function Mo(){return Do.call(this,ho)||this}var Po,Wo=(e(Ao,Po=io),Ao);function Ao(){return Po.call(this,mo)||this}var Ro=o.json,ko=o.nativeMethods,Fo=(Oo.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},Oo.prototype._loadFromStorage=function(){var t=this.storage.getItem(this.storageKey);t&&(this.data=Ro.parse(t),this.storage.removeItem(this.storageKey))},Oo.prototype.save=function(){this.storage.setItem(this.storageKey,Ro.stringify(this.data))},Oo.prototype.setItem=function(t,e){this.data[t]=e,this.save()},Oo.prototype.getItem=function(t){return this.data[t]},Oo.prototype.dispose=function(){this.storage.removeItem(this.storageKey)},Oo);function Oo(t,e,n){this.storage=ko.winSessionStorageGetter.call(t),this.storageKey=this._createStorageKey(e,n),this.data={},this._loadFromStorage()}function Lo(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),l.Promise.race([w.delay(e),new l.Promise(function(e){s=function(t){t.message.type===co&&t.message.requestMessageId===n.id&&e(t.message)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=l.nativeMethods.setInterval.call(cl,function(){return l.eventSandbox.message.sendServiceMsg(n,t)},1e3),l.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(l.nativeMethods.clearInterval.call(cl,i),l.nativeMethods.clearTimeout.call(cl,o),l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}function Uo(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new Io(e,n);l.eventSandbox.message.sendServiceMsg(i,r)}var Ho=(Object.defineProperty(Go.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!0,configurable:!0}),Go.prototype._ensureIframe=function(){var t=this;return w.domUtils.isElementInDocument(this.driverIframe)?w.waitFor(function(){return w.positionUtils.isElementVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Vr}):l.Promise.reject(new Hr)},Go.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new l.Promise(function(t){e.checkIframeInterval=l.nativeMethods.setInterval.call(cl,function(){e._ensureIframe().catch(function(){return w.delay(500).then(function(){return t(new hi({isCommandResult:!0}))})})},1e3)})},Go.prototype._waitForCommandResult=function(){var e=this,n=null;return l.Promise.race([this._waitForIframeRemovedOrHidden(),new l.Promise(function(e){n=function(t){t.message.type===ao&&e(t.message.driverStatus)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),l.nativeMethods.clearInterval.call(cl,e.checkIframeInterval),t})},Go.prototype.sendConfirmationMessage=function(t){Uo({requestMsgId:t,result:{id:this.driverId},window:this.driverWindow})},Go.prototype.executeCommand=function(e,n){var r=this;return this._ensureIframe().then(function(){var t=new _o(e,n);return l.Promise.all([Lo(t,r.driverWindow,r.iframeAvailabilityTimeout,Tr),r._waitForCommandResult()])}).then(function(t){return t[1]})},Go);function Go(t,e){this.driverWindow=t,this.driverIframe=w.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0}var Bo=o.Promise,Vo=o.nativeMethods,zo=(Xo.prototype._onScriptElementAdded=function(t){var e,n,r=this,i=Vo.scriptSrcGetter.call(t);void 0!==i&&""!==i&&(this.scriptsCount++,e=null,n=function(){Vo.removeEventListener.call(t,"load",n),Vo.removeEventListener.call(t,"error",n),Vo.clearTimeout.call(cl,e),r._onScriptLoadedOrFailed()},Vo.addEventListener.call(t,"load",n),Vo.addEventListener.call(t,"error",n),e=Vo.setTimeout.call(cl,n,this.SCRIPT_LOADING_TIMEOUT))},Xo.prototype._onScriptLoadedOrFailed=function(){var t=this;this.scriptsCount--,this.scriptsCount||w.delay(25).then(function(){t.resolveWaitingPromise&&(t.scriptsCount||t.resolveWaitingPromise())})},Xo.prototype.wait=function(){var n=this;return new Bo(function(t){function e(){Vo.clearTimeout.call(cl,n.watchdog),o.off(o.EVENTS.scriptElementAdded,n.scriptElementAddedHandler),n.watchdog=null,n.resolveWaitingPromise=null,t()}n.scriptsCount?(n.watchdog=Vo.setTimeout.call(cl,e,n.BARRIER_TIMEOUT),n.resolveWaitingPromise=e):e()})},Xo);function Xo(){var e=this;this.watchdog=null,this.SCRIPT_LOADING_TIMEOUT=2e3,this.BARRIER_TIMEOUT=3e3,this.scriptsCount=0,this.resolveWaitingPromise=null,this.scriptElementAddedHandler=function(t){return e._onScriptElementAdded(t.el)},o.on(o.EVENTS.scriptElementAdded,this.scriptElementAddedHandler)}function jo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new w.RequestBarrier,i=new zo;w.pageUnloadBarrier.watchForPageNavigationTriggers();var o=null,s=t.apply(void 0,e),a=s.then(function(t){return o=t,l.Promise.all([r.wait().then(function(){return i.wait()}),w.pageUnloadBarrier.wait()])}).then(function(){return o});return{actionPromise:s,barriersPromise:a}}var qo,Yo=Array.isArray,Ko=cl.Node,Jo=cl.HTMLCollection,$o=cl.NodeList;function Qo(t){return!!t}function Zo(t){return!(!w.domUtils.isDomElement(t)&&!w.domUtils.isTextNode(t))&&(w.domUtils.isOptionElement(t)||"optgroup"===w.domUtils.getTagName(t)?n.selectElement.isOptionElementVisible(t):w.positionUtils.isElementVisible(t))}function ts(t){return t instanceof Jo||t instanceof $o||function(t){if(Yo(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof Ko))return;return 1}}(t)}var es=t.arrayUtils,ns=o.utils.types,rs=o.nativeMethods,is=1,os=2,ss=3,as=((qo={})[is]=/^\.filterVisible\(\)$/,qo[os]=/^\.filterHidden\(\)$/,qo[ss]=/^\.nth\(\d+\)$/,qo),ls=(Object.defineProperty(cs.prototype,"error",{get:function(){return this.err},set:function(t){null===this.err&&(this.err=t)},enumerable:!0,configurable:!0}),cs.prototype.filter=function(t,e,n){var r,i=es.filter(t,Qo);return e.filterVisible&&(i=i.filter(Zo),this.assertFilterError(i,n,is)),e.filterHidden&&(i=i.filter(function(t){return!Zo(t)}),this.assertFilterError(i,n,os)),e.counterMode?i=null!==e.index?this.getNodeByIndex(i,e.index)?1:0:i.length:(e.collectionMode?null!==e.index&&(i=(r=this.getNodeByIndex(i,e.index))?[r]:[]):i=this.getNodeByIndex(i,e.index||0),"number"==typeof e.index&&this.assertFilterError(i,n,ss)),i},cs.prototype.cast=function(t){var e=null;if(ns.isNullOrUndefined(t))e=[];else if(t instanceof Node)e=[t];else{if(!ts(t))throw new Jt;e=t}return e},cs.prototype.assertFilterError=function(t,e,n){t&&0!==t.length||(this.error=this.getErrorItem(e,n))},cs.prototype.getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(as[e].test(n[i]))return i;return null},cs.prototype.getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},cs);function cs(){this.err=null}rs.objectDefineProperty.call(cl,cl,"%testCafeSelectorFilter%",{value:new ls,configurable:!0});var us,ds=(e(hs,us=zi),hs.prototype._createReplicator=function(){return ki([new Fi])},hs.prototype._getTimeoutErrorParams=function(){var t=cl["%testCafeSelectorFilter%"].error,e=this.command.apiFnChain;return void 0!==t?{apiFnIndex:t,apiFnChain:e}:null},hs.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},hs.prototype._validateElement=function(o,s){var a=this;return l.Promise.resolve().then(function(){return a.fn.apply(cl,o)}).then(function(t){var e=!!t,n=!a.command.visibilityCheck||Zo(t),r=new Date-s>=a.timeout;if(e&&n)return t;if(!r)return w.delay(200).then(function(){return a._validateElement(o,s)});var i=a.getVisibleValueMode?null:a._getTimeoutError(e);if(i)throw i(a._getTimeoutErrorParams());return null})},hs.prototype._executeFn=function(t){if(this.counterMode)return us.prototype._executeFn.call(this,t);var e=new Date,n=null,r=null;return this._validateElement(t,e).catch(function(t){n=t}).then(function(t){if(n)throw n;r=t}).then(function(){return r})},hs);function hs(t,e,n,r,i){var o,s=us.call(this,t)||this;s.createNotFoundError=r,s.createIsInvisibleError=i,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,n&&(o=new Date-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies&&s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Hi(a)]),s}var ms=(fs.prototype._ensureElement=function(t){var e=this,n=t.selector,r=t.createNotFoundError,i=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new ds(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!w.domUtils.isDomElement(t))throw o(w.NODE_TYPE_DESCRIPTIONS[t.nodeType]);e.elements.push(t)})},fs.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},fs);function fs(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=l.Promise.resolve(),this.ensureElementsStartTime=new Date,t.forEach(function(t){return n._ensureElement(t)})}function ps(t,e){return new ms(t,e).getElements()}function gs(t){return{selector:t,createNotFoundError:function(t){return new yn(t)},createIsInvisibleError:function(){return new En},createHasWrongNodeTypeError:function(t){return new Sn(t)}}}function vs(t,e){return{selector:t,createNotFoundError:function(t){return new xn(e,t)},createIsInvisibleError:function(){return new Mn(e)},createHasWrongNodeTypeError:function(t){return new An(e,t)}}}function ys(t,e){if(!w.domUtils.isContentEditableElement(t))throw new Bn(e)}var ws=(_s.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},_s.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?w.delay(2e3*(1-this.command.options.speed)):l.Promise.resolve()},_s.prototype._isExecutionTimeoutExpired=function(){return Date.now()-this.executionStartTime>=this.commandSelectorTimeout},_s.prototype._ensureCommandArguments=function(){if(this.command.type===c.pressKey&&w.parseKeySequence(this.command.keys).error)throw new Yn("keys")},_s.prototype._ensureCommandElements=function(){var e=this,t=[];return this.command.selector&&t.push(gs(this.command.selector)),this.command.type===c.dragToElement?t.push(vs(this.command.destinationSelector,"destinationSelector")):this.command.type===c.selectEditableContent&&(t.push(vs(this.command.startSelector,"startSelector")),t.push(vs(this.command.endSelector||this.command.startSelector,"endSelector"))),ps(t,this.globalSelectorTimeout).then(function(t){e.elements=t})},_s.prototype._ensureCommandElementsProperties=function(){this.command.type===c.selectText?function(t){if(!w.domUtils.isEditableElement(t))throw new Fn}(this.elements[0]):this.command.type===c.selectTextAreaContent?function(t){if(!w.domUtils.isTextAreaElement(t))throw new Un}(this.elements[0]):this.command.type===c.selectEditableContent?(ys(this.elements[0],"startSelector"),ys(this.elements[1],"endSelector"),function(t){if(!w.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Xn}(this.elements)):this.command.type!==c.setFilesToUpload&&this.command.type!==c.clearUpload||function(t){if(!w.domUtils.isFileInput(t))throw new tr}(this.elements[0])},_s.prototype._ensureCommandOptions=function(){var t,e,n,r,i;this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&(t=this.elements[0],e=this.command.options,n=_.getOffsetOptions(t,e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.offsetX=r,e.offsetY=i)},_s.prototype._createAutomation=function(){var t=null;switch(this.command.type){case c.click:return/option|optgroup/.test(w.domUtils.getTagName(this.elements[0]))?new _.SelectChildClick(this.elements[0],this.command.options):new _.Click(this.elements[0],this.command.options);case c.rightClick:return new _.RClick(this.elements[0],this.command.options);case c.doubleClick:return new _.DblClick(this.elements[0],this.command.options);case c.hover:return new _.Hover(this.elements[0],this.command.options);case c.drag:return new _.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case c.dragToElement:return new _.DragToElement(this.elements[0],this.elements[1],this.command.options);case c.typeText:return new _.Type(this.elements[0],this.command.text,this.command.options);case c.selectText:case c.selectTextAreaContent:return t=_.calculateSelectTextArguments(this.elements[0],this.command),new _.SelectText(this.elements[0],t.startPos,t.endPos,this.command.options);case c.selectEditableContent:return new _.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case c.pressKey:return new _.Press(w.parseKeySequence(this.command.keys).combinations,this.command.options);case c.setFilesToUpload:return new _.Upload(this.elements[0],this.command.filePath,function(t,e){return new $n(t,e)});case c.clearUpload:return new _.Upload(this.elements[0])}return null},_s.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){n._ensureCommandOptions();var t=n._createAutomation();return t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n.targetElement=t.element,n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()}):(n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()),t.run(e)})},_s.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return w.promiseUtils.whilst(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(e._isExecutionTimeoutExpired()){if(t.message===_.ERROR_TYPES.foundElementIsNotTarget)return n=!1,l.Promise.resolve();throw t.message===_.ERROR_TYPES.elementIsInvisibleError?new En:t}return w.delay(250)})})},_s.prototype.execute=function(){var i=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new l.Promise(function(t){i.executionStartedHandler=t}),completionPromise:new l.Promise(function(n){i.executionStartTime=new Date;try{i._ensureCommandArguments()}catch(t){return void n(new hi({isCommandResult:!0,executionError:t}))}i.commandSelectorTimeout=i._getSpecificTimeout(),i.statusBar.showWaitingElementStatus(i.commandSelectorTimeout);var t=jo(function(){return i._runRecursively()}),e=t.actionPromise,r=t.barriersPromise;e.then(function(){return l.Promise.all([i._delayAfterExecution(),r])}).then(function(){var t={isCommandResult:!0},e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(i.elements);i.targetElement&&(e[0]=i.targetElement),t.result=ki(new Li).encode(e),n(new hi(t))}).catch(function(t){return i.statusBar.hideWaitingElementStatus(!1).then(function(){return n(new hi({isCommandResult:!0,executionError:t}))})})})}},_s);function _s(t,e,n,r){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.testSpeed=r,this.targetElement=null,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}function Es(t,e,n){return Math.min(Math.max(e,t),n)}function Cs(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=Es(t.length,0,e)),n&&t.min<0&&(t.min+=e),r&&t.max<0&&(t.max+=e),n||(t.min=r&&i?t.max-t.length:0),r||(t.max=i?t.min+t.length:e),t.min=Es(t.min,0,e),t.max=Es(t.max,0,e),t.length=t.max-t.min,t}function Is(t,e,n){return Math.round(t+Es(e-t,0,n)/2)}function Ss(r){return function(t,e){var n=typeof e;if("number"!=n)throw new r(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new r(t,e)}}var Ts,bs,xs,Ds,Ns,Ms=Ss(ke),Ps=(bs=Ss(Ts=Le),function(t,e){if(bs(t,e),e<0)throw new Ts(t,e)}),Ws=(xs=Be,function(t,e){var n=typeof e;if("boolean"!=n)throw new xs(t,n)}),As=(Ds=rn,function(t,e){var n=typeof e;if("number"!=n)throw new Ds(t,n);if(isNaN(e)||e<.01||1<e)throw new Ds(t,e)}),Rs=(e(ks,Ns=li),ks.prototype._getAssignableProperties=function(){return[{name:"speed",type:As}]},ks);function ks(t,e){var n=Ns.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var Fs,Os=(e(Ls,Fs=Rs),Ls.prototype._getAssignableProperties=function(){return Fs.prototype._getAssignableProperties.call(this).concat([{name:"offsetX",type:Ms},{name:"offsetY",type:Ms}])},Ls);function Ls(t,e){var n=Fs.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var Us,Hs=(e(Gs,Us=Os),Gs.prototype._getAssignableProperties=function(){return Us.prototype._getAssignableProperties.call(this).concat([{name:"scrollToCenter",type:Ws},{name:"skipParentFrames",type:Ws}])},Gs);function Gs(t,e){var n=Us.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var Bs,Vs=(e(zs,Bs=Rs),zs.prototype._getAssignableProperties=function(){return Bs.prototype._getAssignableProperties.call(this).concat([{name:"scrollTargetX",type:Ms},{name:"scrollTargetY",type:Ms},{name:"crop.left",type:Ms},{name:"crop.right",type:Ms},{name:"crop.top",type:Ms},{name:"crop.bottom",type:Ms},{name:"includeMargins",type:Ws},{name:"includeBorders",type:Ws},{name:"includePaddings",type:Ws}])},zs);function zs(t,e){var n=Bs.call(this)||this;return n.scrollTargetX=null,n.scrollTargetY=null,n.includeMargins=!1,n.includeBorders=!0,n.includePaddings=!0,n.crop={left:null,right:null,top:null,bottom:null},n._assignFrom(t,e),n}var Xs,js=(e(qs,Xs=Os),qs.prototype._getAssignableProperties=function(){return Xs.prototype._getAssignableProperties.call(this).concat([{name:"modifiers.ctrl",type:Ws},{name:"modifiers.alt",type:Ws},{name:"modifiers.shift",type:Ws},{name:"modifiers.meta",type:Ws}])},qs);function qs(t,e){var n=Xs.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var Ys,Ks,Js,$s,Qs,Zs,ta=(e(ea,Ys=js),ea.prototype._getAssignableProperties=function(){return Ys.prototype._getAssignableProperties.call(this).concat([{name:"caretPos",type:Ps}])},ea);function ea(t,e){var n=Ys.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}function na(t,e){var n=Ks.call(this)||this;return n.speed=null,n.minMovingTime=null,n.holdLeftButton=!1,n.skipScrolling=!1,n.skipDefaultDragBehavior=!1,n._assignFrom(t,e),n}function ra(t,e){var n=Js.call(this)||this;return n.replace=!1,n.paste=!1,n._assignFrom(t,e),n}function ia(t,e){var n=$s.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function oa(t,e){var n=Qs.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function sa(t,e){var n=Zs.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}e(na,Ks=js),na.prototype._getAssignableProperties=function(){return Ks.prototype._getAssignableProperties.call(this).concat([{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:Ws},{name:"skipDefaultDragBehavior",type:Ws}])},e(ra,Js=ta),ra.prototype._getAssignableProperties=function(){return Js.prototype._getAssignableProperties.call(this).concat([{name:"replace",type:Ws},{name:"paste",type:Ws}])},e(ia,$s=js),ia.prototype._getAssignableProperties=function(){return $s.prototype._getAssignableProperties.call(this).concat([{name:"destinationOffsetX",type:Ms},{name:"destinationOffsetY",type:Ms}])},e(oa,Qs=li),oa.prototype._getAssignableProperties=function(){return[{name:"portraitOrientation",type:Ws}]},e(sa,Zs=li),sa.prototype._getAssignableProperties=function(){return[{name:"timeout",type:Ps},{name:"allowUnawaitedPromise",type:Ws}]};var aa=l.eventSandbox.message,la="driver|browser-manipulation|request",ca="driver|browser-manipulation|response";aa.on(aa.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===la&&(t=w.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new Vs({crop:i,includePaddings:!1})),(o=new ua(r)).element=t,o.execute().then(function(t){return aa.sendServiceMsg({cmd:ca,result:t},e.source)}))});var ua=(da.prototype._getAbsoluteCropValues=function(){var t=this.element.getBoundingClientRect(),e=t.top,n=t.left;n+=this.command.options.originOffset.x,e+=this.command.options.originOffset.y;var r=n+this.command.options.crop.right,i=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:i,right:r}},da.prototype._createManipulationReadyMessage=function(){var t=cl.devicePixelRatio||1,e={cmd:i,pageDimensions:{dpr:t,innerWidth:cl.innerWidth,innerHeight:cl.innerHeight,documentWidth:ul.documentElement.clientWidth,documentHeight:ul.documentElement.clientHeight,bodyWidth:ul.body.clientWidth,bodyHeight:ul.body.clientHeight},disableResending:!0};return this.command.type===c.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},da.prototype._runScrollBeforeScreenshot=function(){var i=this;return l.Promise.resolve().then(function(){if(i.element||!i.command.selector)return l.Promise.resolve();var t=i.command.selector.timeout,e="number"==typeof t?t:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(e),ps([gs(i.command.selector)],i.globalSelectorTimeout).then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){!function(t,e){var n=t.getBoundingClientRect(),r={left:n.left,right:n.right,top:n.top,bottom:n.bottom},i=w.styleUtils.getElementMargin(t),o=w.styleUtils.getElementPadding(t),s=w.styleUtils.getBordersWidth(t);e.originOffset={x:0,y:0};var a=r.left+t.scrollWidth+s.left+s.right,l=r.top+t.scrollHeight+s.top+s.bottom;r.right=Math.max(r.right,a),r.bottom=Math.max(r.bottom,l),e.includeBorders&&e.includePaddings?e.includeMargins&&(e.originOffset.x-=i.left,e.originOffset.y-=i.top,r.left-=i.left,r.top-=i.top,r.right+=i.right,r.bottom+=i.bottom):(e.originOffset.x+=s.left,e.originOffset.y+=s.top,r.left+=s.left,r.top+=s.top,r.right-=s.right,r.bottom-=s.bottom,e.includePaddings||(e.originOffset.x+=o.left,e.originOffset.y+=o.top,r.left+=o.left,r.top+=o.top,r.right-=o.right,r.bottom-=o.bottom)),r.width=r.right-r.left,r.height=r.bottom-r.top;var c=Cs({min:e.crop.left,max:e.crop.right,length:e.crop.width},r.width),u=Cs({min:e.crop.top,max:e.crop.bottom,length:e.crop.height},r.height);if(e.crop.left=c.min,e.crop.right=c.max,e.crop.width=c.length,e.crop.top=u.min,e.crop.bottom=u.max,e.crop.height=u.length,e.crop.width<=0||e.crop.height<=0)throw new fr(e.crop.width,e.crop.height);var d=w.styleUtils.getViewportDimensions();(r.width>d.width||r.height>d.height)&&(e.scrollToCenter=!0);var h="number"==typeof e.scrollTargetX,m="number"==typeof e.scrollTargetY;h||(e.scrollTargetX=Is(e.crop.left,e.crop.right,d.width)),m||(e.scrollTargetY=Is(e.crop.top,e.crop.bottom,d.height));var f=_.getOffsetOptions(t,e.scroll