testcafe 3.5.0 → 3.6.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.
- package/lib/api/test-controller/index.js +6 -1
- package/lib/browser/connection/index.js +4 -1
- package/lib/browser/provider/built-in/dedicated/chrome/build-chrome-args.js +4 -3
- package/lib/browser/provider/built-in/dedicated/chrome/index.js +6 -6
- package/lib/browser/provider/built-in/dedicated/chrome/local-chrome.js +2 -2
- package/lib/browser/provider/index.js +4 -1
- package/lib/browser/provider/plugin-host.js +4 -1
- package/lib/client/driver/index.js +1 -0
- package/lib/client/driver/index.min.js +1 -1
- package/lib/client/ui/index.js +1 -1
- package/lib/client/ui/index.min.js +1 -1
- package/lib/compiler/compilers.js +3 -3
- package/lib/compiler/esm-loader.js +2 -2
- package/lib/compiler/index.js +3 -3
- package/lib/native-automation/request-pipeline/index.js +11 -6
- package/lib/native-automation/resource-injector.js +7 -7
- package/lib/native-automation/utils/headers.js +6 -2
- package/lib/native-automation/utils/string.js +10 -7
- package/lib/screenshots/constants.js +2 -2
- package/lib/test-run/commands/actions.js +9 -2
- package/lib/test-run/commands/type.js +2 -1
- package/lib/test-run/index.js +6 -1
- package/package.json +9 -6
- package/ts-defs/index.d.ts +10 -0
- package/ts-defs/selectors.d.ts +10 -0
- package/ts-defs/testcafe-scripts.d.ts +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
window["%hammerhead%"].utils.removeInjectedScript(),function Wc(bc){var Tc=bc.document;!function(c,e,_,E,n){var s="default"in c?c.default:c;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var o="default"in n?n.default:n,i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function l(t,s,a,l){return new(a=a||e)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function r(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}o((l=l.apply(t,s||[])).next())})}function C(n,i){var r,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},l={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function t(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;l&&e[l=0]&&(a=0),a;)try{if(r=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=i.call(n,a)}catch(t){e=[6,t],o=0}finally{r=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var r,a,u=Math.floor(399);(a=r=r||{}).ready="ready",a.readyForBrowserManipulation="ready-for-browser-manipulation",a.waitForFileDownload="wait-for-file-download";var d=r,h={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",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",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",getActiveElement:"get-active-element",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",closeChildWindowOnFileDownloading:"close-child-window-on-file-downloading",recorder:"recorder",prepareClientEnvironmentInDebugMode:"prepare-client-environment-in-debug-mode",getCookies:"get-cookies",setCookies:"set-cookies",deleteCookies:"delete-cookies",getProxyUrl:"get-proxy-url",request:"request",skipJsErrors:"skip-js-errors",addRequestHooks:"add-request-hooks",removeRequestHooks:"remove-request-hooks",runCustomAction:"run-custom-action",report:"report"};function p(t){return!(f(i=t)||i.type===h.wait||i.type===h.assertion||i.type===h.executeExpression||g(t)||(n=t).type===h.testDone||n.type===h.showAssertionRetriesStatus||n.type===h.hideAssertionRetriesStatus||n.type===h.setBreakpoint||n.type===h.takeScreenshotOnFail||n.type===h.recorder||n.type===h.getProxyUrl)||m(t)&&!((e=t).type===h.switchToIframe||e.type===h.switchToMainWindow);var e,n,i}function f(t){return t.type===h.executeClientFunction||t.type===h.executeSelector}function m(t){return t.type===h.resizeWindow||t.type===h.resizeWindowToFitDevice||t.type===h.maximizeWindow}function g(t){return(e=t).type===h.takeScreenshot||e.type===h.takeElementScreenshot||e.type===h.takeScreenshotOnFail||m(t);var e}function v(t,e){this.code=t,this.isTestCafeError=!0,this.callsite=e||null}var w,y="step",I="E1",S="E4",A="E5",W="E9",b="E10",T="E11",N="E12",R="E24",x="E26",D="E27",P="E28",M="E29",F="E30",O="E31",k="E32",L="E33",U="E34",H="E35",G="E36",B="E37",V="E39",q="E40",z="E41",X="E42",j="E43",Y="E44",J="E45",K="E46",$="E49",Q="E50",Z="E51",tt="E52",et="E57",nt="E64",it="E65",rt="E68",ot="E69",st="E70",at="E71",lt="E72",ut="E73",ct="E74",dt="E76",ht="E77",pt="E78",ft="E82",mt="E83",gt="E90",vt="E91",wt="E92",yt="E93",_t="E94",Et="E95",Ct="E97",It="E99",St="E100",At="E101",Wt="E102",bt=(t(Tt,w=v),Tt);function Tt(t,e,n){var i=w.call(this,t)||this;return i.optionName=e,i.actualValue=n,i}var Nt,Rt=(t(xt,Nt=v),xt);function xt(t,e){var n=Nt.call(this,$,e)||this;return n.instantiationCallsiteName=t,n}var Dt,Pt=(t(Mt,Dt=v),Mt);function Mt(t,e){var n=Dt.call(this,Q,e)||this;return n.instantiationCallsiteName=t,n}var Ft,Ot=(t(kt,Ft=v),kt);function kt(t,e,n){var i=void 0===e?{}:e,r=i.apiFnChain,o=i.apiFnIndex,s=i.reason,a=Ft.call(this,t,n)||this;return a.apiFnChain=r,a.apiFnIndex=o,a.reason=s,a}var Lt,Ut=(t(Ht,Lt=v),Ht);function Ht(t){return Lt.call(this,Z,t)||this}var Gt,Bt=(t(Vt,Gt=Ot),Vt);function Vt(t,e){return Gt.call(this,tt,e,t)||this}var qt,zt=(t(Xt,qt=v),Xt);function Xt(t,e){var n=qt.call(this,I)||this;return n.errStack=t,n.pageDestUrl=e,n}var jt,Yt=(t(Jt,jt=v),Jt);function Jt(t,e,n){var i=jt.call(this,S,n)||this;return i.errMsg=String(e),i.instantiationCallsiteName=t,i}var Kt,$t=(t(Qt,Kt=v),Qt);function Qt(t,e,n,i){var r=Kt.call(this,A,i)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Zt,te=(t(ee,Zt=v),ee);function ee(t){var e=Zt.call(this,nt)||this;return e.errMsg=String(t),e}var ne,ie=(t(re,ne=v),re);function re(t,e){var n=ne.call(this,it)||this;return n.errMsg=String(t),n.moduleName=e,n}var oe,se=(t(ae,oe=bt),ae);function ae(t,e){return oe.call(this,W,t,e)||this}var le,ue=(t(ce,le=bt),ce);function ce(t,e){return le.call(this,b,t,e)||this}var de,he=(t(pe,de=bt),pe);function pe(t,e){return de.call(this,T,t,e)||this}var fe,me=(t(ge,fe=bt),ge);function ge(t,e){return fe.call(this,N,t,e)||this}var ve,we=(t(ye,ve=bt),ye);function ye(t,e){return ve.call(this,gt,t,e)||this}var _e,Ee=(t(Ce,_e=bt),Ce);function Ce(t,e){return _e.call(this,Ct,t,e)||this}var Ie,Se=(t(Ae,Ie=bt),Ae);function Ae(t,e){return Ie.call(this,vt,t,e)||this}var We,be=(t(Te,We=bt),Te);function Te(t,e){return We.call(this,wt,t,e)||this}var Ne,Re=(t(xe,Ne=bt),xe);function xe(t,e){return Ne.call(this,yt,t,e)||this}var De,Pe=(t(Me,De=bt),Me);function Me(t,e){return De.call(this,_t,t,e)||this}var Fe,Oe=(t(ke,Fe=bt),ke);function ke(t,e){return Fe.call(this,Et,t,e)||this}var Le,Ue=(t(He,Le=bt),He);function He(t,e){return Le.call(this,It,t,e)||this}var Ge,Be=(t(Ve,Ge=v),Ve);function Ve(t,e,n){var i=Ge.call(this,St)||this;return i.objectName=t,i.propertyName=e,i.availableProperties=n,i}var qe,ze=(t(Xe,qe=Ot),Xe);function Xe(t,e){return qe.call(this,R,e,t)||this}var je,Ye=(t(Je,je=Ot),Je);function Je(t,e){return je.call(this,x,e,t)||this}var Ke,$e=(t(Qe,Ke=v),Qe);function Qe(t){var e=Ke.call(this,D)||this;return e.nodeDescription=t,e}var Ze,tn=(t(en,Ze=Ot),en);function en(t,e){var n=Ze.call(this,P,e)||this;return n.argumentName=t,n}var nn,rn=(t(on,nn=v),on);function on(t){return nn.call(this,At,t)||this}var sn,an=(t(ln,sn=Ot),ln);function ln(t,e){var n=sn.call(this,M,e)||this;return n.argumentName=t,n}var un,cn=(t(dn,un=v),dn);function dn(t,e){var n=un.call(this,F)||this;return n.argumentName=t,n.nodeDescription=e,n}var hn,pn=(t(fn,hn=v),fn);function fn(){return hn.call(this,O)||this}var mn,gn=(t(vn,mn=v),vn);function vn(){return mn.call(this,k)||this}var wn,yn=(t(_n,wn=v),_n);function _n(t){var e=wn.call(this,L)||this;return e.argumentName=t,e}var En,Cn=(t(In,En=v),In);function In(){return En.call(this,H)||this}var Sn,An=(t(Wn,Sn=v),Wn);function Wn(t){var e=Sn.call(this,G)||this;return e.argumentName=t,e}var bn,Tn=(t(Nn,bn=v),Nn);function Nn(t,e){var n=bn.call(this,B)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var Rn,xn=(t(Dn,Rn=v),Dn);function Dn(){return Rn.call(this,U)||this}var Pn,Mn=(t(Fn,Pn=v),Fn);function Fn(t,e){var n=Pn.call(this,z)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var On,kn=(t(Ln,On=v),Ln);function Ln(t,e){var n=On.call(this,et)||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}var Un,Hn=(t(Gn,Un=v),Gn);function Gn(t){return Un.call(this,q,t)||this}var Bn,Vn=(t(qn,Bn=v),qn);function qn(){return Bn.call(this,V)||this}var zn,Xn=(t(jn,zn=v),jn);function jn(){return zn.call(this,X)||this}var Yn,Jn=(t(Kn,Yn=v),Kn);function Kn(){return Yn.call(this,ot)||this}var $n,Qn=(t(Zn,$n=v),Zn);function Zn(){return $n.call(this,rt)||this}var ti,ei=(t(ni,ti=v),ni);function ni(){return ti.call(this,st)||this}var ii,ri=(t(oi,ii=v),oi);function oi(){return ii.call(this,at)||this}var si,ai=(t(li,si=v),li);function li(){return si.call(this,ut)||this}var ui,ci=(t(di,ui=v),di);function di(){return ui.call(this,ft)||this}var hi,pi=(t(fi,hi=v),fi);function fi(t){var e=hi.call(this,pt)||this;return e.errMsg=t,e}var mi,gi=(t(vi,mi=v),vi);function vi(){return mi.call(this,ct)||this}var wi,yi=(t(_i,wi=v),_i);function _i(){return wi.call(this,dt)||this}var Ei,Ci=(t(Ii,Ei=v),Ii);function Ii(){return Ei.call(this,ht)||this}var Si,Ai=(t(Wi,Si=v),Wi);function Wi(){return Si.call(this,lt)||this}var bi,Ti=(t(Ni,bi=v),Ni);function Ni(){return bi.call(this,mt)||this}var Ri,xi=(t(Di,Ri=v),Di);function Di(){return Ri.call(this,j)||this}var Pi,Mi=(t(Fi,Pi=v),Fi);function Fi(){return Pi.call(this,Y)||this}var Oi,ki=(t(Li,Oi=v),Li);function Li(t,e){var n=Oi.call(this,J)||this;return n.dialogType=t,n.pageUrl=e,n}var Ui,Hi=(t(Gi,Ui=v),Gi);function Gi(t,e,n){var i=Ui.call(this,K)||this;return i.dialogType=t,i.errMsg=e,i.pageUrl=n,i}var Bi,Vi=(t(qi,Bi=v),qi);function qi(){return Bi.call(this,Wt)||this}var zi=Object.freeze({__proto__:null,TestRunErrorBase:v,ClientFunctionExecutionInterruptionError:Rt,DomNodeClientFunctionResultError:Pt,SelectorErrorBase:Ot,InvalidSelectorResultError:Ut,CannotObtainInfoForElementSpecifiedBySelectorError:Bt,UncaughtErrorOnPage:zt,UncaughtErrorInClientFunctionCode:Yt,UncaughtErrorInCustomDOMPropertyCode:$t,UncaughtErrorInCustomClientScriptCode:te,UncaughtErrorInCustomClientScriptLoadedFromModule:ie,ActionIntegerOptionError:se,ActionPositiveIntegerOptionError:ue,ActionBooleanOptionError:he,ActionSpeedOptionError:me,ActionStringOptionError:we,ActionStringOrRegexOptionError:Ee,ActionDateOptionError:Se,ActionNumberOptionError:be,ActionUrlOptionError:Re,ActionUrlSearchParamsOptionError:Pe,ActionObjectOptionError:Oe,ActionFunctionOptionError:Ue,ActionInvalidObjectPropertyError:Be,ActionElementNotFoundError:ze,ActionElementIsInvisibleError:Ye,ActionSelectorMatchesWrongNodeTypeError:$e,ActionAdditionalElementNotFoundError:tn,ActionElementIsNotTargetError:rn,ActionAdditionalElementIsInvisibleError:an,ActionAdditionalSelectorMatchesWrongNodeTypeError:cn,ActionElementNonEditableError:pn,ActionElementNotTextAreaError:gn,ActionElementNonContentEditableError:yn,ActionRootContainerNotFoundError:Cn,ActionIncorrectKeysError:An,ActionCannotFindFileToUploadError:Tn,ActionElementIsNotFileInputError:xn,ActionInvalidScrollTargetError:Mn,InvalidElementScreenshotDimensionsError:kn,ActionElementNotIframeError:Hn,ActionIframeIsNotLoadedError:Vn,CurrentIframeIsNotLoadedError:Xn,ChildWindowNotFoundError:Jn,ChildWindowIsNotLoadedError:Qn,CannotSwitchToWindowError:ei,CloseChildWindowError:ri,CannotCloseWindowWithChildrenError:ai,CannotCloseWindowWithoutParentError:ci,SwitchToWindowPredicateError:pi,WindowNotFoundError:gi,ParentWindowNotFoundError:yi,PreviousWindowNotFoundError:Ci,ChildWindowClosedBeforeSwitchingError:Ai,CannotRestoreChildWindowError:Ti,CurrentIframeNotFoundError:xi,CurrentIframeIsInvisibleError:Mi,NativeDialogNotHandledError:ki,UncaughtErrorInNativeDialogHandler:Hi,MultipleWindowsModeIsNotSupportedInNativeAutomationModeError:Vi}),Xi="_nativeMethods",ji=(Yi.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},Yi.prototype._getWindowIds=function(t){return this[Xi].objectKeys(t)},Yi.prototype._copyArray=function(t){return this[Xi].arraySlice.call(t)},Yi.prototype._concatArrays=function(t,e){return this[Xi].arrayConcat.call(t,e)},Yi.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},Yi.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Xi].arrayForEach.call(t,function(t){n.ensureMessageContainer(t),n[t].log=n._concatArrays(n[t].log,e[t].log),n[t].info=n._concatArrays(n[t].info,e[t].info),n[t].warn=n._concatArrays(n[t].warn,e[t].warn),n[t].error=n._concatArrays(n[t].error,e[t].error)}),this},Yi.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},Yi.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Xi].arrayForEach.call(t,function(t){n[t]={log:e._copyArray(e[t].log),info:e._copyArray(e[t].info),warn:e._copyArray(e[t].warn),error:e._copyArray(e[t].error)}}),n},Yi);function Yi(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Xi,{value:n}),this.concat(t)}var Ji,Ki=(t($i,Ji=ji),$i);function $i(t){return Ji.call(this,t,c.nativeMethods)||this}var Qi,Zi,tr=(function(t){function n(t){return!!s[t]}function i(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,r=(0,eval)("this"),s={Int8Array:"function"==typeof Int8Array?Int8Array:void 0,Uint8Array:"function"==typeof Uint8Array?Uint8Array:void 0,Uint8ClampedArray:"function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Int16Array:"function"==typeof Int16Array?Int16Array:void 0,Uint16Array:"function"==typeof Uint16Array?Uint16Array:void 0,Int32Array:"function"==typeof Int32Array?Int32Array:void 0,Uint32Array:"function"==typeof Uint32Array?Uint32Array:void 0,Float32Array:"function"==typeof Float32Array?Float32Array:void 0,Float64Array:"function"==typeof Float64Array?Float64Array:void 0},a="function"==typeof ArrayBuffer,l="function"==typeof Map,u="function"==typeof Set,c="function"==typeof Buffer,d=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function h(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}i._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},i.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},i.prototype._applyTransform=function(t,e,n,i){var r=Object.create(null),o=i.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),r["@t"]=i.type,r.data=this._handleValue(o,e,n),r},i.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},i.prototype._handlePlainObject=function(n){var i=this,r=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;r[e]=i._handleValue(n[t],r,e)}),r},i.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},i.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),i._createRefMark(n.refIdx)}return null},i.prototype._handleValue=function(t,e,n){var i=typeof t,r="object"==i&&null!==t;if(r){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(i,t))return this._applyTransform(t,e,n,a)}return r?this._handleObject(t,e,n):t},i.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]=i._createRefMark(n.refIdx))}return t},h.prototype._handlePlainObject=function(e){var t,n=this,i=Object.create(null),r=Object.getOwnPropertyNames(e);for(t in r.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(i[t.substring(1)]=e[t],delete e[t])}),i)e[t]=i[t]},h.prototype._handleTransformedObject=function(t,e,n){var i=t["@t"],r=this.transformMap[i];if(!r)throw new Error("Can't find transform for \""+i+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=r.fromSerializable(t.data)},h.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var i=this.references,r=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===r&&(r=i[t]),r},set:function(t){return r=t}})},h.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])},h.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var i=t["@r"];if(void 0!==i)this._handleCircularRef(i,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var r=0;r<t.length;r++)this._handleValue(t[r],t,r);else this._handlePlainObject(t)}},h.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var p=[{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(r[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return a&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return d.call(e)},fromSerializable:function(t){if(a){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[Buffer]]",shouldTransform:function(t,e){return c&&e instanceof Buffer},toSerializable:function(t){return d.call(t)},fromSerializable:function(t){return c?Buffer.from(t):t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){return Object.keys(s).some(function(t){return n(t)&&e instanceof s[t]})},toSerializable:function(t){return{ctorName:t.constructor.name,arr:d.call(t)}},fromSerializable:function(t){return n(t.ctorName)?new s[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return l&&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(l){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var i=[],r=0;r<t.length;r+=2)i.push([t[n],t[n+1]]);return i}},{type:"[[Set]]",shouldTransform:function(t,e){return u&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(u){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],f=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(p)};f.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},f.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],i=this.transforms.indexOf(n);-1<i&&this.transforms.splice(i,1),delete this.transformsMap[n.type]}return this},f.prototype.encode=function(t){var e=new i(t,this.transforms).transform();return this.serializer.serialize(e)},f.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new h(e,this.transformsMap).transform()}}(Qi={exports:{}}),Qi.exports),er=function(t){return t};function nr(t){return new tr({serialize:er,deserialize:er}).addTransforms(t)}var ir=1,rr=2,or=3,sr=((Zi={})[ir]=/^\.filterVisible\(\)$/,Zi[rr]=/^\.filterHidden\(\)$/,Zi[or]=/^\.nth\(\d+\)$/,Zi);function ar(){this._err=null}var lr=(Object.defineProperty(ar.prototype,"error",{get:function(){return this._err},set:function(t){null===this._err&&(this._err=t)},enumerable:!1,configurable:!0}),ar.prototype.filter=function(t,e,n){if(e.filterVisible&&(t=t.filter(_.positionUtils.isElementVisible),this._assertFilterError(t,n,ir)),e.filterHidden&&(t=t.filter(function(t){return!_.positionUtils.isElementVisible(t)}),this._assertFilterError(t,n,rr)),e.counterMode)return null===e.index?t.length:ar._getNodeByIndex(t,e.index)?1:0;var i;if(e.collectionMode)return null!==e.index&&(t=(i=ar._getNodeByIndex(t,e.index))?[i]:[],this._assertFilterError(t,n,or)),t;var r=ar._getNodeByIndex(t,e.index||0);return r||(this.error=ar._getErrorItem(n,or)),r},ar.prototype.cast=function(t){if(null==t)return[];if(t instanceof c.nativeMethods.Node)return[t];if(function(t){if(c.nativeMethods.isArray(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof c.nativeMethods.Node))return;return 1}}(t))return t;if((e=t)instanceof c.nativeMethods.HTMLCollection||e instanceof c.nativeMethods.NodeList)return function(t){for(var e=t.length,n=[],i=0;i<e;i++)n.push(t[i]);return n}(t);var e;throw new Ut},ar.prototype._assertFilterError=function(t,e,n){0===t.length&&(this.error=ar._getErrorItem(e,n))},ar._getErrorItem=function(t,e){var n=t.apiFnChain,i=t.apiFnID;if(e)for(var r=i;r<n.length;r++)if(sr[e].test(n[r]))return r;return null},ar._getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},new ar);function ur(t,e){return new c.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,c.Promise,RegExp)}var cr=(dr.prototype.shouldTransform=function(t){return"function"===t},dr.prototype.toSerializable=function(){return""},dr.prototype.fromSerializable=function(t){var e=t.fnCode,n=t.dependencies;return"filterOptions"in n&&(n.selectorFilter=lr),ur(e,n)},dr);function dr(){this.type="Function"}var hr=(pr.prototype.shouldTransform=function(t,e){if(e instanceof c.nativeMethods.Node)throw new Pt(this._instantiationCallsiteName);return!1},pr.prototype.toSerializable=function(){},pr.prototype.fromSerializable=function(){},pr);function pr(t){this.type="Node",this._instantiationCallsiteName=t}var fr=(mr.prototype.getResult=function(){var e=this;return c.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Yt(e.command.instantiationCallsiteName,t)),t})},mr.prototype.encodeResult=function(t){return this.replicator.encode(t)},mr.prototype._createReplicator=function(){return nr([new hr(this.command.instantiationCallsiteName),new cr])},mr.prototype._executeFn=function(t){return this.fn.apply(bc,t)},mr);function mr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(t.dependencies),this.fn=ur(t.fnCode,this.dependencies)}var gr="appeared-dialog",vr="unexpected-dialog",wr="handler-error",yr=s.eventSandbox.message,_r=s.processScript,Er=s.nativeMethods,Cr="testcafe|native-dialog-tracker|appeared-dialogs",Ir="testcafe|native-dialog-tracker|unexpected-dialog",Sr="testcafe|native-dialog-tracker|error-in-handler",Ar=_r("window.location.href"),Wr=["alert","confirm","prompt","print"],br="geolocation",Tr=(Object.defineProperty(Nr.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Cr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Cr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Ir)},set:function(t){this.contextStorage.setItem(Ir,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"handlerError",{get:function(){return this.contextStorage.getItem(Sr)},set:function(t){this.contextStorage.setItem(Sr,t)},enumerable:!1,configurable:!0}),Nr._getPageUrl=function(){return Er.eval(Ar)},Nr.prototype._initListening=function(){var n=this;yr.on(yr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===gr?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==vr||n.unexpectedDialog?e.type!==wr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},Nr.prototype._init=function(){var e=this;s.on(s.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),this._setCustomOrDefaultHandler()},Nr.prototype._createDialogHandler=function(r){var o=this;return function(t){var e=Nr._getPageUrl();o._addAppearedDialogs(r,t,e);var n=new fr(o.dialogHandler),i=null;try{i=n.fn.apply(bc,[r,t,e])}catch(t){o._onHandlerError(r,t.message||String(t),e)}return i}},Nr.prototype._handleGeolocationDialog=function(t,e){if(!this.dialogHandler)return this._defaultDialogHandler(br),void t();var n=Nr._getPageUrl();Er.arraySome.call(this.appearedDialogs,function(t){return t.type===br&&t.url===n})||this._addAppearedDialogs(br,void 0,n);var i=new fr(this.dialogHandler),r=null;try{r=i.fn.apply(bc,[br,void 0,n])}catch(t){this._onHandlerError(br,t.message||String(t),n)}(r instanceof Error?e:t)(r)},Nr.prototype._defaultDialogHandler=function(t){var e=Nr._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},Nr.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},Nr.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},Nr.prototype._setCustomOrDefaultHandler=function(){var e=this;Wr.forEach(function(t){bc[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}}),this._setGeolocationDialogHandler()},Nr.prototype._setGeolocationDialogHandler=function(){var t,e,n=null===(t=bc.Geolocation)||void 0===t?void 0:t.prototype,i=null===(e=bc.navigator)||void 0===e?void 0:e.geolocation;this._shouldOverrideGeolocationDialog(n)&&this._shouldOverrideGeolocationDialog(i)&&(n.getCurrentPosition=this._handleGeolocationDialog.bind(this))},Nr.prototype._shouldOverrideGeolocationDialog=function(t){if(null==t||!t.getCurrentPosition)return!1;var e=Er.isNativeCode(t.getCurrentPosition),n=t.getCurrentPosition===this._handleGeolocationDialog;return e||n},Nr.prototype.setHandler=function(t){this.dialogHandler=t,this._setCustomOrDefaultHandler()},Nr.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new ki(t.type,t.url):e?new Hi(e.type,e.message,e.url):null},Nr);function Nr(t,e){var n=(void 0===e?{}:e).dialogHandler;this.contextStorage=t,this.dialogHandler=n,this._init(),this._initListening()}function Rr(){return"".concat(c.nativeMethods.performanceNow(),".").concat(Math.floor(1e5*Math.random()))}function xr(t){this.type=t,this.id=Rr()}var Dr,Pr="driver|establish-connection",Mr="driver|switch-to-window",Fr="driver|close-window",Or="driver|close-window-validation",kr="driver|switch-to-window-validation",Lr="driver|get-windows",Ur="driver|command-executed",Hr="driver|execute-command",Gr="driver|confirmation",Br="driver|set-native-dialog-handler",Vr="driver|set-as-master",qr="driver|close-all-child-windows",zr="driver|start-to-restore-child-link",Xr="driver|restore-child-link",jr="driver|child-window-is-loaded-in-iframe",Yr="driver|child-window-is-opened-in-iframe",Jr="driver|stop-internal-from-iframe",Kr="driver|has-pending-action-flags",$r=(t(Qr,Dr=xr),Qr);function Qr(){return Dr.call(this,Pr)||this}var Zr,to=(t(eo,Zr=xr),eo);function eo(t){var e=t.windowId,n=Zr.call(this,Or)||this;return n.windowId=e,n}var no,io=(t(ro,no=xr),ro);function ro(t){var e=t.windowId,n=t.fn,i=no.call(this,kr)||this;return i.windowId=e,i.fn=n,i}var oo,so=(t(ao,oo=xr),ao);function ao(){return oo.call(this,Lr)||this}var lo,uo=(t(co,lo=xr),co);function co(t){var e=t.windowId,n=t.isCurrentWindow,i=lo.call(this,Fr)||this;return i.windowId=e,i.isCurrentWindow=n,i}var ho,po=(t(fo,ho=xr),fo);function fo(t){var e=t.windowId,n=t.fn,i=ho.call(this,Mr)||this;return i.windowId=e,i.fn=n,i}var mo,go=(t(vo,mo=xr),vo);function vo(t){var e=mo.call(this,Ur)||this;return e.driverStatus=t,e}var wo,yo=(t(_o,wo=xr),_o);function _o(t,e){var n=wo.call(this,Hr)||this;return n.command=t,n.testSpeed=e,n}var Eo,Co=(t(Io,Eo=xr),Io);function Io(t,e){var n=Eo.call(this,Gr)||this;return n.requestMessageId=t,n.result=e,n}var So,Ao=(t(Wo,So=xr),Wo);function Wo(t){var e=So.call(this,Br)||this;return e.dialogHandler=t,e}var bo,To=(t(No,bo=xr),No);function No(t){var e=bo.call(this,Vr)||this;return e.finalizePendingCommand=t,e}var Ro,xo=(t(Do,Ro=xr),Do);function Do(){return Ro.call(this,qr)||this}var Po,Mo=(t(Fo,Po=xr),Fo);function Fo(){return Po.call(this,zr)||this}var Oo,ko=(t(Lo,Oo=xr),Lo);function Lo(t){var e=Oo.call(this,Xr)||this;return e.windowId=t,e}var Uo,Ho=(t(Go,Uo=xr),Go);function Go(t){var e=Uo.call(this,jr)||this;return e.windowId=t,e}var Bo,Vo=(t(qo,Bo=xr),qo);function qo(){return Bo.call(this,Yr)||this}var zo,Xo=(t(jo,zo=xr),jo);function jo(){return zo.call(this,Jr)||this}var Yo,Jo=(t(Ko,Yo=xr),Ko);function Ko(){return Yo.call(this,Kr)||this}var $o=s.json,Qo=s.nativeMethods,Zo="%nativeAutomationContextStorage%",ts=(es.prototype.loadFromStorage=function(){var t={},e=this._getData();return e&&(t=$o.parse(e),this._deleteData()),t},es.prototype._getData=function(){throw new Error("Not implemented")},es.prototype._deleteData=function(){throw new Error("Not implemented")},es.prototype.save=function(){throw new Error("Not implemented")},es.prototype.sync=function(){},es.prototype.dispose=function(){this._deleteData()},es);function es(){}var ns,is=(t(rs,ns=ts),rs.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},rs.prototype._getData=function(){return Qo.storageGetItem.call(this.storage,this.storageKey)},rs.prototype._deleteData=function(){Qo.storageRemoveItem.call(this.storage,this.storageKey)},rs.prototype.save=function(t){Qo.storageSetItem.call(this.storage,this.storageKey,$o.stringify(t))},rs);function rs(t,e,n){var i=ns.call(this)||this;return i.storage=Qo.winSessionStorageGetter.call(t),i.storageKey=i._createStorageKey(e,n),i}var os,ss=(t(as,os=ts),as.prototype._getData=function(){var t;return null===(t=bc[Zo])||void 0===t?void 0:t[this.frameId]},as.prototype._deleteData=function(){bc[Zo]=null},as.prototype.save=function(t){bc.NATIVE_AUTOMATION_STORAGE_BINDING&&bc.NATIVE_AUTOMATION_STORAGE_BINDING($o.stringify({testRunId:this.testRunId,frameDriverId:this.frameId,data:$o.stringify(t)}))},as);function as(t,e){var n=os.call(this)||this,i=e.split("-"),r=i[0],o=i[1];return n.testRunId=r,n.frameId=o||"main",n}var ls=(us.prototype._createStorageStrategy=function(t,e,n,i){return new(t?ss:is)(e,n,i)},us.prototype.save=function(){this.strategy.save(this.data)},us.prototype.setItem=function(t,e){this.data[t]=e,this.save(this.data)},us.prototype.getItem=function(t){return this.data[t]},us.prototype.dispose=function(){this.strategy.dispose()},us);function us(t,e){var n=e.testRunId,i=e.windowId,r=e.nativeAutomation;this.strategy=this._createStorageStrategy(r,t,n,i),this.data=this.strategy.loadFromStorage(),this.testRunId=n}var cs=Object.prototype.toString,ds=String.prototype.indexOf,hs=String.prototype.endsWith||function(t,e){var n=cs.call(this);(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var i=ds.call(n,t,e);return-1!==i&&i===e},ps=Array.prototype.indexOf,fs=Array.prototype.map,ms=Array.prototype.sort,gs=Array.prototype.filter,vs=Array.prototype.concat,ws="Command",ys=(_s.prototype.getAssignableProperties=function(){return[]},_s.prototype.getAllAssignableProperties=function(){for(var t=Object.getPrototypeOf(this),e=[];t&&t.getAssignableProperties;)e=vs.call(e,t.getAssignableProperties()),t=Object.getPrototypeOf(t);return e},_s.prototype.getNonReportedProperties=function(){return[]},_s.prototype.getReportedProperties=function(){var t=fs.call(this.getAllAssignableProperties(),function(t){return t.name}),e=this.getNonReportedProperties();return gs.call(t,function(t){return!(-1<ps.call(e,t))})},_s.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t){e&&function(t,e){var n,i=e.constructor.name,r=fs.call(e.getAllAssignableProperties(),function(t){return t.name}),o=ms.call(e.getReportedProperties());for(n in t)if(!(-1<ps.call(r,n)||n in e))throw new Be(i,n,o)}(t,this);for(var i,r,o=this.getAllAssignableProperties(),s=0;s<o.length;s++){var a=o[s],l=a.name,u=a.type,c=a.required,d=a.init,h=a.defaultValue;void 0!==h&&(this[l]=h);var p=t[l];void 0===p&&!c||(e&&u&&u((i=this.constructor.name,r=l,hs.call(i,ws)?r:"".concat(i,".").concat(r)),p),this[l]=d?d(l,p,n,e):p)}}},_s);function _s(){}var Es,Cs=(t(Is,Es=ys),Is.prototype.getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isObservingFileDownloadingInNewWindow"},{name:"isFirstRequestAfterWindowSwitching"},{name:"warnings"}]},Is);function Is(t){var e=Es.call(this,t)||this;return e.id=Rr(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isObservingFileDownloadingInNewWindow=!1,e.isFirstRequestAfterWindowSwitching=!1,e.warnings=null,e._assignFrom(t,!0),e}function Ss(n,t,e,i){var r=null,o=null,s=null;return e=Math.max(e||0,2500),c.Promise.race([_.delay(e),new c.Promise(function(e){s=function(t){t.message.type===Gr&&t.message.requestMessageId===n.id&&e(t.message)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),r=c.nativeMethods.setInterval.call(bc,function(){return c.eventSandbox.message.sendServiceMsg(n,t)},1e3),c.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(c.nativeMethods.clearInterval.call(bc,r),c.nativeMethods.clearTimeout.call(bc,o),c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new i;return t})}var As=2e4;function Ws(t){var e=t.requestMsgId,n=t.result,i=t.window,r=new Co(e,n);c.eventSandbox.message.sendServiceMsg(r,i)}var bs=(Object.defineProperty(Ts.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Ts.prototype._ensureIframe=function(){var t=this;return _.domUtils.isElementInDocument(this.driverIframe)?_.waitFor(function(){return _.positionUtils.isIframeVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Mi}):c.Promise.reject(new xi)},Ts.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new c.Promise(function(t){e.checkIframeInterval=c.nativeMethods.setInterval.call(bc,function(){e._ensureIframe().catch(function(){return _.delay(500).then(function(){return t(new Cs({isCommandResult:!0}))})})},1e3)})},Ts.prototype._waitForCommandResult=function(){var e=this,n=null;return c.Promise.race([this._waitForIframeRemovedOrHidden(),new c.Promise(function(e){n=function(t){t.message.type===Ur&&e(t.message.driverStatus)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),c.nativeMethods.clearInterval.call(bc,e.checkIframeInterval),t})},Ts.prototype.sendConfirmationMessage=function(t){Ws({requestMsgId:t,result:{id:this.driverId,dispatchNativeAutomationEventUrls:this.dispatchNativeAutomationEventUrls},window:this.driverWindow})},Ts.prototype.executeCommand=function(e,n){var i=this;return this._ensureIframe().then(function(){var t=new yo(e,n);return c.Promise.all([Ss(t,i.driverWindow,i.iframeAvailabilityTimeout,Xn),i._waitForCommandResult()])}).then(function(t){return t[1]})},Ts);function Ts(t,e,n){this.driverWindow=t,this.driverIframe=_.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0,this.dispatchNativeAutomationEventUrls=n}var Ns=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],Rs=["tagName","attributes"],xs=["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"],Ds={childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!Ds.childNodeCount(t)},childElementCount:function(t){var e;return(null===(e=t.children)||void 0===e?void 0:e.length)||0},hasChildElements:function(t){return!!Ds.childElementCount(t)}},Ps=(Ms.prototype._initializeProperties=function(t,e,n){for(var i=0,r=e;i<r.length;i++){var o=r[i],s=n[o];this[o]=s?s(t):t[o]}},Ms);function Ms(){}var Fs,Os=(t(ks,Fs=Ps),ks);function ks(t){var e=Fs.call(this)||this;return e._initializeProperties(t,Ns,Ds),e}var Ls,Us={tagName:function(t){return t.tagName.toLowerCase()},visible:function(t){return _.positionUtils.isElementVisible(t)},focused:function(t){return c.utils.dom.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},i=e.length-1;0<=i;i--)n[e[i].name]=e[i].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"string"==typeof e.animVal&&(e=e.animVal),e.replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=bc.getComputedStyle(t),i=0;i<n.length;i++){var r=n[i];e[r]=n[r]}return e},innerText:function(t){return t.innerText}},Hs=(t(Gs,Ls=Ps),Gs);function Gs(t){var e=Ls.call(this)||this;return e._initializeProperties(t,Rs,Us),e}var Bs,Vs=(t(qs,Bs=Os),qs);function qs(t){var e=Bs.call(this,t)||this;return e._initializeProperties(t,xs,Us),e}var zs=(Xs.prototype._extend=function(t,e){for(var n=0,i=c.nativeMethods.objectKeys(this._customDOMProperties);n<i.length;n++){var r=i[n];try{t[r]=this._customDOMProperties[r](e)}catch(t){throw new $t(this._instantiationCallsiteName,t,r)}}},Xs.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},Xs.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Vs:Os)(t);return this._extend(e,t),e},Xs.prototype.fromSerializable=function(){},Xs);function Xs(t,e){void 0===t&&(t={}),this.type="Node",this._customDOMProperties=t,this._instantiationCallsiteName=e}var js=(Ys.prototype.on=function(t,e){this._eventsListeners[t]||(this._eventsListeners[t]=[]),this._eventsListeners[t].push(e)},Ys.prototype.once=function(n,i){var r=this;this.on(n,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.off(n,i),i.apply(void 0,t)})},Ys.prototype.off=function(t,e){var n=this._eventsListeners[t];n&&(this._eventsListeners[t]=c.nativeMethods.arrayFilter.call(n,function(t){return t!==e}))},Ys.prototype.offAll=function(t){t?this._eventsListeners[t]=[]:this._eventsListeners={}},Ys.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=this._eventsListeners[t];if(i)for(var r=0;r<i.length;r++)i[r].apply(this,e)},Ys);function Ys(){this._eventsListeners={}}var Js=s.Promise,Ks=s.nativeMethods;function $s(e){return new Js(function(t){return Ks.setTimeout.call(bc,t,e)})}var Qs={1:"element",2:"attribute",3:"text",4:"cdata section",5:"entity reference",6:"entity node",7:"processing instruction",8:"comment",9:"document",10:"document type",11:"document fragment",12:"notation"};function Zs(t){return t?{name:"ActionAdditionalElementIsInvisibleError",firstArg:t}:"ActionElementIsInvisibleError"}function ta(t){return t?{name:"ActionAdditionalElementNotFoundError",firstArg:t}:"ActionElementNotFoundError"}function ea(t){var e="string"==typeof t?zi[t]:zi[t.name],n="string"==typeof t?null:t.firstArg;return function(t){return new e(n,t)}}var na=(ia.prototype.push=function(t,i){var r=this;this._ensureElementsPromise=this._ensureElementsPromise.then(function(){return r._executeSelectorFn(t,{invisible:Zs(i),notFound:ta(i)},r._ensureElementsStartTime)}).then(function(t){if(!_.domUtils.isDomElement(t)){var e=t.nodeType,n=Qs[e];throw i?new cn(i,n):new $e(n)}r._elements.push(t)})},ia.prototype.getElements=function(){var t=this;return this._ensureElementsPromise.then(function(){return t._elements})},ia);function ia(t,e){this._globalSelectorTimeout=t,this._ensureElementsStartTime=c.nativeMethods.dateNow(),this._ensureElementsPromise=c.Promise.resolve(),this._executeSelectorFn=e,this._elements=[]}var ra=(oa.create=function(t){return new oa(t.top,t.right,t.bottom,t.left)},oa.prototype.add=function(t){return this.top+=t.top,this.right+=t.right,this.bottom+=t.bottom,this.left+=t.left,this},oa.prototype.sub=function(t){return"top"in t&&(this.top-=t.top,this.left-=t.left),this.bottom-=t.bottom,this.right-=t.right,this},oa.prototype.round=function(t,e){return void 0===t&&(t=Math.round),void 0===e&&(e=t),this.top=t(this.top),this.right=e(this.right),this.bottom=e(this.bottom),this.left=t(this.left),this},oa.prototype.contains=function(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom},oa);function oa(t,e,n,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),this.top=t,this.right=e,this.bottom=n,this.left=i}function sa(t){var e="array"+t.charAt(0).toUpperCase()+t.slice(1),n=c.nativeMethods[e];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,t)}}sa("filter"),sa("map"),sa("slice"),sa("splice"),sa("unshift"),sa("forEach"),sa("indexOf"),sa("some"),sa("reverse"),sa("reduce"),sa("concat"),sa("join"),sa("every"),s.utils.browser,s.nativeMethods,s.utils.style.get,s.utils.dom.getActiveElement,s.utils.dom.findDocument,s.utils.dom.find,s.utils.dom.isElementInDocument;var aa=s.utils.dom.isElementInIframe,la=s.utils.dom.getIframeByElement,ua=(s.utils.dom.isCrossDomainWindows,s.utils.dom.getSelectParent,s.utils.dom.getChildVisibleIndex,s.utils.dom.getSelectVisibleChildren,s.utils.dom.isElementNode,s.utils.dom.isTextNode,s.utils.dom.isRenderedNode,s.utils.dom.isIframeElement,s.utils.dom.isInputElement,s.utils.dom.isButtonElement,s.utils.dom.isFileInput,s.utils.dom.isTextAreaElement,s.utils.dom.isAnchorElement,s.utils.dom.isImgElement,s.utils.dom.isFormElement,s.utils.dom.isLabelElement,s.utils.dom.isSelectElement,s.utils.dom.isRadioButtonElement,s.utils.dom.isColorInputElement,s.utils.dom.isCheckboxElement,s.utils.dom.isOptionElement,s.utils.dom.isSVGElement,s.utils.dom.isMapElement,s.utils.dom.isBodyElement,s.utils.dom.isHtmlElement),ca=(s.utils.dom.isDocument,s.utils.dom.isTextEditableInput,s.utils.dom.isTextEditableElement,s.utils.dom.isTextEditableElementAndEditingAllowed,s.utils.dom.isContentEditableElement,s.utils.dom.isDomElement,s.utils.dom.isShadowUIElement,s.utils.dom.isShadowRoot,s.utils.dom.isElementFocusable,s.utils.dom.isHammerheadAttr,s.utils.dom.isElementReadOnly,s.utils.dom.getScrollbarSize),da=(s.utils.dom.getMapContainer,s.utils.dom.getTagName,s.utils.dom.closest,s.utils.dom.getParents,s.utils.dom.findParent,s.utils.dom.getTopSameDomainWindow,s.utils.dom.getParentExceptShadowRoot,s.utils.style,s.utils.style.getBordersWidth),ha=(s.utils.style.getComputedStyle,s.utils.style.getElementMargin,s.utils.style.getElementPadding,s.utils.style.getElementScroll),pa=(s.utils.style.getOptionHeight,s.utils.style.getSelectElementSize,s.utils.style.isElementVisible,s.utils.style.isVisibleChild,s.utils.style.getWidth,s.utils.style.getHeight,s.utils.style.getInnerWidth),fa=s.utils.style.getInnerHeight,ma=(s.utils.style.getScrollLeft,s.utils.style.getScrollTop,s.utils.style.setScrollLeft,s.utils.style.setScrollTop,s.utils.style.get,s.utils.style.getBordersWidthFloat,s.utils.style.getElementPaddingFloat,s.shadowUI,s.nativeMethods,ga.create=function(t){return"left"in t?new ga(t.left,t.top):"right"in t?new ga(t.right,t.bottom):new ga(t.x,t.y)},ga.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},ga.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},ga.prototype.round=function(t){return void 0===t&&(t=Math.round),this.x=t(this.x),this.y=t(this.y),this},ga.prototype.eql=function(t){return this.x===t.x&&this.y===t.y},ga.prototype.mul=function(t){return this.x*=t,this.y*=t,this},ga.prototype.distance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},ga);function ga(t,e){this.x=t,this.y=e}var va=function(t,e,n,i,r,o){this.width=t,this.height=e,this.left=n.x,this.top=n.y,this.right=n.x+t,this.bottom=n.y+e,this.border=i,this.scrollbar=o,this.scroll=r},wa=(s.utils.html,s.nativeMethods,s.utils.position.getElementRectangle),ya=s.utils.position.getOffsetPosition,_a=s.utils.position.offsetToClientCoords;function Ea(t){var e=t/2;return e<1?0:Math.round(e)}function Ca(t,e,n){var i,r={offsetX:Ea((i=wa(t)).width),offsetY:Ea(i.height)};if(e="number"==typeof e?Math.round(e):r.offsetX,n="number"==typeof n?Math.round(n):r.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var o=function(t){var e,n,i,r,o=ua(t),s=o?t.getElementsByTagName("body")[0]:null,a=t.getBoundingClientRect(),l=ra.create(da(t)),u=ha(t),c=aa(t),d="BackCompat"===t.ownerDocument.compatMode,h=o?new ma(0,0):ma.create(a),p=a.height,f=a.width;o&&(f=s&&d?(p=s.clientHeight,s.clientWidth):(p=t.clientHeight,t.clientWidth)),!c||(e=la(t))&&(n=ya(e),i=_a(ma.create(n)),r=da(e),h.add(i).add(ma.create(r)),o&&l.add(r));var m=!o&&pa(t)!==t.clientWidth,g=!o&&fa(t)!==t.clientHeight,v={right:m?ca():0,bottom:g?ca():0};return new va(f,p,h,l,u,v)}(t),s=Math.round(Math.max(t.scrollWidth,o.width)),a=Math.round(Math.max(t.scrollHeight,o.height)),l=o.scrollbar.right+o.border.left+o.border.right+s,u=o.scrollbar.bottom+o.border.top+o.border.bottom+a;return{offsetX:e<0?l+e:e,offsetY:n<0?u+n:n}}var Ia,Sa=(t(Aa,Ia=js),Aa.prototype._prepareCommand=function(t,e){t.options&&!t.options.speed&&(t.options.speed=e.testSpeed)},Aa.prototype._getCommandSelectorTimeout=function(t,e){var n;return"number"==typeof(null===(n=t.selector)||void 0===n?void 0:n.timeout)?t.selector.timeout:e.globalSelectorTimeout},Aa.prototype._delayAfterExecution=function(){return this._command.options&&1!==this._command.options.speed?$s(2e3*(1-this._command.options.speed)):c.Promise.resolve()},Aa.prototype._isExecutionTimeoutExpired=function(){return c.nativeMethods.dateNow()-this._executionStartTime>=this._commandSelectorTimeout},Aa.prototype._ensureCommandArguments=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureCmdArgs&&t.ensureCmdArgs(this._command)},Aa.prototype._ensureCommandElements=function(){var t,e=this,n=new na(this._options.globalSelectorTimeout,this._options.executeSelectorFn);this._command.selector&&n.push(this._command.selector);var i=null===(t=Aa.ACTIONS_HANDLERS[this._command.type])||void 0===t?void 0:t.additionalSelectorProps;if(i)for(var r=0,o=i;r<o.length;r++){var s=o[r];this._command[s]&&n.push(this._command[s],s)}return n.getElements().then(function(t){e._elements=t})},Aa.prototype._ensureCommandElementsProperties=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureElsProps&&t.ensureElsProps(this._elements)},Aa.prototype._ensureCommandOptions=function(){return l(this,void 0,c.Promise,function(){var e,n,i,r;return C(this,function(t){return e=this._command.options,this._elements.length&&e&&"offsetX"in e&&"offsetY"in e&&(n=Ca(this._elements[0],e.offsetX,e.offsetY),i=n.offsetX,r=n.offsetY,e.isDefaultOffset=!e.offsetX&&!e.offsetY,e.offsetX=i,e.offsetY=r),[2]})})},Aa.prototype._createAutomation=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];if(!t)throw new Error('There is no handler for the "'.concat(this._command.type,'" command.'));return t.create(this._command,this._elements,this._options.dispatchNativeAutomationEventFn)},Aa.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){return n._ensureCommandOptions()}).then(function(){var t=n._createAutomation();return t.WARNING_EVENT&&t.on(t.WARNING_EVENT,function(t){n.emit(Aa.WARNING_EVENT,t)}),t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n._targetElement=t.element,n.emit(Aa.EXECUTION_STARTED_EVENT)}):n.emit(Aa.EXECUTION_STARTED_EVENT),t.run(e)})},Aa.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return e()?[4,n()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})})}(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(!e._isExecutionTimeoutExpired())return $s(250);if(t.code===At)return n=!1,c.Promise.resolve();throw t})})},Aa.prototype.execute=function(t){var e=this;this._executionStartTime=c.nativeMethods.dateNow();try{this._ensureCommandArguments()}catch(t){return c.Promise.reject(t)}return this.emit(Aa.WAITING_FOR_ELEMENT_EVENT,this._commandSelectorTimeout),this._runRecursively().then(function(){return c.Promise.all([e._delayAfterExecution(),t.wait()])}).then(function(){var t=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||((i=i||Array.prototype.slice.call(e,0,r))[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}([],e._elements,!0);return e._targetElement&&(t[0]=e._targetElement),t})},Aa.EXECUTION_STARTED_EVENT="execution-started",Aa.WAITING_FOR_ELEMENT_EVENT="waiting-for-elements",Aa.WARNING_EVENT="warning",Aa.ACTIONS_HANDLERS={},Aa);function Aa(t,e){var n=Ia.call(this)||this;return n._command=t,n._targetElement=null,n._elements=[],n._options=e,n._executionStartTime=0,n._prepareCommand(t,e),n._commandSelectorTimeout=n._getCommandSelectorTimeout(t,e),n}function Wa(t,e,n){return Math.min(Math.max(e,t),n)}function ba(t,e){var n="number"==typeof t.min,i="number"==typeof t.max,r="number"==typeof t.length;return r&&(t.length=Wa(t.length,0,e)),n&&t.min<0&&(t.min+=e),i&&t.max<0&&(t.max+=e),n||(t.min=i&&r?t.max-t.length:0),i||(t.max=r?t.min+t.length:e),t.min=Wa(t.min,0,e),t.max=Wa(t.max,0,e),t.length=t.max-t.min,t}function Ta(t,e,n){return Math.round(t+Wa(e-t,0,n)/2)}var Na,Ra=(t(xa,Na=fr),xa.prototype._createReplicator=function(){return nr([new cr])},xa.prototype._getTimeoutErrorParams=function(t){return{apiFnIndex:lr.error,apiFnChain:this.command.apiFnChain,reason:_.positionUtils.getHiddenReason(t)}},xa.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},xa.prototype._validateElement=function(s,a){var l=this;return c.Promise.resolve().then(function(){return Na.prototype._executeFn.call(l,s)}).then(function(t){var e=t,n=!!e,i=!l.command.visibilityCheck||e&&_.positionUtils.isElementVisible(e),r=c.nativeMethods.dateNow()-a>=l.timeout;if(n&&(i||c.utils.dom.isShadowRoot(e)))return e;if(!r)return _.delay(200).then(function(){return l._validateElement(s,a)});var o=l.getVisibleValueMode?null:l._getTimeoutError(n);if(o)throw o(l._getTimeoutErrorParams(e));return null})},xa.prototype._executeFn=function(t){return this.counterMode?Na.prototype._executeFn.call(this,t):this._validateElement(t,c.nativeMethods.dateNow())},xa);function xa(t,e,n,i,r){var o,s=Na.call(this,t)||this;s.createNotFoundError=i,s.createIsInvisibleError=r,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,s.dependencies.selectorFilter=lr,n&&(o=c.nativeMethods.dateNow()-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies.customDOMProperties;return s.replicator.addTransforms([new zs(a,t.instantiationCallsiteName)]),s}var Da=c.nativeMethods.date,Pa=(Ma.prototype._ensureElement=function(t){var e=this,n=t.selector,i=t.createNotFoundError,r=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new Ra(n,e.globalSelectorTimeout,e.ensureElementsStartTime,i,r).getResult()}).then(function(t){if(!_.domUtils.isDomElement(t))throw o(Qs[t.nodeType]);e.elements.push(t)})},Ma.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Ma);function Ma(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=c.Promise.resolve(),this.ensureElementsStartTime=new Da,t.forEach(function(t){return n._ensureElement(t)})}function Fa(i){return function(t,e){var n=typeof e;if("number"!=n)throw new i(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new i(t,e)}}var Oa,ka,La,Ua,Ha,Ga,Ba,Va,qa,za,Xa,ja,Ya,Ja=Fa(se),Ka=(ka=Fa(Oa=ue),function(t,e){if(ka(t,e),e<0)throw new Oa(t,e)}),$a=(La=he,function(t,e){var n=typeof e;if("boolean"!=n)throw new La(t,n)}),Qa=(Ua=me,function(t,e){var n=typeof e;if("number"!=n)throw new Ua(t,n);if(isNaN(e)||e<.01||1<e)throw new Ua(t,e)}),Za=(Ha=we,function(t,e){var n=typeof e;if("string"!=n)throw new Ha(t,n)}),tl=(Ga=Ee,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof RegExp))throw new Ga(t,n)}),el=(Ba=Se,function(t,e){if(!(e instanceof Date))throw new Ba(t,e)}),nl=(Va=be,function(t,e){if(isNaN(Number(e)))throw new Va(t,typeof e)}),il=(qa=Re,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof URL))throw new qa(t,n)}),rl=(za=Pe,function(t,e){var n=typeof e;if("object"!=n&&!(e instanceof URLSearchParams))throw new za(t,n)}),ol=(Xa=Oe,function(t,e){var n=typeof e;if("object"!=n)throw new Xa(t,n)}),sl=(ja=Ue,function(t,e){var n=typeof e;if("function"!=n)throw new ja(t,n)}),al=(t(ll,Ya=ys),ll.prototype.getAssignableProperties=function(){return[{name:"speed",type:Qa}]},ll);function ll(t,e){var n=Ya.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var ul,cl=(t(dl,ul=al),dl.prototype.getAssignableProperties=function(){return[{name:"offsetX",type:Ja},{name:"offsetY",type:Ja},{name:"isDefaultOffset",type:$a}]},dl);function dl(t,e){var n=ul.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var hl,pl=(t(fl,hl=cl),fl.prototype.getAssignableProperties=function(){return[{name:"scrollToCenter",type:$a},{name:"skipParentFrames",type:$a}]},fl);function fl(t,e){var n=hl.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var ml,gl=(t(vl,ml=ys),vl.prototype.getAssignableProperties=function(){return[{name:"left",type:Ja,defaultValue:null},{name:"right",type:Ja,defaultValue:null},{name:"top",type:Ja,defaultValue:null},{name:"bottom",type:Ja,defaultValue:null}]},vl);function vl(t,e){var n=ml.call(this)||this;return n._assignFrom(t,e),n}var wl,yl=(t(_l,wl=al),_l.prototype.getAssignableProperties=function(){return[{name:"scrollTargetX",type:Ja},{name:"scrollTargetY",type:Ja},{name:"crop",type:ol,init:su},{name:"includeMargins",type:$a},{name:"includeBorders",type:$a},{name:"includePaddings",type:$a}]},_l);function _l(t,e){var n=wl.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 El,Cl=(t(Il,El=ys),Il.prototype.getAssignableProperties=function(){return[{name:"ctrl",type:$a,defaultValue:!1},{name:"alt",type:$a,defaultValue:!1},{name:"shift",type:$a,defaultValue:!1},{name:"meta",type:$a,defaultValue:!1}]},Il);function Il(t,e){var n=El.call(this)||this;return n._assignFrom(t,e),n}var Sl,Al=(t(Wl,Sl=cl),Wl.prototype.getAssignableProperties=function(){return[{name:"modifiers",type:ol,init:au}]},Wl);function Wl(t,e){var n=Sl.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var bl,Tl,Nl,Rl,xl,Dl,Pl,Ml,Fl=(t(Ol,bl=Al),Ol.prototype.getAssignableProperties=function(){return[{name:"caretPos",type:Ka}]},Ol);function Ol(t,e){var n=bl.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}function kl(t,e){var n=Tl.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 Ll(t,e){var n=Nl.call(this)||this;return n.replace=!1,n.paste=!1,n.confidential=void 0,n._assignFrom(t,e),n}function Ul(t,e){var n=Rl.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function Hl(t,e){var n=xl.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function Gl(t,e){var n=Dl.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function Bl(t,e){var n=Pl.call(this)||this;return n.confidential=void 0,n._assignFrom(t,e),n}function Vl(t,e){var n=Ml.call(this)||this;return n._assignFrom(t,e),n}t(kl,Tl=Al),kl.prototype.getAssignableProperties=function(){return[{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:$a},{name:"skipDefaultDragBehavior",type:$a}]},t(Ll,Nl=Fl),Ll.prototype.getAssignableProperties=function(){return[{name:"replace",type:$a},{name:"paste",type:$a},{name:"confidential",type:$a}]},t(Ul,Rl=Al),Ul.prototype.getAssignableProperties=function(){return[{name:"destinationOffsetX",type:Ja},{name:"destinationOffsetY",type:Ja}]},t(Hl,xl=ys),Hl.prototype.getAssignableProperties=function(){return[{name:"portraitOrientation",type:$a}]},t(Gl,Dl=ys),Gl.prototype.getAssignableProperties=function(){return[{name:"timeout",type:Ka},{name:"allowUnawaitedPromise",type:$a}]},t(Bl,Pl=al),Bl.prototype.getAssignableProperties=function(){return[{name:"confidential",type:$a}]},t(Vl,Ml=ys),Vl.prototype.getAssignableProperties=function(){return[{name:"name",type:Za},{name:"value",type:Za},{name:"domain",type:Za},{name:"path",type:Za},{name:"expires",type:el},{name:"maxAge",type:nl},{name:"secure",type:$a},{name:"httpOnly",type:$a},{name:"sameSite",type:Za}]};var ql,zl=(t(Xl,ql=ys),Xl.prototype.getAssignableProperties=function(){return[{name:"username",type:Za,required:!0},{name:"password",type:Za}]},Xl);function Xl(t,e){var n=ql.call(this)||this;return n._assignFrom(t,e),n}var jl,Yl,Jl,Kl,$l,Ql=(t(Zl,jl=ys),Zl.prototype.getAssignableProperties=function(){return[{name:"protocol",type:Za},{name:"host",type:Za,required:!0},{name:"port",type:nl,required:!0},{name:"auth",type:ol,init:ru}]},Zl);function Zl(t,e){var n=jl.call(this)||this;return n._assignFrom(t,e),n}function tu(t,e){var n=Yl.call(this)||this;return n._assignFrom(t,e),n}function eu(t,e){var n=Jl.call(this)||this;return n._assignFrom(t,e),n}function nu(t,e){var n=Kl.call(this)||this;return n._assignFrom(t,e),n}function iu(t,e){var n=$l.call(this)||this;return n._assignFrom(t,e),n}function ru(t,e,n,i){return void 0===i&&(i=!0),new zl(e,i)}function ou(t,e,n,i){return void 0===i&&(i=!0),new Ql(e,i)}function su(t,e,n,i){return void 0===i&&(i=!0),new gl(e,i)}function au(t,e,n,i){return void 0===i&&(i=!0),new Cl(e,i)}function lu(t){return t.top!==t}t(tu,Yl=ys),tu.prototype.getAssignableProperties=function(){return[{name:"url",type:il},{name:"method",type:Za},{name:"headers",type:ol},{name:"params",type:rl},{name:"body"},{name:"timeout",type:nl},{name:"withCredentials",type:$a},{name:"auth",type:ol,init:ru},{name:"proxy",type:ol,init:ou},{name:"rawResponse",type:$a}]},t(eu,Jl=ys),eu.prototype.getAssignableProperties=function(){return[{name:"credentials",type:nl}]},t(nu,Kl=ys),nu.prototype.getAssignableProperties=function(){return[{name:"stack",type:tl,required:!1},{name:"message",type:tl,required:!1},{name:"pageUrl",type:tl,required:!1}]},t(iu,$l=ys),iu.prototype.getAssignableProperties=function(){return[{name:"fn",type:sl,required:!0},{name:"dependencies",type:ol,required:!1}]};var uu=c.eventSandbox.message,cu="driver|browser-manipulation|request",du="driver|browser-manipulation|response";uu.on(uu.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,i,r,o;e.message.cmd===cu&&(t=_.domUtils.findIframeByWindow(e.source),i=(n=e.message).command,(r=n.cropDimensions)&&(i.options=new yl({crop:r,includePaddings:!1})),(o=new hu(i)).element=t,o.execute().then(function(t){return uu.sendServiceMsg({cmd:du,result:t},e.source)}))});var hu=(pu.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 i=n+this.command.options.crop.right,r=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:r,right:i}},pu.prototype._createManipulationReadyMessage=function(){var t=bc.devicePixelRatio||1,e={cmd:d.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:bc.innerWidth,innerHeight:bc.innerHeight,documentWidth:Tc.documentElement.clientWidth,documentHeight:Tc.documentElement.clientHeight,bodyWidth:Tc.body.clientWidth,bodyHeight:Tc.body.clientHeight},disableResending:!0};return this.command.type===h.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},pu.prototype._runScrollBeforeScreenshot=function(){var r=this;return c.Promise.resolve().then(function(){if(r.element||!r.command.selector)return c.Promise.resolve();var t,e,n=r.command.selector.timeout,i="number"==typeof n?n:r.globalSelectorTimeout;return r.statusBar.showWaitingElementStatus(i),t=[{selector:r.command.selector,createNotFoundError:function(t){return new ze(null,t)},createIsInvisibleError:function(t){return new Ye(null,t)},createHasWrongNodeTypeError:function(t){return new $e(t)}}],e=r.globalSelectorTimeout,new Pa(t,e).getElements().then(function(t){r.statusBar.hideWaitingElementStatus(),r.element=t[0]}).catch(function(t){throw r.statusBar.hideWaitingElementStatus(),t})}).then(function(){return function(w,y){return l(this,void 0,void 0,function(){var e,n,i,r,o,s,a,l,u,c,d,h,p,f,m,g,v;return C(this,function(t){if(e=w.getBoundingClientRect(),n={left:e.left,right:e.right,top:e.top,bottom:e.bottom},i=_.styleUtils.getElementMargin(w),r=_.styleUtils.getElementPadding(w),o=_.styleUtils.getBordersWidth(w),y.originOffset={x:0,y:0},s=n.left+w.scrollWidth+o.left+o.right,a=n.top+w.scrollHeight+o.top+o.bottom,n.right=Math.max(n.right,s),n.bottom=Math.max(n.bottom,a),y.includeBorders&&y.includePaddings?y.includeMargins&&(y.originOffset.x-=i.left,y.originOffset.y-=i.top,n.left-=i.left,n.top-=i.top,n.right+=i.right,n.bottom+=i.bottom):(y.originOffset.x+=o.left,y.originOffset.y+=o.top,n.left+=o.left,n.top+=o.top,n.right-=o.right,n.bottom-=o.bottom,y.includePaddings||(y.originOffset.x+=r.left,y.originOffset.y+=r.top,n.left+=r.left,n.top+=r.top,n.right-=r.right,n.bottom-=r.bottom)),n.width=n.right-n.left,n.height=n.bottom-n.top,l=ba({min:y.crop.left,max:y.crop.right,length:y.crop.width},n.width),u=ba({min:y.crop.top,max:y.crop.bottom,length:y.crop.height},n.height),y.crop.left=l.min,y.crop.right=l.max,y.crop.width=l.length,y.crop.top=u.min,y.crop.bottom=u.max,y.crop.height=u.length,y.crop.width<=0||y.crop.height<=0)throw new kn(y.crop.width,y.crop.height);if(c=_.styleUtils.getViewportDimensions(),(n.width>c.width||n.height>c.height)&&(y.scrollToCenter=!0),d="number"==typeof y.scrollTargetX,h="number"==typeof y.scrollTargetY,d||(y.scrollTargetX=Ta(y.crop.left,y.crop.right,c.width)),h||(y.scrollTargetY=Ta(y.crop.top,y.crop.bottom,c.height)),p=E.getOffsetOptions(w,y.scrollTargetX,y.scrollTargetY),f=p.offsetX,m=p.offsetY,y.scrollTargetX=f,y.scrollTargetY=m,g=!d||y.scrollTargetX>=y.crop.left&&y.scrollTargetX<=y.crop.right,v=!h||y.scrollTargetY>=y.crop.top&&y.scrollTargetY<=y.crop.bottom,!g||!v)throw new Mn(g,v);return[2]})})}(r.element,r.command.options)}).then(function(){var t=r.command.options,e=t.scrollTargetX,n=t.scrollTargetY,i=t.scrollToCenter;return new _.ScrollAutomation(r.element,new pl({offsetX:e,offsetY:n,scrollToCenter:i,skipParentFrames:!0})).run()})},pu.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),_.delay(500)},pu.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},pu.prototype._requestManipulation=function(){if(!lu(bc))return c.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return _.sendRequestToFrame({cmd:cu,command:this.command,cropDimensions:t},du,bc.parent).then(function(t){if(!t.result)return{result:null};var e=t.result,n=e.result,i=e.executionError;if(i)throw i;return{result:n}})},pu.prototype._runManipulation=function(){var i=this,r=null;return c.Promise.resolve().then(function(){return i.command.type!==h.takeElementScreenshot?c.Promise.resolve():(_.scrollController.stopPropagation(),i._runScrollBeforeScreenshot())}).then(function(){return lu(bc)?c.Promise.resolve():i._hideUI()}).then(function(){return i._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return _.scrollController.enablePropagation(),r=e,lu(bc)||i._showUI(),_.delay(200)}).then(function(){return new Cs({isCommandResult:!0,result:r})}).catch(function(t){return _.scrollController.enablePropagation(),new Cs({isCommandResult:!0,executionError:t})})},pu.prototype.execute=function(){var t=this;return function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=new _.ClientRequestEmitter,r=new _.RequestBarrier(i),o=new _.ScriptExecutionEmitter,s=new _.ScriptExecutionBarrier(o);_.pageUnloadBarrier.watchForPageNavigationTriggers();var a=null,l=t.apply(void 0,e),u=l.then(function(t){return a=t,c.Promise.all([r.wait().then(function(){return s.wait()}),_.pageUnloadBarrier.wait()])}).then(function(){return a});return{actionPromise:l,barriersPromise:u}}(function(){return t._runManipulation()}).barriersPromise},pu);function pu(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}function fu(e){return e.getResult().then(function(t){return new Cs({isCommandResult:!0,result:e.encodeResult(t)})}).catch(function(t){return new Cs({isCommandResult:!0,executionError:t})})}var mu=s.Promise,gu=(vu.prototype.setAsMaster=function(t){var e=this;return Ss(new To(t),this.driverWindow,As,ei).catch(function(t){if(!e._isNonPageWindow)throw t})},vu.prototype.closeAllChildWindows=function(){return Ss(new xo,this.driverWindow,As,ri)},vu.prototype.findChildWindows=function(t,e){return Ss(new e(t),this.driverWindow,As,ei)},vu.prototype.startToRestore=function(){return Ss(new Mo,this.driverWindow,As,ei)},vu.prototype.closeFileDownloadingWindow=function(){this._isNonPageWindow=!0,this.driverWindow.close()},vu);function vu(t,e){this._isNonPageWindow=!1,this.driverWindow=t,this.windowId=e}var wu=(yu.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},yu.prototype._setAsMaster=function(t,e){return Ss(new To(e),t,As,ei)},yu.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},yu.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},yu.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},yu.prototype.restoreChild=function(i){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){return e=new ko(i),n=this.currentDriverWindow.opener,Ss(e,n,As,ei),[2]})})},yu);function yu(t){this.currentDriverWindow=t}var _u="master",Eu="replica",Cu=(Iu.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},Iu.prototype.toSerializable=function(t){return new Hs(t)},Iu.prototype.fromSerializable=function(){},Iu);function Iu(){this.type="Node"}var Su=(Au.prototype._startListening=function(){var e=this;this._emitter.onRequestSend(function(t){return e._onRequestSend(t)}),this._emitter.onRequestCompleted(function(t){return e._onRequestCompleted(t)}),this._emitter.onRequestError(function(t){return e._onRequestError(t)})},Au.prototype._offListening=function(){this._emitter.offAll()},Au.prototype._onRequestSend=function(t){this._collectingReqs&&this._requests.add(t)},Au.prototype._onRequestCompleted=function(t){var e=this;$s(this._delays.additionalRequestsCollection).then(function(){return e._onRequestFinished(t)})},Au.prototype._onRequestFinished=function(t){this._requests.has(t)&&(this._requests.delete(t),this._collectingReqs||this._requests.size||!this._watchdog||this._finishWaiting())},Au.prototype._onRequestError=function(t){this._onRequestFinished(t)},Au.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._requests.clear(),this._offListening(),this._waitResolve()},Au.prototype.wait=function(t){var n=this;return $s(t?this._delays.pageInitialRequestsCollection:this._delays.requestsCollection).then(function(){return new c.Promise(function(t){var e;n._collectingReqs=!1,n._waitResolve=t,n._requests.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},Au.TIMEOUT)):n._finishWaiting()})})},Au.TIMEOUT=3e3,Au);function Au(t,e){var n,i,r;void 0===e&&(e={}),this._delays={requestsCollection:null!==(n=e.requestsCollection)&&void 0!==n?n:50,additionalRequestsCollection:null!==(i=e.additionalRequestsCollection)&&void 0!==i?i:50,pageInitialRequestsCollection:null!==(r=e.pageInitialRequestsCollection)&&void 0!==r?r:50},this._emitter=t,this._waitResolve=null,this._watchdog=null,this._requests=new Set,this._collectingReqs=!0,this._startListening()}var Wu=(bu.prototype._startListening=function(){var e=this;this._emitter.onScriptAdded(function(t){return e._onScriptElementAdded(t)}),this._emitter.onScriptLoadedOrFailed(function(t){return e._onScriptLoadedOrFailed(t)})},bu.prototype._offListening=function(){this._emitter.offAll()},bu.prototype._onScriptElementAdded=function(t){var e=this,n=(0,c.nativeMethods.setTimeout)(function(){return e._onScriptLoadedOrFailed(t,!0)},bu.LOADING_TIMEOUT);this._scripts.set(t,n)},bu.prototype._onScriptLoadedOrFailed=function(t,e){var n=this;void 0===e&&(e=!1),this._scripts.has(t)&&(e||(0,c.nativeMethods.clearTimeout)(this._scripts.get(t)),this._scripts.delete(t),this._scripts.size||$s(25).then(function(){n._waitResolve&&!n._scripts.size&&n._finishWaiting()}))},bu.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._scripts.clear(),this._offListening(),this._waitResolve(),this._waitResolve=null},bu.prototype.wait=function(){var n=this;return new c.Promise(function(t){var e;n._waitResolve=t,n._scripts.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},bu.TIMEOUT)):n._finishWaiting()})},bu.TIMEOUT=3e3,bu.LOADING_TIMEOUT=2e3,bu);function bu(t){this._emitter=t,this._watchdog=null,this._waitResolve=null,this._scripts=new Map,this._startListening()}var Tu=(Nu.prototype.wait=function(){var t=this;return c.Promise.all([this._requestBarrier.wait().then(function(){return t._scriptExecutionBarrier.wait()}),this._unloadBarrier.wait()]).then()},Nu);function Nu(t,e,n){this._requestBarrier=new Su(t),this._scriptExecutionBarrier=new Wu(e),(this._unloadBarrier=n).watchForPageNavigationTriggers&&n.watchForPageNavigationTriggers()}function Ru(t,e){var n=E.calculateSelectTextArguments(e[0],t);return new E.SelectText(e[0],n.startPos,n.endPos,t.options)}function xu(t){if(!_.domUtils.isFileInput(t))throw new xn}function Du(r,o){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return f(r)?[4,(e=r,i={stack:(n=o).stack,pageUrl:n.pageUrl,message:n.msg},e.args=[[i]],new fr(e).getResult())]:[3,2];case 1:return[2,t.sent()];case 2:return[2,r||!1]}var e,n,i})})}Sa.ACTIONS_HANDLERS[h.dispatchEvent]={additionalSelectorProps:["relatedTarget"],create:function(t,e){return e[1]&&(t.options.relatedTarget=e[1]),new E.DispatchEvent(e[0],t.eventName,t.options)}},Sa.ACTIONS_HANDLERS[h.pressKey]={create:function(t,e,n){return new E.Press(_.parseKeySequence(t.keys).combinations,t.options,n)},ensureCmdArgs:function(t){if(_.parseKeySequence(t.keys).error)throw new An("keys")}},Sa.ACTIONS_HANDLERS[h.click]={create:function(t,e,n){return/option|optgroup/.test(_.domUtils.getTagName(e[0]))?new E.SelectChildClick(e[0],t.options):new E.Click(e[0],t.options,bc,E.cursor,n)}},Sa.ACTIONS_HANDLERS[h.rightClick]={create:function(t,e){return new E.RClick(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.doubleClick]={create:function(t,e){return new E.DblClick(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.hover]={create:function(t,e,n){return new E.Hover(e[0],t.options,n)}},Sa.ACTIONS_HANDLERS[h.drag]={create:function(t,e){return new E.DragToOffset(e[0],t.dragOffsetX,t.dragOffsetY,t.options)}},Sa.ACTIONS_HANDLERS[h.dragToElement]={additionalSelectorProps:["destinationSelector"],create:function(t,e){return new E.DragToElement(e[0],e[1],t.options)}},Sa.ACTIONS_HANDLERS[h.scroll]={create:function(t,e){var n=t.x,i=t.y,r=t.position,o=t.options;return new E.SetScroll(e[0],{x:n,y:i,position:r},o)}},Sa.ACTIONS_HANDLERS[h.scrollBy]={create:function(t,e){var n=t.byX,i=t.byY,r=t.options;return new E.SetScroll(e[0],{byX:n,byY:i},r)}},Sa.ACTIONS_HANDLERS[h.scrollIntoView]={create:function(t,e){return new E.ScrollIntoView(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.typeText]={create:function(t,e,n){return new E.Type(e[0],t.text,t.options,n)}},Sa.ACTIONS_HANDLERS[h.selectText]={create:Ru,ensureElsProps:function(t){if(!_.domUtils.isEditableElement(t[0]))throw new pn}},Sa.ACTIONS_HANDLERS[h.selectTextAreaContent]={create:Ru,ensureElsProps:function(t){if(!_.domUtils.isTextAreaElement(t[0]))throw new gn}},Sa.ACTIONS_HANDLERS[h.selectEditableContent]={additionalSelectorProps:["startSelector","endSelector"],create:function(t,e){return t.endSelector=t.endSelector||t.startSelector,new E.SelectEditableContent(e[0],e[1],t.options)},ensureElsProps:function(t){if(!_.domUtils.isContentEditableElement(t[0]))throw new yn("startSelector");if(!_.domUtils.isContentEditableElement(t[1]))throw new yn("endSelector");if(!_.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Cn}},Sa.ACTIONS_HANDLERS[h.setFilesToUpload]={create:function(t,e,n){return new E.Upload(e[0],t.filePath,function(t,e){return new Tn(t,e)},n)},ensureElsProps:function(t){return xu(t[0])}},Sa.ACTIONS_HANDLERS[h.clearUpload]={create:function(t,e){return new E.Upload(e[0])},ensureElsProps:function(t){return xu(t[0])}};var Pu,Mu=s.settings,Fu=s.transport,Ou=s.Promise,ku=s.eventSandbox.message,Lu=s.storages,Uu=s.nativeMethods,Hu=Uu.date,Gu=s.eventSandbox.listeners,Bu=s.utils.url,Vu="testcafe|driver|test-done-sent-flag",qu="testcafe|driver|pending-status",zu="testcafe|driver|executing-client-function-descriptor",Xu="testcafe|driver|executing-skip-js-errors-function-flag",ju="testcafe|driver|selector-execution-start-time",Yu="testcafe|driver|pending-page-error",Ju="testcafe|driver|active-iframe-selector",Ku="testcafe|driver|test-speed",$u="testcafe|driver|assertion-retries-timeout",Qu="testcafe|driver|assertion-retries-start-time",Zu="testcafe|driver|console-messages",tc="testcafe|driver|pending-child-window-count",ec={NotLoadedError:Vn,NotFoundError:ze,IsInvisibleError:Ye},nc={NotLoadedError:Xn,NotFoundError:xi,IsInvisibleError:Mi},ic=Math.pow(2,31)-1,rc="status-with-command-result-event",oc="empty-command-event",sc="child-window-closed",ac="skip-js-errors-function-execution-complete",lc=(t(uc,Pu=_.serviceUtils.EventEmitter),uc.prototype._isOpenedInIframe=function(){var t=bc.opener;return t&&t.top&&t.top!==t},Object.defineProperty(uc.prototype,"speed",{get:function(){return this.contextStorage.getItem(Ku)},set:function(t){this.contextStorage.setItem(Ku,t)},enumerable:!1,configurable:!0}),Object.defineProperty(uc.prototype,"consoleMessages",{get:function(){return new Ki(this.contextStorage.getItem(Zu))},set:function(t){this.contextStorage.setItem(Zu,t?t.getCopy():null)},enumerable:!1,configurable:!0}),uc.prototype._getReadyPromise=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,_.eventUtils.documentReady(this.options.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},uc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},uc.prototype._getCurrentWindowId=function(){if(this.options.nativeAutomation)return this.runInfo.windowId;var t=bc.location.toString(),e=s.utils.url.parseProxyUrl(t);return e&&e.windowId||null},uc.prototype._onJsError=function(n){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:if(this.contextStorage.getItem(Vu))return[2];if(!this.options.skipJsErrors)return[3,6];this.contextStorage.setItem(Xu,!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,Du(this.options.skipJsErrors,n)];case 2:return t.sent()||this._setUncaughtErrorOnPage(n),[3,5];case 3:return e=t.sent(),this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,e),[3,5];case 4:return this.contextStorage.setItem(Xu,!1),this.emit(ac),[7];case 5:return[2];case 6:return this._setUncaughtErrorOnPage(n),[2]}})})},uc.prototype._setUncaughtErrorOnPage=function(t){var e=new zt(t.stack,t.pageUrl);this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,e)},uc.prototype._unlockPageAfterTestIsDone=function(){return this.options.nativeAutomation||_.disableRealEventsPreventing(),Ou.resolve()},uc.prototype._getActiveElement=function(){return l(this,void 0,void 0,function(){var e;return C(this,function(t){return e=_.domUtils.getActiveElement(),[2,this.replicator.encode(e)]})})},uc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(zu);return!!t&&(this._onReady(new Cs({isCommandResult:!0,executionError:new Rt(t.instantiationCallsiteName)})),!0)},uc.prototype.onCustomClientScriptError=function(t,e){var n=e?new ie(t,e):new te(t);this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,n)},uc.prototype._addChildWindowDriverLink=function(t,e){var n=new gu(t,e);this.childWindowDriverLinks.push(n),this._ensureClosedChildWindowWatcher()},uc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=Uu.setInterval.call(bc,function(){var t=_.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(sc),_.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(Uu.clearInterval.call(bc,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},uc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===_u},uc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Ou.resolve().then(function(){return _.browser.setActiveWindowId(t.communicationUrls.activeWindowId,s.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new Cs({isCommandResult:!0,executionError:new ei}))}))},uc.prototype._onBeforeChildWindowOpened=function(t){this.options.nativeAutomation&&(this.options.experimentalMultipleWindows||(this._onReady(new Cs({isCommandResult:!0,executionError:new Vi})),t.isPrevented=!0))},uc.prototype._ensureNewWindowOpenedInNativeAutomation=function(n){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,_.browser.ensureWindowInNativeAutomation(this.communicationUrls.ensureWindowInNativeAutomationUrl,s.createNativeXHR)];case 1:return(e=t.sent()).windowId?(n.form?Uu.formSubmit.apply(n.form):Uu.windowOpen.call(bc,n.pageUrl,n.windowName),[2,e.windowId]):[2,null]}})})},uc.prototype._onChildWindowOpened=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return e=n.windowId,!this.options.nativeAutomation||i?[3,2]:(this._waitChildWindowOpenedInNativeAutomation=this._ensureNewWindowOpenedInNativeAutomation(n),[4,this._waitChildWindowOpenedInNativeAutomation]);case 1:if(!(e=t.sent()))return[2];t.label=2;case 2:return this._addChildWindowDriverLink(n.window,e),this._switchToChildWindow(e),[2]}})})},uc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(tc,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},uc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(Vu)&&(t.preventSubmit=!0)},uc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,i=this.consoleMessages;i.addMessage(e,n,this.windowId),this.consoleMessages=i},uc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(Yu);e&&(this.contextStorage.setItem(Yu,null),t.pageError=e)},uc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},uc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},uc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=this._isPendingSwitchingWindow()},uc.prototype._sendStatusRequest=function(t){function e(){return _.getTimeLimitedPromise(Fu.asyncServiceMsg(i),5e3)}function n(){return _.delay(300).then(e)}for(var i={cmd:d.ready,status:t,disableResending:!0,allowRejecting:!0},r=e(),o=0;o<u;o++)r=r.catch(n);return r},uc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem(qu,t);var n=null;return _.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,_.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem(qu,null),n})},uc.prototype._addChildIframeDriverLink=function(t,e){var n,i=this._getChildIframeDriverLinkByWindow(e);i||(n="".concat(this.testRunId,"-").concat(Rr()),i=new bs(e,n,{single:this.communicationUrls.dispatchNativeAutomationEvent,sequence:this.communicationUrls.dispatchNativeAutomationEventSequence}),this.childIframeDriverLinks.push(i)),i.sendConfirmationMessage(t)},uc.prototype._getTargetWindowNotFoundResult=function(t,e){return Ou.resolve({success:!1,errCode:t,errMsg:e})},uc.prototype._getChildWindowValidateResult=function(t){var e=t.find(function(t){return t.result.success});if(e)return e.result;var n=t.find(function(t){return t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError||t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},uc.prototype._handleWindowValidation=function(n,i,r,o){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,i,r,o)];case 1:return e=t.sent(),Ws({requestMsgId:n.id,window:i,result:e}),[2]}})})},uc.prototype._getWindowInfo=function(){var t=bc.location.toString();return this.options.nativeAutomation||(t=s.utils.url.parseProxyUrl(t).destUrl),{id:this.windowId,title:Tc.title,url:t}},uc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},uc.prototype._validateWindow=function(i,t,r,o){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return this._isTargetWindow(i)?[2,r()]:this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(i,o)}),[4,Ou.all(e)]):[2,this._getTargetWindowNotFoundResult(_.TEST_RUN_ERRORS.targetWindowNotFoundError)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},uc._createWindowValidationError=function(t){var e=t.errCode;return new(e===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError?ai:e===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent?ci:gi)},uc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Ou.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError}):Ou.resolve({success:!0}):Ou.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent})},uc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},to)},uc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Ou.resolve({success:!0})},io)},uc.prototype._handleCloseWindow=function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),Ws({requestMsgId:e.id,window:n}),[2]}})})},uc.prototype._closeWindowAndWait=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return e=this._createWaitForEventPromise(sc,2e3),n.ignoreMasterSwitching=!i.isCurrentWindow,this.closing?[3,2]:(this.closing=!0,[4,_.browser.closeWindow(this.communicationUrls.closeWindow,s.createNativeXHR,this.windowId)]);case 1:t.sent(),t.label=2;case 2:return n.driverWindow.close(),[2,e]}})})},uc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Ou.resolve();var t=this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId});if(t)return this._closeWindowAndWait(t,e);var n=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,uo)});return Ou.all(n)},uc.prototype._getWindows=function(){return l(this,void 0,void 0,function(){var e,n,i,r,o,s;return C(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},so)}),[4,Ou.all(e)]):[2,[this._getWindowInfo()]];case 1:for(n=t.sent(),i=[this._getWindowInfo()],r=0,o=n;r<o.length;r++)s=o[r],Array.isArray(s.result)&&(i=i.concat(s.result));return[2,i]}})})},uc.prototype._handleGetWindows=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,i)];case 1:return e=t.sent(),Ws({requestMsgId:n.id,window:i,result:e}),[2]}})})},uc.prototype._handleSwitchToWindow=function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),Ws({requestMsgId:e.id,window:n}),[2]}})})},uc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Ou.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Ou.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,po)})):Ou.resolve()},uc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,Ws({requestMsgId:t.id,window:e}),Ou.resolve().then(function(){return _.browser.setActiveWindowId(n.communicationUrls.activeWindowId,s.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new Cs({isCommandResult:!0,executionError:new ei}))}))},uc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){Ws({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new Cs({isCommandResult:!0,executionError:new ri}))})},uc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},uc.prototype._handleHasPendingActionFlags=function(t,e){var n=this._hasPendingActionFlags(this.contextStorage);Ws({requestMsgId:t.id,window:e,result:n})},uc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink(e,t.windowId),this.childWindowDriverLinks.length===this.contextStorage.getItem(tc)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(tc,0)),Ws({requestMsgId:t.id,window:e}))},uc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Ou(function(t){e._resolvePendingChildWindowInIframe=t})},uc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){Ws({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId},!0)},uc.prototype._handleStopInternalFromFrame=function(t,e){Ws({requestMsgId:t.id,window:e}),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._stopInternal()},uc.prototype._initChildDriverListening=function(){var i=this;ku.on(ku.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case Pr:i._addChildIframeDriverLink(e.id,n);break;case Yr:i._handleChildWindowIsOpenedInIFrame(e,n);break;case jr:i._handleChildWindowIsLoadedInIFrame(e,n);break;case Jr:i._handleStopInternalFromFrame(e,n);break;case Vr:i._handleSetAsMasterMessage(e,n);break;case Mr:i._handleSwitchToWindow(e,n);break;case Fr:i._handleCloseWindow(e,n);break;case kr:i._handleSwitchToWindowValidation(e,n);break;case Or:i._handleCloseWindowValidation(e,n);break;case Lr:i._handleGetWindows(e,n);break;case qr:i._handleCloseAllWindowsMessage(e,n);break;case zr:i._handleStartToRestoreChildLinkMessage();break;case Kr:i._handleHasPendingActionFlags(e,n);break;case Xr:i._handleRestoreChildLink(e,n)}})},uc.prototype._getChildIframeDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},uc.prototype._getChildWindowDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},uc.prototype._runInActiveIframe=function(t){var e=this,n=Ou.resolve(),i=this.contextStorage.getItem(Ju);!this.activeChildIframeDriverLink&&i&&(n=this._switchToIframe(i,nc)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed,e.options.nativeAutomation)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new Cs({isCommandResult:!0,executionError:t}))})},uc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Ou.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},uc.prototype._ensureChildIframeDriverLink=function(t,e,n){var i=this;return _.waitFor(function(){return i._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},uc.prototype._ensureChildWindowDriverLink=function(t,e,n){var i=this;return _.waitFor(function(){return i._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},uc.prototype._switchToIframe=function(e,n){var t,i,r,o,s,a,l,u=this,c="number"==typeof e.timeout,d=c?e.timeout:this.options.selectorTimeout;return t=e,i=d,r=null,o=function(t){return new n.NotFoundError(null,t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new Ra(t,i,r,o,s),a.showWaitingElementStatus(l.timeout),l.getResult().then(function(t){return a.hideWaitingElementStatus(!!t).then(function(){return t})}).catch(function(t){return a.hideWaitingElementStatus(!1).then(function(){throw t})}).then(function(t){if(!_.domUtils.isIframeElement(t))throw new Hn;var e=c?d:Math.max(d,5e3);return u._ensureChildIframeDriverLink(Uu.contentWindowGetter.call(t),n.NotLoadedError,e)}).then(function(t){t.availabilityTimeout=d,u.activeChildIframeDriverLink=t,u.contextStorage.setItem(Ju,e)})},uc.prototype._createWaitForEventPromise=function(e,n){var i=this,r=null,t=new Ou(function(t){Uu.setTimeout.call(bc,function(){i.off(e,r),t()},n)}),o=new Ou(function(t){r=function(){this.off(e,r),t()},i.on(e,r)});return Ou.race([t,o])},uc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(rc,ic):Ou.resolve()},uc.prototype._waitForSkipJsErrorFunctionCompletion=function(n){var i=this;return this.contextStorage.getItem(Xu)?new Ou(function(t){var e=function(){i.off(ac,e),t(n)};i.on(ac,e)}):Ou.resolve(n)},uc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(oc,3e4)},uc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw _.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Ai},uc.prototype._switchToChildWindow=function(t){var e=this;this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0);var n=this.contextStorage.getItem(this.WINDOW_COMMAND_API_CALL_FLAG);return function(e,t){if("string"!=typeof e)return mu.resolve(null);var n=_.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return mu.resolve(n);var i=new Jn;return mu.reject(i)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,Qn,e.options.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return e._observeFileDownloadingInNewWindow(),e._abortSwitchingToChildWindowIfItClosed(),e._stopInternal(),e.activeChildWindowDriverLink.setAsMaster(n)}).then(function(){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(t){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1),t instanceof Ai?e._onReady(new Cs):e._onReady(new Cs({isCommandResult:!0,executionError:new ei}))})},uc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},uc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},uc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Ou.resolve().then(function(){return n._stopInternal(),t(e)}).then(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1),n._onReady(new Cs({isCommandResult:!0,executionError:new ei}))})},uc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},uc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(Ju,null),this.activeChildIframeDriverLink=null},uc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new Ao(t),n=0;n<this.childIframeDriverLinks.length;n++)ku.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},uc.prototype.createDispatchNativeAutomationEventFunctions=function(){return this.options.nativeAutomation?{single:this._createDispatchNativeAutomationEventFn("dispatchNativeAutomationEvent"),sequence:this._createDispatchNativeAutomationEventFn("dispatchNativeAutomationEventSequence")}:null},uc.prototype._createDispatchNativeAutomationEventFn=function(t){return Uu.functionBind.call(_.browser[t],_.browser[t],this.communicationUrls[t],s.createNativeXHR)},uc.prototype._onActionCommand=function(t){var o=this,e=new Sa(t,{globalSelectorTimeout:this.options.selectorTimeout,testSpeed:this.speed,executeSelectorFn:function(t,e,n){var i=ea(e.notFound),r=ea(e.invisible);return new Ra(t,o.options.selectorTimeout,n,i,r).getResult()},dispatchNativeAutomationEventFn:this.createDispatchNativeAutomationEventFunctions()}),n=[];e.on(Sa.EXECUTION_STARTED_EVENT,function(){o.statusBar.hideWaitingElementStatus(!0),o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),e.on(Sa.WAITING_FOR_ELEMENT_EVENT,function(t){o.statusBar.showWaitingElementStatus(t)}),e.on(Sa.WARNING_EVENT,function(t){n.push(t)});var i=new _.ClientRequestEmitter,r=new _.ScriptExecutionEmitter,s=new Tu(i,r,_.pageUnloadBarrier);e.execute(s).then(function(t){return new Cs({isCommandResult:!0,result:nr(new Cu).encode(t),warnings:n})}).catch(function(t){return o.statusBar.hideWaitingElementStatus(!1).then(function(){return new Cs({isCommandResult:!0,executionError:t})})}).then(function(t){return o._waitForSkipJsErrorFunctionCompletion(t)}).then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o.contextStorage.setItem(Xu,!1),o._waitChildWindowOpenedInNativeAutomation?o._waitChildWindowOpenedInNativeAutomation.then(function(){return t}):t}).then(function(t){o._onReady(t)})},uc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},uc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onNavigateToCommand=function(t){var e,n,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),this.options.nativeAutomation&&(void 0===(n=t.url)&&(n=""),0===n.indexOf("file://"))?(e={createXHR:s.createNativeXHR,openFileProtocolUrl:this.communicationUrls.openFileProtocolUrl},_.browser.redirectUsingCdp(t,e)):function(r){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new _.ClientRequestEmitter,n=new _.RequestBarrier(e),c.navigateTo(r.url,r.forceReload),[4,c.Promise.all([n.wait(),_.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new Cs({isCommandResult:!0})];case 2:return i=t.sent(),[2,new Cs({isCommandResult:!0,executionError:i})];case 3:return[2]}})})}(t).then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},uc.prototype._onGetProxyUrlCommand=function(t){this._onReady(new Cs({isCommandResult:!0,result:Bu.getProxyUrl(t.url,t.options)}))},uc.prototype._onSkipJsErrorsCommand=function(t){var e=t.options;this.options.skipJsErrors=e,this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(zu,{instantiationCallsiteName:t.instantiationCallsiteName}),fu(new fr(t)).then(function(t){e.contextStorage.setItem(zu,null),e._onReady(t)})},uc.prototype._onExecuteSelectorCommand=function(t){var e,n,i,r,o,s,a,l=this,u=this.contextStorage.getItem(ju)||new Hu,c=ea("CannotObtainInfoForElementSpecifiedBySelectorError"),d=t.strictError?ea(ta()):c,h=t.strictError?ea(Zs()):c;e=t,n=this.options.selectorTimeout,i=u,r=t.needError?d:null,o=t.needError?h:null,s=this.statusBar,a=new Ra(e,n,i,r,o),s.showWaitingElementStatus(a.timeout),fu(a).then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem(ju,null),l._onReady(t)})},uc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,ec).then(function(){return e._onReady(new Cs({isCommandResult:!0}))}).catch(function(t){return e._onReady(new Cs({isCommandResult:!0,executionError:t}))})},uc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),bc.open(t.url)},uc.prototype._onWindowCloseCommand=function(a){return l(this,void 0,void 0,function(){var e,n,i,r,o,s;return C(this,function(t){switch(t.label){case 0:e=this._getTopOpenedWindow(),n=a.windowId||this.windowId,i=n===this.windowId,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this._validateChildWindowCloseCommandExists(n,e)];case 2:if(r=t.sent(),!(o=r.result).success)throw uc._createWindowValidationError(o);return[4,Ss(new uo({windowId:n,isCurrentWindow:i}),e,As,ei)];case 3:return t.sent(),i||this._onReady(new Cs({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new Cs({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},uc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:{id:this.windowId}}))},uc.prototype._onGetWindowsCommand=function(){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,Ss(new so,e,As,ei)];case 1:return n=t.sent(),this._onReady(new Cs({isCommandResult:!0,result:n.result})),[2]}})})},uc.prototype._validateChildWindowCloseCommandExists=function(t,e){return Ss(new to({windowId:t}),e,As,ei)},uc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,i=t.fn;return Ss(new io({windowId:n,fn:i}),e,As,ei)},uc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||bc).top},uc.prototype._onSwitchToWindow=function(r,o){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:r.windowId,fn:r.checkWindow},e)];case 1:return n=t.sent(),(i=n.result).success?(this._stopInternal(),Ss(new po({windowId:r.windowId,fn:r.checkWindow}),e,As,ei)):this._onReady(new Cs({isCommandResult:!0,executionError:o||uc._createWindowValidationError(i)})),[2]}})})},uc.prototype._restoreChildWindowLinks=function(){return l(this,void 0,void 0,function(){var e,n,i=this;return C(this,function(t){switch(t.label){case 0:if(!(e=this.contextStorage.getItem(tc))||e===this.childWindowDriverLinks.length)return[2];n=new Ou(function(t){i._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,_.getTimeLimitedPromise(n,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new Cs({isCommandResult:!0,executionError:new Ti})),[3,4];case 4:return[2]}})})},uc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Ci)},uc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new Cs({isCommandResult:!0,executionError:new yi}))},uc.prototype._onBrowserManipulationCommand=function(t){var e,n,i,r=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.options.selectorTimeout,i=this.statusBar,new hu(e,n,i).execute().then(function(t){return r.contextStorage.setItem(r.COMMAND_EXECUTING_FLAG,!1),r._onReady(t)})},uc.prototype._onSetBreakpointCommand=function(t){var n=this,e=t.isTestError,i=t.selector,r=this.statusBar.showDebuggingStatus(e);this.selectorInspectorPanel.show(i),r.then(function(t){var e=t===y;n._onReady(new Cs({isCommandResult:!0,result:e}))})},uc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem($u,t.timeout),this.contextStorage.setItem(Qu,Uu.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem($u,null),this.contextStorage.setItem(Qu,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new Cs({isCommandResult:!0}))})},uc.prototype._checkStatus=function(){var i=this,t={statusUrl:this.communicationUrls.statusDone};return _.browser.checkStatus(t,s.createNativeXHR,{manualRedirect:!0,nativeAutomation:this.options.nativeAutomation}).then(function(t){var e,n=t.command;n.testRunId!==i.testRunId?(Lu.clear(),Lu.lock(),e={createXHR:s.createNativeXHR,openFileProtocolUrl:i.communicationUrls.openFileProtocolUrl,nativeAutomation:i.options.nativeAutomation},_.browser.redirect(n,e)):(i.contextStorage.setItem(Vu,!1),i._onReady({isCommandResult:!1}))}).catch(function(){return _.delay(1e3)})},uc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new Cs({isCommandResult:!0,result:t}))})},uc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Ou.all(this.childWindowDriverLinks.map(function(t){return t.ignoreMasterSwitching=!0,t.closeAllChildWindows()})).then(function(){Uu.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Ou.resolve()},uc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(Vu,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new Cs({isCommandResult:!0,executionError:ri}))})},uc.prototype._onBackupStoragesCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:Lu.backup()}))},uc.prototype._isPendingSwitchingWindow=function(){return!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},uc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&this._isPendingSwitchingWindow()},uc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&this._isPendingSwitchingWindow()},uc.prototype._observeFileDownloadingInNewWindow=function(){var e=this,t=new Cs({isObservingFileDownloadingInNewWindow:!0});this._isPendingSwitchingWindow()&&this._sendStatus(t).then(function(t){t?e._onCommand(t):e._observeFileDownloadingInNewWindow()})},uc.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(rc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(oc);e._onReady(new Cs)}})},uc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.selectorInspectorPanel&&this.selectorInspectorPanel.hide(),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===h.testDone?this._onTestDone(new Cs({isCommandResult:!0})):t.type===h.setBreakpoint?this._onSetBreakpointCommand(t):t.type===h.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===h.switchToIframe?this._onSwitchToIframeCommand(t):t.type===h.openWindow?this._onWindowOpenCommand(t):t.type===h.closeWindow?this._onWindowCloseCommand(t):t.type===h.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===h.getCurrentWindows?this._onGetWindowsCommand():t.type===h.switchToWindow?this._onSwitchToWindow(t):t.type===h.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===h.switchToParentWindow?this._onSwitchToParentWindow():g(t)?this._onBrowserManipulationCommand(t):t.type===h.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===h.executeSelector?this._onExecuteSelectorCommand(t):t.type===h.navigateTo?this._onNavigateToCommand(t):t.type===h.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===h.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===h.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===h.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===h.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===h.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===h.backupStorages?this._onBackupStoragesCommand():t.type===h.closeChildWindowOnFileDownloading?this._closeChildWindowOnFileDownloading():t.type===h.getProxyUrl?this._onGetProxyUrlCommand(t):t.type===h.skipJsErrors?this._onSkipJsErrorsCommand(t):this._onActionCommand(t)},uc.prototype._closeChildWindowOnFileDownloading=function(){this.activeChildWindowDriverLink.closeFileDownloadingWindow(),_.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),E.cursor.show(),this._startInternal()},uc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===h.testDone||e.type===h.switchToMainWindow||e.type===h.setNativeDialogHandler||e.type===h.getNativeDialogHistory||e.type===h.setTestSpeed||e.type===h.showAssertionRetriesStatus||e.type===h.hideAssertionRetriesStatus||e.type===h.setBreakpoint||g(e)&&e.type!==h.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},uc.prototype._onCommand=function(n){var i=this;this.readyPromise.then(function(){var t,e=p(n);i.contextStorage.getItem(Yu)&&e?i._onReady(new Cs({isCommandResult:!0})):(t=i.activeChildIframeDriverLink||i.contextStorage.getItem(Ju),i._isExecutableInTopWindowOnly(n)||!t?i._executeCommand(n):i._runInActiveIframe(n))})},uc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},uc.prototype._startInternal=function(t){this.role=_u,_.browser.startHeartbeat(this.communicationUrls.heartbeat,s.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},uc.prototype._stopInternal=function(){this.role=Eu,_.browser.stopHeartbeat(),E.cursor.hide()},uc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem($u);e&&(t=n.contextStorage.getItem(Qu),0<e-(new Hu-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},uc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,i=this.contextStorage.getItem(qu);i&&(i.resent=!0),this.contextStorage.getItem(Vu)?i?this._onTestDone(i):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=i||new Cs({isCommandResult:e,isFirstRequestAfterWindowSwitching:t.isFirstRequestAfterWindowSwitching,result:t.result}),this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!1),this._onReady(n))},uc.prototype._initParentWindowLink=function(){bc.opener&&bc.opener!==bc&&this.windowId&&(this.parentWindowDriverLink=new wu(bc))},uc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},uc.prototype._getDriverRole=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return this.windowId||this.options.nativeAutomation?[4,_.browser.getActiveWindowId(this.communicationUrls.activeWindowId,s.createNativeXHR)]:[2,_u];case 1:return[2,t.sent().activeWindowId===this.windowId?_u:Eu]}})})},uc.prototype._init=function(){var t=this.options,e=t.nativeAutomation,n=t.dialogHandler,i=t.speed;this.contextStorage=new ls(bc,{testRunId:this.testRunId,windowId:this.windowId,nativeAutomation:e}),this.nativeDialogsTracker=new Tr(this.contextStorage,{nativeAutomation:e,dialogHandler:n}),this.statusBar=new o.StatusBar(this.runInfo.userAgent,this.runInfo.fixtureName,this.runInfo.testName,this.contextStorage,e),this.selectorInspectorPanel=new o.SelectorInspectorPanel(this.statusBar);var r=this;this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,function(){r.options.nativeAutomation||_.disableRealEventsPreventing()}),this.speed=i,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&Ss(new Ho(this.windowId),bc.opener.top,As,gi)},uc.prototype._doFirstPageLoadSetup=function(){return l(this,void 0,void 0,function(){return C(this,function(t){return this.isFirstPageLoad&&this.options.canUseDefaultWindowActions,[2]})})},uc.prototype.start=function(){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return this._init(),[4,this._doFirstPageLoadSetup()];case 1:return t.sent(),[4,this._restoreChildWindowLinks()];case 2:return t.sent(),[4,this._getDriverRole()];case 3:return e=t.sent(),this.role===_u||e===_u&&this._startInternal(),[2]}})})},uc);function uc(t,e,n,i){var r=Pu.call(this)||this;r.COMMAND_EXECUTING_FLAG="testcafe|driver|command-executing-flag",r.EXECUTING_IN_IFRAME_FLAG="testcafe|driver|executing-in-iframe-flag",r.PENDING_WINDOW_SWITCHING_FLAG="testcafe|driver|pending-window-switching-flag",r.WINDOW_COMMAND_API_CALL_FLAG="testcafe|driver|window-command-api-flag",r.testRunId=t,r.communicationUrls=e,r.runInfo=n,r.options=i,r.isFirstPageLoad=Mu.get().isFirstPageLoad,r.customCommandHandlers={},r.contextStorage=null,r.nativeDialogsTracker=null,r.childIframeDriverLinks=[],r.activeChildIframeDriverLink=null,r.childWindowDriverLinks=[],r.parentWindowDriverLink=null,r.statusBar=null,r.selectorInspectorPanel=null,r.windowId=r._getCurrentWindowId(),r.role=Eu,r.setAsMasterInProgress=!1,r.checkClosedChildWindowIntervalId=null;var o=new _.ClientRequestEmitter;return r.pageInitialRequestBarrier=new _.RequestBarrier(o),r.readyPromise=r._getReadyPromise(),r._initChildDriverListening(),_.pageUnloadBarrier.init(),r.options.nativeAutomation||_.preventRealEvents(),s.on(s.EVENTS.uncaughtJsError,function(t){return r._onJsError(t)}),s.on(s.EVENTS.unhandledRejection,function(t){return r._onJsError(t)}),s.on(s.EVENTS.consoleMethCalled,function(t){return r._onConsoleMessage(t)}),s.on(s.EVENTS.beforeFormSubmit,function(t){return r._onFormSubmit(t)}),s.on(s.EVENTS.beforeWindowOpened,function(t){return r._onBeforeChildWindowOpened(t)}),s.on(s.EVENTS.windowOpened,function(t){return r._onChildWindowOpened(t)}),r.setCustomCommandHandlers(h.unlockPage,function(){return r._unlockPageAfterTestIsDone()}),r.setCustomCommandHandlers(h.getActiveElement,function(){return r._getActiveElement()}),Gu.addInternalEventBeforeListener(bc,["beforeunload"],function(){r._sendStartToRestoreCommand()}),r.replicator=nr([new zs]),r}var cc=(dc.prototype.establishConnection=function(){return Ss(new $r,this.driverWindow,5e3,Xn).then(function(t){return t.result})},dc.prototype.sendConfirmationMessage=function(t){Ws({requestMsgId:t,window:this.driverWindow})},dc.prototype.onCommandExecuted=function(t){var e=new go(t);c.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},dc.prototype.hasPendingActionFlags=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,Ss(new Jo,this.driverWindow,5e3,Xn)];case 1:return[2,t.sent().result]}})})},dc);function dc(t){this.driverWindow=t}var hc,pc=s.eventSandbox.message,fc=(t(mc,hc=Tr),mc.prototype._defaultDialogHandler=function(t){pc.sendServiceMsg({type:vr,dialogType:t,url:Tr._getPageUrl()},bc.top)},mc.prototype._addAppearedDialogs=function(t,e){pc.sendServiceMsg({type:gr,dialogType:t,text:e,url:Tr._getPageUrl()},bc.top)},mc.prototype._onHandlerError=function(t,e){pc.sendServiceMsg({type:wr,dialogType:t,message:e,url:Tr._getPageUrl()},bc.top)},mc);function mc(t){return hc.call(this,null,t)||this}var gc,vc=c.eventSandbox.message,wc=(t(yc,gc=lc),yc.prototype._onJsError=function(){},yc.prototype._onConsoleMessage=function(){},yc.prototype._onChildWindowOpened=function(e){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return this.options.nativeAutomation?[4,this._ensureNewWindowOpenedInNativeAutomation(e)]:[3,2];case 1:if(!t.sent())return[2];t.label=2;case 2:return vc.sendServiceMsg(new Vo,bc.top),[2]}})})},yc.prototype._stopInternal=function(){vc.sendServiceMsg(new Xo,bc.top)},yc.prototype._initParentDriverListening=function(){var n=this;c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;_.pageUnloadBarrier.wait(0).then(function(){if(e.type===Hr){if(n.lastParentDriverMessageId===e.id)return;n.lastParentDriverMessageId=e.id,n.readyPromise.then(function(){n.speed=e.testSpeed,n.parentDriverLink.sendConfirmationMessage(e.id),n._onCommand(e.command)})}e.type===Br&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},yc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},yc.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},yc.prototype._isInCommandExecution=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return c.utils.dom.isCrossDomainWindows(bc,bc.parent)?[4,this.parentDriverLink.hasPendingActionFlags()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,this._hasPendingActionFlags(this.contextStorage)]}})})},yc.prototype._init=function(){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return[4,this.parentDriverLink.establishConnection()];case 1:return e=t.sent(),n=e.id,i=e.dispatchNativeAutomationEventUrls,this.contextStorage=new ls(bc,{testRunId:n,windowId:this.windowId,nativeAutomation:this.options.nativeAutomation}),this.communicationUrls.dispatchNativeAutomationEvent=i.single,this.communicationUrls.dispatchNativeAutomationEventSequence=i.sequence,this._failIfClientCodeExecutionIsInterrupted()?[2]:[4,this._isInCommandExecution()];case 2:return t.sent()&&(this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._onReady(new Cs({isCommandResult:!0}))),[2]}})})},yc.prototype.start=function(){this.nativeDialogsTracker=new fc({dialogHandler:this.options.dialogHandler,nativeAutomation:this.options.nativeAutomation}),this.statusBar=new n.IframeStatusBar;var t=this._init();this.readyPromise=c.Promise.all([this.readyPromise,t])},yc);function yc(t,e,n){var i=gc.call(this,t,e,{},n)||this;return i.lastParentDriverMessageId=null,i.parentDriverLink=new cc(bc.parent),i._initParentDriverListening(),i}var _c={NodeSnapshot:Os,ElementSnapshot:Vs,SelectorExecutor:Ra},Ec="%testCafeDriver%",Cc="%testCafeIframeDriver%",Ic="%testCafeEmbeddingUtils%",Sc=s.nativeMethods,Ac=s.EVENTS.evalIframeScript;Sc.objectDefineProperty(bc,Ec,{configurable:!0,value:lc}),Sc.objectDefineProperty(bc,Cc,{configurable:!0,value:wc}),Sc.objectDefineProperty(bc,Ic,{configurable:!0,value:_c}),s.on(Ac,function(t){return Wc(Sc.contentWindowGetter.call(t.iframe))})}(bc["%hammerhead%"],bc["%hammerhead%"].Promise,bc["%testCafeCore%"],bc["%testCafeAutomation%"],bc["%testCafeUI%"])}(window);
|
|
1
|
+
window["%hammerhead%"].utils.removeInjectedScript(),function Wc(bc){var Tc=bc.document;!function(c,e,_,E,n){var s="default"in c?c.default:c;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var o="default"in n?n.default:n,i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function l(t,s,a,l){return new(a=a||e)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function r(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}o((l=l.apply(t,s||[])).next())})}function C(n,i){var r,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},l={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function t(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;l&&e[l=0]&&(a=0),a;)try{if(r=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=i.call(n,a)}catch(t){e=[6,t],o=0}finally{r=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var r,a,u=Math.floor(399);(a=r=r||{}).ready="ready",a.readyForBrowserManipulation="ready-for-browser-manipulation",a.waitForFileDownload="wait-for-file-download";var d=r,h={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",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",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",getCurrentCDPSession:"get-current-c-d-p-session",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",getActiveElement:"get-active-element",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",closeChildWindowOnFileDownloading:"close-child-window-on-file-downloading",recorder:"recorder",prepareClientEnvironmentInDebugMode:"prepare-client-environment-in-debug-mode",getCookies:"get-cookies",setCookies:"set-cookies",deleteCookies:"delete-cookies",getProxyUrl:"get-proxy-url",request:"request",skipJsErrors:"skip-js-errors",addRequestHooks:"add-request-hooks",removeRequestHooks:"remove-request-hooks",runCustomAction:"run-custom-action",report:"report"};function p(t){return!(f(i=t)||i.type===h.wait||i.type===h.assertion||i.type===h.executeExpression||g(t)||(n=t).type===h.testDone||n.type===h.showAssertionRetriesStatus||n.type===h.hideAssertionRetriesStatus||n.type===h.setBreakpoint||n.type===h.takeScreenshotOnFail||n.type===h.recorder||n.type===h.getProxyUrl)||m(t)&&!((e=t).type===h.switchToIframe||e.type===h.switchToMainWindow);var e,n,i}function f(t){return t.type===h.executeClientFunction||t.type===h.executeSelector}function m(t){return t.type===h.resizeWindow||t.type===h.resizeWindowToFitDevice||t.type===h.maximizeWindow}function g(t){return(e=t).type===h.takeScreenshot||e.type===h.takeElementScreenshot||e.type===h.takeScreenshotOnFail||m(t);var e}function v(t,e){this.code=t,this.isTestCafeError=!0,this.callsite=e||null}var w,y="step",I="E1",S="E4",A="E5",W="E9",b="E10",T="E11",N="E12",R="E24",x="E26",D="E27",P="E28",M="E29",F="E30",O="E31",k="E32",L="E33",U="E34",H="E35",G="E36",B="E37",V="E39",q="E40",z="E41",X="E42",j="E43",Y="E44",J="E45",K="E46",$="E49",Q="E50",Z="E51",tt="E52",et="E57",nt="E64",it="E65",rt="E68",ot="E69",st="E70",at="E71",lt="E72",ut="E73",ct="E74",dt="E76",ht="E77",pt="E78",ft="E82",mt="E83",gt="E90",vt="E91",wt="E92",yt="E93",_t="E94",Et="E95",Ct="E97",It="E99",St="E100",At="E101",Wt="E102",bt=(t(Tt,w=v),Tt);function Tt(t,e,n){var i=w.call(this,t)||this;return i.optionName=e,i.actualValue=n,i}var Nt,Rt=(t(xt,Nt=v),xt);function xt(t,e){var n=Nt.call(this,$,e)||this;return n.instantiationCallsiteName=t,n}var Dt,Pt=(t(Mt,Dt=v),Mt);function Mt(t,e){var n=Dt.call(this,Q,e)||this;return n.instantiationCallsiteName=t,n}var Ft,Ot=(t(kt,Ft=v),kt);function kt(t,e,n){var i=void 0===e?{}:e,r=i.apiFnChain,o=i.apiFnIndex,s=i.reason,a=Ft.call(this,t,n)||this;return a.apiFnChain=r,a.apiFnIndex=o,a.reason=s,a}var Lt,Ut=(t(Ht,Lt=v),Ht);function Ht(t){return Lt.call(this,Z,t)||this}var Gt,Bt=(t(Vt,Gt=Ot),Vt);function Vt(t,e){return Gt.call(this,tt,e,t)||this}var qt,zt=(t(Xt,qt=v),Xt);function Xt(t,e){var n=qt.call(this,I)||this;return n.errStack=t,n.pageDestUrl=e,n}var jt,Yt=(t(Jt,jt=v),Jt);function Jt(t,e,n){var i=jt.call(this,S,n)||this;return i.errMsg=String(e),i.instantiationCallsiteName=t,i}var Kt,$t=(t(Qt,Kt=v),Qt);function Qt(t,e,n,i){var r=Kt.call(this,A,i)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Zt,te=(t(ee,Zt=v),ee);function ee(t){var e=Zt.call(this,nt)||this;return e.errMsg=String(t),e}var ne,ie=(t(re,ne=v),re);function re(t,e){var n=ne.call(this,it)||this;return n.errMsg=String(t),n.moduleName=e,n}var oe,se=(t(ae,oe=bt),ae);function ae(t,e){return oe.call(this,W,t,e)||this}var le,ue=(t(ce,le=bt),ce);function ce(t,e){return le.call(this,b,t,e)||this}var de,he=(t(pe,de=bt),pe);function pe(t,e){return de.call(this,T,t,e)||this}var fe,me=(t(ge,fe=bt),ge);function ge(t,e){return fe.call(this,N,t,e)||this}var ve,we=(t(ye,ve=bt),ye);function ye(t,e){return ve.call(this,gt,t,e)||this}var _e,Ee=(t(Ce,_e=bt),Ce);function Ce(t,e){return _e.call(this,Ct,t,e)||this}var Ie,Se=(t(Ae,Ie=bt),Ae);function Ae(t,e){return Ie.call(this,vt,t,e)||this}var We,be=(t(Te,We=bt),Te);function Te(t,e){return We.call(this,wt,t,e)||this}var Ne,Re=(t(xe,Ne=bt),xe);function xe(t,e){return Ne.call(this,yt,t,e)||this}var De,Pe=(t(Me,De=bt),Me);function Me(t,e){return De.call(this,_t,t,e)||this}var Fe,Oe=(t(ke,Fe=bt),ke);function ke(t,e){return Fe.call(this,Et,t,e)||this}var Le,Ue=(t(He,Le=bt),He);function He(t,e){return Le.call(this,It,t,e)||this}var Ge,Be=(t(Ve,Ge=v),Ve);function Ve(t,e,n){var i=Ge.call(this,St)||this;return i.objectName=t,i.propertyName=e,i.availableProperties=n,i}var qe,ze=(t(Xe,qe=Ot),Xe);function Xe(t,e){return qe.call(this,R,e,t)||this}var je,Ye=(t(Je,je=Ot),Je);function Je(t,e){return je.call(this,x,e,t)||this}var Ke,$e=(t(Qe,Ke=v),Qe);function Qe(t){var e=Ke.call(this,D)||this;return e.nodeDescription=t,e}var Ze,tn=(t(en,Ze=Ot),en);function en(t,e){var n=Ze.call(this,P,e)||this;return n.argumentName=t,n}var nn,rn=(t(on,nn=v),on);function on(t){return nn.call(this,At,t)||this}var sn,an=(t(ln,sn=Ot),ln);function ln(t,e){var n=sn.call(this,M,e)||this;return n.argumentName=t,n}var un,cn=(t(dn,un=v),dn);function dn(t,e){var n=un.call(this,F)||this;return n.argumentName=t,n.nodeDescription=e,n}var hn,pn=(t(fn,hn=v),fn);function fn(){return hn.call(this,O)||this}var mn,gn=(t(vn,mn=v),vn);function vn(){return mn.call(this,k)||this}var wn,yn=(t(_n,wn=v),_n);function _n(t){var e=wn.call(this,L)||this;return e.argumentName=t,e}var En,Cn=(t(In,En=v),In);function In(){return En.call(this,H)||this}var Sn,An=(t(Wn,Sn=v),Wn);function Wn(t){var e=Sn.call(this,G)||this;return e.argumentName=t,e}var bn,Tn=(t(Nn,bn=v),Nn);function Nn(t,e){var n=bn.call(this,B)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var Rn,xn=(t(Dn,Rn=v),Dn);function Dn(){return Rn.call(this,U)||this}var Pn,Mn=(t(Fn,Pn=v),Fn);function Fn(t,e){var n=Pn.call(this,z)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var On,kn=(t(Ln,On=v),Ln);function Ln(t,e){var n=On.call(this,et)||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}var Un,Hn=(t(Gn,Un=v),Gn);function Gn(t){return Un.call(this,q,t)||this}var Bn,Vn=(t(qn,Bn=v),qn);function qn(){return Bn.call(this,V)||this}var zn,Xn=(t(jn,zn=v),jn);function jn(){return zn.call(this,X)||this}var Yn,Jn=(t(Kn,Yn=v),Kn);function Kn(){return Yn.call(this,ot)||this}var $n,Qn=(t(Zn,$n=v),Zn);function Zn(){return $n.call(this,rt)||this}var ti,ei=(t(ni,ti=v),ni);function ni(){return ti.call(this,st)||this}var ii,ri=(t(oi,ii=v),oi);function oi(){return ii.call(this,at)||this}var si,ai=(t(li,si=v),li);function li(){return si.call(this,ut)||this}var ui,ci=(t(di,ui=v),di);function di(){return ui.call(this,ft)||this}var hi,pi=(t(fi,hi=v),fi);function fi(t){var e=hi.call(this,pt)||this;return e.errMsg=t,e}var mi,gi=(t(vi,mi=v),vi);function vi(){return mi.call(this,ct)||this}var wi,yi=(t(_i,wi=v),_i);function _i(){return wi.call(this,dt)||this}var Ei,Ci=(t(Ii,Ei=v),Ii);function Ii(){return Ei.call(this,ht)||this}var Si,Ai=(t(Wi,Si=v),Wi);function Wi(){return Si.call(this,lt)||this}var bi,Ti=(t(Ni,bi=v),Ni);function Ni(){return bi.call(this,mt)||this}var Ri,xi=(t(Di,Ri=v),Di);function Di(){return Ri.call(this,j)||this}var Pi,Mi=(t(Fi,Pi=v),Fi);function Fi(){return Pi.call(this,Y)||this}var Oi,ki=(t(Li,Oi=v),Li);function Li(t,e){var n=Oi.call(this,J)||this;return n.dialogType=t,n.pageUrl=e,n}var Ui,Hi=(t(Gi,Ui=v),Gi);function Gi(t,e,n){var i=Ui.call(this,K)||this;return i.dialogType=t,i.errMsg=e,i.pageUrl=n,i}var Bi,Vi=(t(qi,Bi=v),qi);function qi(){return Bi.call(this,Wt)||this}var zi=Object.freeze({__proto__:null,TestRunErrorBase:v,ClientFunctionExecutionInterruptionError:Rt,DomNodeClientFunctionResultError:Pt,SelectorErrorBase:Ot,InvalidSelectorResultError:Ut,CannotObtainInfoForElementSpecifiedBySelectorError:Bt,UncaughtErrorOnPage:zt,UncaughtErrorInClientFunctionCode:Yt,UncaughtErrorInCustomDOMPropertyCode:$t,UncaughtErrorInCustomClientScriptCode:te,UncaughtErrorInCustomClientScriptLoadedFromModule:ie,ActionIntegerOptionError:se,ActionPositiveIntegerOptionError:ue,ActionBooleanOptionError:he,ActionSpeedOptionError:me,ActionStringOptionError:we,ActionStringOrRegexOptionError:Ee,ActionDateOptionError:Se,ActionNumberOptionError:be,ActionUrlOptionError:Re,ActionUrlSearchParamsOptionError:Pe,ActionObjectOptionError:Oe,ActionFunctionOptionError:Ue,ActionInvalidObjectPropertyError:Be,ActionElementNotFoundError:ze,ActionElementIsInvisibleError:Ye,ActionSelectorMatchesWrongNodeTypeError:$e,ActionAdditionalElementNotFoundError:tn,ActionElementIsNotTargetError:rn,ActionAdditionalElementIsInvisibleError:an,ActionAdditionalSelectorMatchesWrongNodeTypeError:cn,ActionElementNonEditableError:pn,ActionElementNotTextAreaError:gn,ActionElementNonContentEditableError:yn,ActionRootContainerNotFoundError:Cn,ActionIncorrectKeysError:An,ActionCannotFindFileToUploadError:Tn,ActionElementIsNotFileInputError:xn,ActionInvalidScrollTargetError:Mn,InvalidElementScreenshotDimensionsError:kn,ActionElementNotIframeError:Hn,ActionIframeIsNotLoadedError:Vn,CurrentIframeIsNotLoadedError:Xn,ChildWindowNotFoundError:Jn,ChildWindowIsNotLoadedError:Qn,CannotSwitchToWindowError:ei,CloseChildWindowError:ri,CannotCloseWindowWithChildrenError:ai,CannotCloseWindowWithoutParentError:ci,SwitchToWindowPredicateError:pi,WindowNotFoundError:gi,ParentWindowNotFoundError:yi,PreviousWindowNotFoundError:Ci,ChildWindowClosedBeforeSwitchingError:Ai,CannotRestoreChildWindowError:Ti,CurrentIframeNotFoundError:xi,CurrentIframeIsInvisibleError:Mi,NativeDialogNotHandledError:ki,UncaughtErrorInNativeDialogHandler:Hi,MultipleWindowsModeIsNotSupportedInNativeAutomationModeError:Vi}),Xi="_nativeMethods",ji=(Yi.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},Yi.prototype._getWindowIds=function(t){return this[Xi].objectKeys(t)},Yi.prototype._copyArray=function(t){return this[Xi].arraySlice.call(t)},Yi.prototype._concatArrays=function(t,e){return this[Xi].arrayConcat.call(t,e)},Yi.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},Yi.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Xi].arrayForEach.call(t,function(t){n.ensureMessageContainer(t),n[t].log=n._concatArrays(n[t].log,e[t].log),n[t].info=n._concatArrays(n[t].info,e[t].info),n[t].warn=n._concatArrays(n[t].warn,e[t].warn),n[t].error=n._concatArrays(n[t].error,e[t].error)}),this},Yi.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},Yi.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Xi].arrayForEach.call(t,function(t){n[t]={log:e._copyArray(e[t].log),info:e._copyArray(e[t].info),warn:e._copyArray(e[t].warn),error:e._copyArray(e[t].error)}}),n},Yi);function Yi(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Xi,{value:n}),this.concat(t)}var Ji,Ki=(t($i,Ji=ji),$i);function $i(t){return Ji.call(this,t,c.nativeMethods)||this}var Qi,Zi,tr=(function(t){function n(t){return!!s[t]}function i(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,r=(0,eval)("this"),s={Int8Array:"function"==typeof Int8Array?Int8Array:void 0,Uint8Array:"function"==typeof Uint8Array?Uint8Array:void 0,Uint8ClampedArray:"function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Int16Array:"function"==typeof Int16Array?Int16Array:void 0,Uint16Array:"function"==typeof Uint16Array?Uint16Array:void 0,Int32Array:"function"==typeof Int32Array?Int32Array:void 0,Uint32Array:"function"==typeof Uint32Array?Uint32Array:void 0,Float32Array:"function"==typeof Float32Array?Float32Array:void 0,Float64Array:"function"==typeof Float64Array?Float64Array:void 0},a="function"==typeof ArrayBuffer,l="function"==typeof Map,u="function"==typeof Set,c="function"==typeof Buffer,d=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function h(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}i._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},i.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},i.prototype._applyTransform=function(t,e,n,i){var r=Object.create(null),o=i.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),r["@t"]=i.type,r.data=this._handleValue(o,e,n),r},i.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},i.prototype._handlePlainObject=function(n){var i=this,r=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;r[e]=i._handleValue(n[t],r,e)}),r},i.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},i.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),i._createRefMark(n.refIdx)}return null},i.prototype._handleValue=function(t,e,n){var i=typeof t,r="object"==i&&null!==t;if(r){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(i,t))return this._applyTransform(t,e,n,a)}return r?this._handleObject(t,e,n):t},i.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]=i._createRefMark(n.refIdx))}return t},h.prototype._handlePlainObject=function(e){var t,n=this,i=Object.create(null),r=Object.getOwnPropertyNames(e);for(t in r.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(i[t.substring(1)]=e[t],delete e[t])}),i)e[t]=i[t]},h.prototype._handleTransformedObject=function(t,e,n){var i=t["@t"],r=this.transformMap[i];if(!r)throw new Error("Can't find transform for \""+i+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=r.fromSerializable(t.data)},h.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var i=this.references,r=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===r&&(r=i[t]),r},set:function(t){return r=t}})},h.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])},h.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var i=t["@r"];if(void 0!==i)this._handleCircularRef(i,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var r=0;r<t.length;r++)this._handleValue(t[r],t,r);else this._handlePlainObject(t)}},h.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var p=[{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(r[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return a&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return d.call(e)},fromSerializable:function(t){if(a){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[Buffer]]",shouldTransform:function(t,e){return c&&e instanceof Buffer},toSerializable:function(t){return d.call(t)},fromSerializable:function(t){return c?Buffer.from(t):t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){return Object.keys(s).some(function(t){return n(t)&&e instanceof s[t]})},toSerializable:function(t){return{ctorName:t.constructor.name,arr:d.call(t)}},fromSerializable:function(t){return n(t.ctorName)?new s[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return l&&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(l){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var i=[],r=0;r<t.length;r+=2)i.push([t[n],t[n+1]]);return i}},{type:"[[Set]]",shouldTransform:function(t,e){return u&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(u){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],f=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(p)};f.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},f.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],i=this.transforms.indexOf(n);-1<i&&this.transforms.splice(i,1),delete this.transformsMap[n.type]}return this},f.prototype.encode=function(t){var e=new i(t,this.transforms).transform();return this.serializer.serialize(e)},f.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new h(e,this.transformsMap).transform()}}(Qi={exports:{}}),Qi.exports),er=function(t){return t};function nr(t){return new tr({serialize:er,deserialize:er}).addTransforms(t)}var ir=1,rr=2,or=3,sr=((Zi={})[ir]=/^\.filterVisible\(\)$/,Zi[rr]=/^\.filterHidden\(\)$/,Zi[or]=/^\.nth\(\d+\)$/,Zi);function ar(){this._err=null}var lr=(Object.defineProperty(ar.prototype,"error",{get:function(){return this._err},set:function(t){null===this._err&&(this._err=t)},enumerable:!1,configurable:!0}),ar.prototype.filter=function(t,e,n){if(e.filterVisible&&(t=t.filter(_.positionUtils.isElementVisible),this._assertFilterError(t,n,ir)),e.filterHidden&&(t=t.filter(function(t){return!_.positionUtils.isElementVisible(t)}),this._assertFilterError(t,n,rr)),e.counterMode)return null===e.index?t.length:ar._getNodeByIndex(t,e.index)?1:0;var i;if(e.collectionMode)return null!==e.index&&(t=(i=ar._getNodeByIndex(t,e.index))?[i]:[],this._assertFilterError(t,n,or)),t;var r=ar._getNodeByIndex(t,e.index||0);return r||(this.error=ar._getErrorItem(n,or)),r},ar.prototype.cast=function(t){if(null==t)return[];if(t instanceof c.nativeMethods.Node)return[t];if(function(t){if(c.nativeMethods.isArray(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof c.nativeMethods.Node))return;return 1}}(t))return t;if((e=t)instanceof c.nativeMethods.HTMLCollection||e instanceof c.nativeMethods.NodeList)return function(t){for(var e=t.length,n=[],i=0;i<e;i++)n.push(t[i]);return n}(t);var e;throw new Ut},ar.prototype._assertFilterError=function(t,e,n){0===t.length&&(this.error=ar._getErrorItem(e,n))},ar._getErrorItem=function(t,e){var n=t.apiFnChain,i=t.apiFnID;if(e)for(var r=i;r<n.length;r++)if(sr[e].test(n[r]))return r;return null},ar._getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},new ar);function ur(t,e){return new c.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,c.Promise,RegExp)}var cr=(dr.prototype.shouldTransform=function(t){return"function"===t},dr.prototype.toSerializable=function(){return""},dr.prototype.fromSerializable=function(t){var e=t.fnCode,n=t.dependencies;return"filterOptions"in n&&(n.selectorFilter=lr),ur(e,n)},dr);function dr(){this.type="Function"}var hr=(pr.prototype.shouldTransform=function(t,e){if(e instanceof c.nativeMethods.Node)throw new Pt(this._instantiationCallsiteName);return!1},pr.prototype.toSerializable=function(){},pr.prototype.fromSerializable=function(){},pr);function pr(t){this.type="Node",this._instantiationCallsiteName=t}var fr=(mr.prototype.getResult=function(){var e=this;return c.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Yt(e.command.instantiationCallsiteName,t)),t})},mr.prototype.encodeResult=function(t){return this.replicator.encode(t)},mr.prototype._createReplicator=function(){return nr([new hr(this.command.instantiationCallsiteName),new cr])},mr.prototype._executeFn=function(t){return this.fn.apply(bc,t)},mr);function mr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(t.dependencies),this.fn=ur(t.fnCode,this.dependencies)}var gr="appeared-dialog",vr="unexpected-dialog",wr="handler-error",yr=s.eventSandbox.message,_r=s.processScript,Er=s.nativeMethods,Cr="testcafe|native-dialog-tracker|appeared-dialogs",Ir="testcafe|native-dialog-tracker|unexpected-dialog",Sr="testcafe|native-dialog-tracker|error-in-handler",Ar=_r("window.location.href"),Wr=["alert","confirm","prompt","print"],br="geolocation",Tr=(Object.defineProperty(Nr.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Cr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Cr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Ir)},set:function(t){this.contextStorage.setItem(Ir,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"handlerError",{get:function(){return this.contextStorage.getItem(Sr)},set:function(t){this.contextStorage.setItem(Sr,t)},enumerable:!1,configurable:!0}),Nr._getPageUrl=function(){return Er.eval(Ar)},Nr.prototype._initListening=function(){var n=this;yr.on(yr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===gr?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==vr||n.unexpectedDialog?e.type!==wr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},Nr.prototype._init=function(){var e=this;s.on(s.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),this._setCustomOrDefaultHandler()},Nr.prototype._createDialogHandler=function(r){var o=this;return function(t){var e=Nr._getPageUrl();o._addAppearedDialogs(r,t,e);var n=new fr(o.dialogHandler),i=null;try{i=n.fn.apply(bc,[r,t,e])}catch(t){o._onHandlerError(r,t.message||String(t),e)}return i}},Nr.prototype._handleGeolocationDialog=function(t,e){if(!this.dialogHandler)return this._defaultDialogHandler(br),void t();var n=Nr._getPageUrl();Er.arraySome.call(this.appearedDialogs,function(t){return t.type===br&&t.url===n})||this._addAppearedDialogs(br,void 0,n);var i=new fr(this.dialogHandler),r=null;try{r=i.fn.apply(bc,[br,void 0,n])}catch(t){this._onHandlerError(br,t.message||String(t),n)}(r instanceof Error?e:t)(r)},Nr.prototype._defaultDialogHandler=function(t){var e=Nr._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},Nr.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},Nr.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},Nr.prototype._setCustomOrDefaultHandler=function(){var e=this;Wr.forEach(function(t){bc[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}}),this._setGeolocationDialogHandler()},Nr.prototype._setGeolocationDialogHandler=function(){var t,e,n=null===(t=bc.Geolocation)||void 0===t?void 0:t.prototype,i=null===(e=bc.navigator)||void 0===e?void 0:e.geolocation;this._shouldOverrideGeolocationDialog(n)&&this._shouldOverrideGeolocationDialog(i)&&(n.getCurrentPosition=this._handleGeolocationDialog.bind(this))},Nr.prototype._shouldOverrideGeolocationDialog=function(t){if(null==t||!t.getCurrentPosition)return!1;var e=Er.isNativeCode(t.getCurrentPosition),n=t.getCurrentPosition===this._handleGeolocationDialog;return e||n},Nr.prototype.setHandler=function(t){this.dialogHandler=t,this._setCustomOrDefaultHandler()},Nr.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new ki(t.type,t.url):e?new Hi(e.type,e.message,e.url):null},Nr);function Nr(t,e){var n=(void 0===e?{}:e).dialogHandler;this.contextStorage=t,this.dialogHandler=n,this._init(),this._initListening()}function Rr(){return"".concat(c.nativeMethods.performanceNow(),".").concat(Math.floor(1e5*Math.random()))}function xr(t){this.type=t,this.id=Rr()}var Dr,Pr="driver|establish-connection",Mr="driver|switch-to-window",Fr="driver|close-window",Or="driver|close-window-validation",kr="driver|switch-to-window-validation",Lr="driver|get-windows",Ur="driver|command-executed",Hr="driver|execute-command",Gr="driver|confirmation",Br="driver|set-native-dialog-handler",Vr="driver|set-as-master",qr="driver|close-all-child-windows",zr="driver|start-to-restore-child-link",Xr="driver|restore-child-link",jr="driver|child-window-is-loaded-in-iframe",Yr="driver|child-window-is-opened-in-iframe",Jr="driver|stop-internal-from-iframe",Kr="driver|has-pending-action-flags",$r=(t(Qr,Dr=xr),Qr);function Qr(){return Dr.call(this,Pr)||this}var Zr,to=(t(eo,Zr=xr),eo);function eo(t){var e=t.windowId,n=Zr.call(this,Or)||this;return n.windowId=e,n}var no,io=(t(ro,no=xr),ro);function ro(t){var e=t.windowId,n=t.fn,i=no.call(this,kr)||this;return i.windowId=e,i.fn=n,i}var oo,so=(t(ao,oo=xr),ao);function ao(){return oo.call(this,Lr)||this}var lo,uo=(t(co,lo=xr),co);function co(t){var e=t.windowId,n=t.isCurrentWindow,i=lo.call(this,Fr)||this;return i.windowId=e,i.isCurrentWindow=n,i}var ho,po=(t(fo,ho=xr),fo);function fo(t){var e=t.windowId,n=t.fn,i=ho.call(this,Mr)||this;return i.windowId=e,i.fn=n,i}var mo,go=(t(vo,mo=xr),vo);function vo(t){var e=mo.call(this,Ur)||this;return e.driverStatus=t,e}var wo,yo=(t(_o,wo=xr),_o);function _o(t,e){var n=wo.call(this,Hr)||this;return n.command=t,n.testSpeed=e,n}var Eo,Co=(t(Io,Eo=xr),Io);function Io(t,e){var n=Eo.call(this,Gr)||this;return n.requestMessageId=t,n.result=e,n}var So,Ao=(t(Wo,So=xr),Wo);function Wo(t){var e=So.call(this,Br)||this;return e.dialogHandler=t,e}var bo,To=(t(No,bo=xr),No);function No(t){var e=bo.call(this,Vr)||this;return e.finalizePendingCommand=t,e}var Ro,xo=(t(Do,Ro=xr),Do);function Do(){return Ro.call(this,qr)||this}var Po,Mo=(t(Fo,Po=xr),Fo);function Fo(){return Po.call(this,zr)||this}var Oo,ko=(t(Lo,Oo=xr),Lo);function Lo(t){var e=Oo.call(this,Xr)||this;return e.windowId=t,e}var Uo,Ho=(t(Go,Uo=xr),Go);function Go(t){var e=Uo.call(this,jr)||this;return e.windowId=t,e}var Bo,Vo=(t(qo,Bo=xr),qo);function qo(){return Bo.call(this,Yr)||this}var zo,Xo=(t(jo,zo=xr),jo);function jo(){return zo.call(this,Jr)||this}var Yo,Jo=(t(Ko,Yo=xr),Ko);function Ko(){return Yo.call(this,Kr)||this}var $o=s.json,Qo=s.nativeMethods,Zo="%nativeAutomationContextStorage%",ts=(es.prototype.loadFromStorage=function(){var t={},e=this._getData();return e&&(t=$o.parse(e),this._deleteData()),t},es.prototype._getData=function(){throw new Error("Not implemented")},es.prototype._deleteData=function(){throw new Error("Not implemented")},es.prototype.save=function(){throw new Error("Not implemented")},es.prototype.sync=function(){},es.prototype.dispose=function(){this._deleteData()},es);function es(){}var ns,is=(t(rs,ns=ts),rs.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},rs.prototype._getData=function(){return Qo.storageGetItem.call(this.storage,this.storageKey)},rs.prototype._deleteData=function(){Qo.storageRemoveItem.call(this.storage,this.storageKey)},rs.prototype.save=function(t){Qo.storageSetItem.call(this.storage,this.storageKey,$o.stringify(t))},rs);function rs(t,e,n){var i=ns.call(this)||this;return i.storage=Qo.winSessionStorageGetter.call(t),i.storageKey=i._createStorageKey(e,n),i}var os,ss=(t(as,os=ts),as.prototype._getData=function(){var t;return null===(t=bc[Zo])||void 0===t?void 0:t[this.frameId]},as.prototype._deleteData=function(){bc[Zo]=null},as.prototype.save=function(t){bc.NATIVE_AUTOMATION_STORAGE_BINDING&&bc.NATIVE_AUTOMATION_STORAGE_BINDING($o.stringify({testRunId:this.testRunId,frameDriverId:this.frameId,data:$o.stringify(t)}))},as);function as(t,e){var n=os.call(this)||this,i=e.split("-"),r=i[0],o=i[1];return n.testRunId=r,n.frameId=o||"main",n}var ls=(us.prototype._createStorageStrategy=function(t,e,n,i){return new(t?ss:is)(e,n,i)},us.prototype.save=function(){this.strategy.save(this.data)},us.prototype.setItem=function(t,e){this.data[t]=e,this.save(this.data)},us.prototype.getItem=function(t){return this.data[t]},us.prototype.dispose=function(){this.strategy.dispose()},us);function us(t,e){var n=e.testRunId,i=e.windowId,r=e.nativeAutomation;this.strategy=this._createStorageStrategy(r,t,n,i),this.data=this.strategy.loadFromStorage(),this.testRunId=n}var cs=Object.prototype.toString,ds=String.prototype.indexOf,hs=String.prototype.endsWith||function(t,e){var n=cs.call(this);(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var i=ds.call(n,t,e);return-1!==i&&i===e},ps=Array.prototype.indexOf,fs=Array.prototype.map,ms=Array.prototype.sort,gs=Array.prototype.filter,vs=Array.prototype.concat,ws="Command",ys=(_s.prototype.getAssignableProperties=function(){return[]},_s.prototype.getAllAssignableProperties=function(){for(var t=Object.getPrototypeOf(this),e=[];t&&t.getAssignableProperties;)e=vs.call(e,t.getAssignableProperties()),t=Object.getPrototypeOf(t);return e},_s.prototype.getNonReportedProperties=function(){return[]},_s.prototype.getReportedProperties=function(){var t=fs.call(this.getAllAssignableProperties(),function(t){return t.name}),e=this.getNonReportedProperties();return gs.call(t,function(t){return!(-1<ps.call(e,t))})},_s.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t){e&&function(t,e){var n,i=e.constructor.name,r=fs.call(e.getAllAssignableProperties(),function(t){return t.name}),o=ms.call(e.getReportedProperties());for(n in t)if(!(-1<ps.call(r,n)||n in e))throw new Be(i,n,o)}(t,this);for(var i,r,o=this.getAllAssignableProperties(),s=0;s<o.length;s++){var a=o[s],l=a.name,u=a.type,c=a.required,d=a.init,h=a.defaultValue;void 0!==h&&(this[l]=h);var p=t[l];void 0===p&&!c||(e&&u&&u((i=this.constructor.name,r=l,hs.call(i,ws)?r:"".concat(i,".").concat(r)),p),this[l]=d?d(l,p,n,e):p)}}},_s);function _s(){}var Es,Cs=(t(Is,Es=ys),Is.prototype.getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isObservingFileDownloadingInNewWindow"},{name:"isFirstRequestAfterWindowSwitching"},{name:"warnings"}]},Is);function Is(t){var e=Es.call(this,t)||this;return e.id=Rr(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isObservingFileDownloadingInNewWindow=!1,e.isFirstRequestAfterWindowSwitching=!1,e.warnings=null,e._assignFrom(t,!0),e}function Ss(n,t,e,i){var r=null,o=null,s=null;return e=Math.max(e||0,2500),c.Promise.race([_.delay(e),new c.Promise(function(e){s=function(t){t.message.type===Gr&&t.message.requestMessageId===n.id&&e(t.message)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),r=c.nativeMethods.setInterval.call(bc,function(){return c.eventSandbox.message.sendServiceMsg(n,t)},1e3),c.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(c.nativeMethods.clearInterval.call(bc,r),c.nativeMethods.clearTimeout.call(bc,o),c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new i;return t})}var As=2e4;function Ws(t){var e=t.requestMsgId,n=t.result,i=t.window,r=new Co(e,n);c.eventSandbox.message.sendServiceMsg(r,i)}var bs=(Object.defineProperty(Ts.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Ts.prototype._ensureIframe=function(){var t=this;return _.domUtils.isElementInDocument(this.driverIframe)?_.waitFor(function(){return _.positionUtils.isIframeVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Mi}):c.Promise.reject(new xi)},Ts.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new c.Promise(function(t){e.checkIframeInterval=c.nativeMethods.setInterval.call(bc,function(){e._ensureIframe().catch(function(){return _.delay(500).then(function(){return t(new Cs({isCommandResult:!0}))})})},1e3)})},Ts.prototype._waitForCommandResult=function(){var e=this,n=null;return c.Promise.race([this._waitForIframeRemovedOrHidden(),new c.Promise(function(e){n=function(t){t.message.type===Ur&&e(t.message.driverStatus)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),c.nativeMethods.clearInterval.call(bc,e.checkIframeInterval),t})},Ts.prototype.sendConfirmationMessage=function(t){Ws({requestMsgId:t,result:{id:this.driverId,dispatchNativeAutomationEventUrls:this.dispatchNativeAutomationEventUrls},window:this.driverWindow})},Ts.prototype.executeCommand=function(e,n){var i=this;return this._ensureIframe().then(function(){var t=new yo(e,n);return c.Promise.all([Ss(t,i.driverWindow,i.iframeAvailabilityTimeout,Xn),i._waitForCommandResult()])}).then(function(t){return t[1]})},Ts);function Ts(t,e,n){this.driverWindow=t,this.driverIframe=_.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0,this.dispatchNativeAutomationEventUrls=n}var Ns=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],Rs=["tagName","attributes"],xs=["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"],Ds={childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!Ds.childNodeCount(t)},childElementCount:function(t){var e;return(null===(e=t.children)||void 0===e?void 0:e.length)||0},hasChildElements:function(t){return!!Ds.childElementCount(t)}},Ps=(Ms.prototype._initializeProperties=function(t,e,n){for(var i=0,r=e;i<r.length;i++){var o=r[i],s=n[o];this[o]=s?s(t):t[o]}},Ms);function Ms(){}var Fs,Os=(t(ks,Fs=Ps),ks);function ks(t){var e=Fs.call(this)||this;return e._initializeProperties(t,Ns,Ds),e}var Ls,Us={tagName:function(t){return t.tagName.toLowerCase()},visible:function(t){return _.positionUtils.isElementVisible(t)},focused:function(t){return c.utils.dom.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},i=e.length-1;0<=i;i--)n[e[i].name]=e[i].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"string"==typeof e.animVal&&(e=e.animVal),e.replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=bc.getComputedStyle(t),i=0;i<n.length;i++){var r=n[i];e[r]=n[r]}return e},innerText:function(t){return t.innerText}},Hs=(t(Gs,Ls=Ps),Gs);function Gs(t){var e=Ls.call(this)||this;return e._initializeProperties(t,Rs,Us),e}var Bs,Vs=(t(qs,Bs=Os),qs);function qs(t){var e=Bs.call(this,t)||this;return e._initializeProperties(t,xs,Us),e}var zs=(Xs.prototype._extend=function(t,e){for(var n=0,i=c.nativeMethods.objectKeys(this._customDOMProperties);n<i.length;n++){var r=i[n];try{t[r]=this._customDOMProperties[r](e)}catch(t){throw new $t(this._instantiationCallsiteName,t,r)}}},Xs.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},Xs.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Vs:Os)(t);return this._extend(e,t),e},Xs.prototype.fromSerializable=function(){},Xs);function Xs(t,e){void 0===t&&(t={}),this.type="Node",this._customDOMProperties=t,this._instantiationCallsiteName=e}var js=(Ys.prototype.on=function(t,e){this._eventsListeners[t]||(this._eventsListeners[t]=[]),this._eventsListeners[t].push(e)},Ys.prototype.once=function(n,i){var r=this;this.on(n,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.off(n,i),i.apply(void 0,t)})},Ys.prototype.off=function(t,e){var n=this._eventsListeners[t];n&&(this._eventsListeners[t]=c.nativeMethods.arrayFilter.call(n,function(t){return t!==e}))},Ys.prototype.offAll=function(t){t?this._eventsListeners[t]=[]:this._eventsListeners={}},Ys.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=this._eventsListeners[t];if(i)for(var r=0;r<i.length;r++)i[r].apply(this,e)},Ys);function Ys(){this._eventsListeners={}}var Js=s.Promise,Ks=s.nativeMethods;function $s(e){return new Js(function(t){return Ks.setTimeout.call(bc,t,e)})}var Qs={1:"element",2:"attribute",3:"text",4:"cdata section",5:"entity reference",6:"entity node",7:"processing instruction",8:"comment",9:"document",10:"document type",11:"document fragment",12:"notation"};function Zs(t){return t?{name:"ActionAdditionalElementIsInvisibleError",firstArg:t}:"ActionElementIsInvisibleError"}function ta(t){return t?{name:"ActionAdditionalElementNotFoundError",firstArg:t}:"ActionElementNotFoundError"}function ea(t){var e="string"==typeof t?zi[t]:zi[t.name],n="string"==typeof t?null:t.firstArg;return function(t){return new e(n,t)}}var na=(ia.prototype.push=function(t,i){var r=this;this._ensureElementsPromise=this._ensureElementsPromise.then(function(){return r._executeSelectorFn(t,{invisible:Zs(i),notFound:ta(i)},r._ensureElementsStartTime)}).then(function(t){if(!_.domUtils.isDomElement(t)){var e=t.nodeType,n=Qs[e];throw i?new cn(i,n):new $e(n)}r._elements.push(t)})},ia.prototype.getElements=function(){var t=this;return this._ensureElementsPromise.then(function(){return t._elements})},ia);function ia(t,e){this._globalSelectorTimeout=t,this._ensureElementsStartTime=c.nativeMethods.dateNow(),this._ensureElementsPromise=c.Promise.resolve(),this._executeSelectorFn=e,this._elements=[]}var ra=(oa.create=function(t){return new oa(t.top,t.right,t.bottom,t.left)},oa.prototype.add=function(t){return this.top+=t.top,this.right+=t.right,this.bottom+=t.bottom,this.left+=t.left,this},oa.prototype.sub=function(t){return"top"in t&&(this.top-=t.top,this.left-=t.left),this.bottom-=t.bottom,this.right-=t.right,this},oa.prototype.round=function(t,e){return void 0===t&&(t=Math.round),void 0===e&&(e=t),this.top=t(this.top),this.right=e(this.right),this.bottom=e(this.bottom),this.left=t(this.left),this},oa.prototype.contains=function(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom},oa);function oa(t,e,n,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),this.top=t,this.right=e,this.bottom=n,this.left=i}function sa(t){var e="array"+t.charAt(0).toUpperCase()+t.slice(1),n=c.nativeMethods[e];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,t)}}sa("filter"),sa("map"),sa("slice"),sa("splice"),sa("unshift"),sa("forEach"),sa("indexOf"),sa("some"),sa("reverse"),sa("reduce"),sa("concat"),sa("join"),sa("every"),s.utils.browser,s.nativeMethods,s.utils.style.get,s.utils.dom.getActiveElement,s.utils.dom.findDocument,s.utils.dom.find,s.utils.dom.isElementInDocument;var aa=s.utils.dom.isElementInIframe,la=s.utils.dom.getIframeByElement,ua=(s.utils.dom.isCrossDomainWindows,s.utils.dom.getSelectParent,s.utils.dom.getChildVisibleIndex,s.utils.dom.getSelectVisibleChildren,s.utils.dom.isElementNode,s.utils.dom.isTextNode,s.utils.dom.isRenderedNode,s.utils.dom.isIframeElement,s.utils.dom.isInputElement,s.utils.dom.isButtonElement,s.utils.dom.isFileInput,s.utils.dom.isTextAreaElement,s.utils.dom.isAnchorElement,s.utils.dom.isImgElement,s.utils.dom.isFormElement,s.utils.dom.isLabelElement,s.utils.dom.isSelectElement,s.utils.dom.isRadioButtonElement,s.utils.dom.isColorInputElement,s.utils.dom.isCheckboxElement,s.utils.dom.isOptionElement,s.utils.dom.isSVGElement,s.utils.dom.isMapElement,s.utils.dom.isBodyElement,s.utils.dom.isHtmlElement),ca=(s.utils.dom.isDocument,s.utils.dom.isTextEditableInput,s.utils.dom.isTextEditableElement,s.utils.dom.isTextEditableElementAndEditingAllowed,s.utils.dom.isContentEditableElement,s.utils.dom.isDomElement,s.utils.dom.isShadowUIElement,s.utils.dom.isShadowRoot,s.utils.dom.isElementFocusable,s.utils.dom.isHammerheadAttr,s.utils.dom.isElementReadOnly,s.utils.dom.getScrollbarSize),da=(s.utils.dom.getMapContainer,s.utils.dom.getTagName,s.utils.dom.closest,s.utils.dom.getParents,s.utils.dom.findParent,s.utils.dom.getTopSameDomainWindow,s.utils.dom.getParentExceptShadowRoot,s.utils.style,s.utils.style.getBordersWidth),ha=(s.utils.style.getComputedStyle,s.utils.style.getElementMargin,s.utils.style.getElementPadding,s.utils.style.getElementScroll),pa=(s.utils.style.getOptionHeight,s.utils.style.getSelectElementSize,s.utils.style.isElementVisible,s.utils.style.isVisibleChild,s.utils.style.getWidth,s.utils.style.getHeight,s.utils.style.getInnerWidth),fa=s.utils.style.getInnerHeight,ma=(s.utils.style.getScrollLeft,s.utils.style.getScrollTop,s.utils.style.setScrollLeft,s.utils.style.setScrollTop,s.utils.style.get,s.utils.style.getBordersWidthFloat,s.utils.style.getElementPaddingFloat,s.shadowUI,s.nativeMethods,ga.create=function(t){return"left"in t?new ga(t.left,t.top):"right"in t?new ga(t.right,t.bottom):new ga(t.x,t.y)},ga.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},ga.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},ga.prototype.round=function(t){return void 0===t&&(t=Math.round),this.x=t(this.x),this.y=t(this.y),this},ga.prototype.eql=function(t){return this.x===t.x&&this.y===t.y},ga.prototype.mul=function(t){return this.x*=t,this.y*=t,this},ga.prototype.distance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},ga);function ga(t,e){this.x=t,this.y=e}var va=function(t,e,n,i,r,o){this.width=t,this.height=e,this.left=n.x,this.top=n.y,this.right=n.x+t,this.bottom=n.y+e,this.border=i,this.scrollbar=o,this.scroll=r},wa=(s.utils.html,s.nativeMethods,s.utils.position.getElementRectangle),ya=s.utils.position.getOffsetPosition,_a=s.utils.position.offsetToClientCoords;function Ea(t){var e=t/2;return e<1?0:Math.round(e)}function Ca(t,e,n){var i,r={offsetX:Ea((i=wa(t)).width),offsetY:Ea(i.height)};if(e="number"==typeof e?Math.round(e):r.offsetX,n="number"==typeof n?Math.round(n):r.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var o=function(t){var e,n,i,r,o=ua(t),s=o?t.getElementsByTagName("body")[0]:null,a=t.getBoundingClientRect(),l=ra.create(da(t)),u=ha(t),c=aa(t),d="BackCompat"===t.ownerDocument.compatMode,h=o?new ma(0,0):ma.create(a),p=a.height,f=a.width;o&&(f=s&&d?(p=s.clientHeight,s.clientWidth):(p=t.clientHeight,t.clientWidth)),!c||(e=la(t))&&(n=ya(e),i=_a(ma.create(n)),r=da(e),h.add(i).add(ma.create(r)),o&&l.add(r));var m=!o&&pa(t)!==t.clientWidth,g=!o&&fa(t)!==t.clientHeight,v={right:m?ca():0,bottom:g?ca():0};return new va(f,p,h,l,u,v)}(t),s=Math.round(Math.max(t.scrollWidth,o.width)),a=Math.round(Math.max(t.scrollHeight,o.height)),l=o.scrollbar.right+o.border.left+o.border.right+s,u=o.scrollbar.bottom+o.border.top+o.border.bottom+a;return{offsetX:e<0?l+e:e,offsetY:n<0?u+n:n}}var Ia,Sa=(t(Aa,Ia=js),Aa.prototype._prepareCommand=function(t,e){t.options&&!t.options.speed&&(t.options.speed=e.testSpeed)},Aa.prototype._getCommandSelectorTimeout=function(t,e){var n;return"number"==typeof(null===(n=t.selector)||void 0===n?void 0:n.timeout)?t.selector.timeout:e.globalSelectorTimeout},Aa.prototype._delayAfterExecution=function(){return this._command.options&&1!==this._command.options.speed?$s(2e3*(1-this._command.options.speed)):c.Promise.resolve()},Aa.prototype._isExecutionTimeoutExpired=function(){return c.nativeMethods.dateNow()-this._executionStartTime>=this._commandSelectorTimeout},Aa.prototype._ensureCommandArguments=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureCmdArgs&&t.ensureCmdArgs(this._command)},Aa.prototype._ensureCommandElements=function(){var t,e=this,n=new na(this._options.globalSelectorTimeout,this._options.executeSelectorFn);this._command.selector&&n.push(this._command.selector);var i=null===(t=Aa.ACTIONS_HANDLERS[this._command.type])||void 0===t?void 0:t.additionalSelectorProps;if(i)for(var r=0,o=i;r<o.length;r++){var s=o[r];this._command[s]&&n.push(this._command[s],s)}return n.getElements().then(function(t){e._elements=t})},Aa.prototype._ensureCommandElementsProperties=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureElsProps&&t.ensureElsProps(this._elements)},Aa.prototype._ensureCommandOptions=function(){return l(this,void 0,c.Promise,function(){var e,n,i,r;return C(this,function(t){return e=this._command.options,this._elements.length&&e&&"offsetX"in e&&"offsetY"in e&&(n=Ca(this._elements[0],e.offsetX,e.offsetY),i=n.offsetX,r=n.offsetY,e.isDefaultOffset=!e.offsetX&&!e.offsetY,e.offsetX=i,e.offsetY=r),[2]})})},Aa.prototype._createAutomation=function(){var t=Aa.ACTIONS_HANDLERS[this._command.type];if(!t)throw new Error('There is no handler for the "'.concat(this._command.type,'" command.'));return t.create(this._command,this._elements,this._options.dispatchNativeAutomationEventFn)},Aa.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){return n._ensureCommandOptions()}).then(function(){var t=n._createAutomation();return t.WARNING_EVENT&&t.on(t.WARNING_EVENT,function(t){n.emit(Aa.WARNING_EVENT,t)}),t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n._targetElement=t.element,n.emit(Aa.EXECUTION_STARTED_EVENT)}):n.emit(Aa.EXECUTION_STARTED_EVENT),t.run(e)})},Aa.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return e()?[4,n()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})})}(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(!e._isExecutionTimeoutExpired())return $s(250);if(t.code===At)return n=!1,c.Promise.resolve();throw t})})},Aa.prototype.execute=function(t){var e=this;this._executionStartTime=c.nativeMethods.dateNow();try{this._ensureCommandArguments()}catch(t){return c.Promise.reject(t)}return this.emit(Aa.WAITING_FOR_ELEMENT_EVENT,this._commandSelectorTimeout),this._runRecursively().then(function(){return c.Promise.all([e._delayAfterExecution(),t.wait()])}).then(function(){var t=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||((i=i||Array.prototype.slice.call(e,0,r))[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}([],e._elements,!0);return e._targetElement&&(t[0]=e._targetElement),t})},Aa.EXECUTION_STARTED_EVENT="execution-started",Aa.WAITING_FOR_ELEMENT_EVENT="waiting-for-elements",Aa.WARNING_EVENT="warning",Aa.ACTIONS_HANDLERS={},Aa);function Aa(t,e){var n=Ia.call(this)||this;return n._command=t,n._targetElement=null,n._elements=[],n._options=e,n._executionStartTime=0,n._prepareCommand(t,e),n._commandSelectorTimeout=n._getCommandSelectorTimeout(t,e),n}function Wa(t,e,n){return Math.min(Math.max(e,t),n)}function ba(t,e){var n="number"==typeof t.min,i="number"==typeof t.max,r="number"==typeof t.length;return r&&(t.length=Wa(t.length,0,e)),n&&t.min<0&&(t.min+=e),i&&t.max<0&&(t.max+=e),n||(t.min=i&&r?t.max-t.length:0),i||(t.max=r?t.min+t.length:e),t.min=Wa(t.min,0,e),t.max=Wa(t.max,0,e),t.length=t.max-t.min,t}function Ta(t,e,n){return Math.round(t+Wa(e-t,0,n)/2)}var Na,Ra=(t(xa,Na=fr),xa.prototype._createReplicator=function(){return nr([new cr])},xa.prototype._getTimeoutErrorParams=function(t){return{apiFnIndex:lr.error,apiFnChain:this.command.apiFnChain,reason:_.positionUtils.getHiddenReason(t)}},xa.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},xa.prototype._validateElement=function(s,a){var l=this;return c.Promise.resolve().then(function(){return Na.prototype._executeFn.call(l,s)}).then(function(t){var e=t,n=!!e,i=!l.command.visibilityCheck||e&&_.positionUtils.isElementVisible(e),r=c.nativeMethods.dateNow()-a>=l.timeout;if(n&&(i||c.utils.dom.isShadowRoot(e)))return e;if(!r)return _.delay(200).then(function(){return l._validateElement(s,a)});var o=l.getVisibleValueMode?null:l._getTimeoutError(n);if(o)throw o(l._getTimeoutErrorParams(e));return null})},xa.prototype._executeFn=function(t){return this.counterMode?Na.prototype._executeFn.call(this,t):this._validateElement(t,c.nativeMethods.dateNow())},xa);function xa(t,e,n,i,r){var o,s=Na.call(this,t)||this;s.createNotFoundError=i,s.createIsInvisibleError=r,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,s.dependencies.selectorFilter=lr,n&&(o=c.nativeMethods.dateNow()-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies.customDOMProperties;return s.replicator.addTransforms([new zs(a,t.instantiationCallsiteName)]),s}var Da=c.nativeMethods.date,Pa=(Ma.prototype._ensureElement=function(t){var e=this,n=t.selector,i=t.createNotFoundError,r=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new Ra(n,e.globalSelectorTimeout,e.ensureElementsStartTime,i,r).getResult()}).then(function(t){if(!_.domUtils.isDomElement(t))throw o(Qs[t.nodeType]);e.elements.push(t)})},Ma.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Ma);function Ma(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=c.Promise.resolve(),this.ensureElementsStartTime=new Da,t.forEach(function(t){return n._ensureElement(t)})}function Fa(i){return function(t,e){var n=typeof e;if("number"!=n)throw new i(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new i(t,e)}}var Oa,ka,La,Ua,Ha,Ga,Ba,Va,qa,za,Xa,ja,Ya,Ja=Fa(se),Ka=(ka=Fa(Oa=ue),function(t,e){if(ka(t,e),e<0)throw new Oa(t,e)}),$a=(La=he,function(t,e){var n=typeof e;if("boolean"!=n)throw new La(t,n)}),Qa=(Ua=me,function(t,e){var n=typeof e;if("number"!=n)throw new Ua(t,n);if(isNaN(e)||e<.01||1<e)throw new Ua(t,e)}),Za=(Ha=we,function(t,e){var n=typeof e;if("string"!=n)throw new Ha(t,n)}),tl=(Ga=Ee,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof RegExp))throw new Ga(t,n)}),el=(Ba=Se,function(t,e){if(!(e instanceof Date))throw new Ba(t,e)}),nl=(Va=be,function(t,e){if(isNaN(Number(e)))throw new Va(t,typeof e)}),il=(qa=Re,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof URL))throw new qa(t,n)}),rl=(za=Pe,function(t,e){var n=typeof e;if("object"!=n&&!(e instanceof URLSearchParams))throw new za(t,n)}),ol=(Xa=Oe,function(t,e){var n=typeof e;if("object"!=n)throw new Xa(t,n)}),sl=(ja=Ue,function(t,e){var n=typeof e;if("function"!=n)throw new ja(t,n)}),al=(t(ll,Ya=ys),ll.prototype.getAssignableProperties=function(){return[{name:"speed",type:Qa}]},ll);function ll(t,e){var n=Ya.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var ul,cl=(t(dl,ul=al),dl.prototype.getAssignableProperties=function(){return[{name:"offsetX",type:Ja},{name:"offsetY",type:Ja},{name:"isDefaultOffset",type:$a}]},dl);function dl(t,e){var n=ul.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var hl,pl=(t(fl,hl=cl),fl.prototype.getAssignableProperties=function(){return[{name:"scrollToCenter",type:$a},{name:"skipParentFrames",type:$a}]},fl);function fl(t,e){var n=hl.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var ml,gl=(t(vl,ml=ys),vl.prototype.getAssignableProperties=function(){return[{name:"left",type:Ja,defaultValue:null},{name:"right",type:Ja,defaultValue:null},{name:"top",type:Ja,defaultValue:null},{name:"bottom",type:Ja,defaultValue:null}]},vl);function vl(t,e){var n=ml.call(this)||this;return n._assignFrom(t,e),n}var wl,yl=(t(_l,wl=al),_l.prototype.getAssignableProperties=function(){return[{name:"scrollTargetX",type:Ja},{name:"scrollTargetY",type:Ja},{name:"crop",type:ol,init:su},{name:"includeMargins",type:$a},{name:"includeBorders",type:$a},{name:"includePaddings",type:$a}]},_l);function _l(t,e){var n=wl.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 El,Cl=(t(Il,El=ys),Il.prototype.getAssignableProperties=function(){return[{name:"ctrl",type:$a,defaultValue:!1},{name:"alt",type:$a,defaultValue:!1},{name:"shift",type:$a,defaultValue:!1},{name:"meta",type:$a,defaultValue:!1}]},Il);function Il(t,e){var n=El.call(this)||this;return n._assignFrom(t,e),n}var Sl,Al=(t(Wl,Sl=cl),Wl.prototype.getAssignableProperties=function(){return[{name:"modifiers",type:ol,init:au}]},Wl);function Wl(t,e){var n=Sl.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var bl,Tl,Nl,Rl,xl,Dl,Pl,Ml,Fl=(t(Ol,bl=Al),Ol.prototype.getAssignableProperties=function(){return[{name:"caretPos",type:Ka}]},Ol);function Ol(t,e){var n=bl.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}function kl(t,e){var n=Tl.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 Ll(t,e){var n=Nl.call(this)||this;return n.replace=!1,n.paste=!1,n.confidential=void 0,n._assignFrom(t,e),n}function Ul(t,e){var n=Rl.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function Hl(t,e){var n=xl.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function Gl(t,e){var n=Dl.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function Bl(t,e){var n=Pl.call(this)||this;return n.confidential=void 0,n._assignFrom(t,e),n}function Vl(t,e){var n=Ml.call(this)||this;return n._assignFrom(t,e),n}t(kl,Tl=Al),kl.prototype.getAssignableProperties=function(){return[{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:$a},{name:"skipDefaultDragBehavior",type:$a}]},t(Ll,Nl=Fl),Ll.prototype.getAssignableProperties=function(){return[{name:"replace",type:$a},{name:"paste",type:$a},{name:"confidential",type:$a}]},t(Ul,Rl=Al),Ul.prototype.getAssignableProperties=function(){return[{name:"destinationOffsetX",type:Ja},{name:"destinationOffsetY",type:Ja}]},t(Hl,xl=ys),Hl.prototype.getAssignableProperties=function(){return[{name:"portraitOrientation",type:$a}]},t(Gl,Dl=ys),Gl.prototype.getAssignableProperties=function(){return[{name:"timeout",type:Ka},{name:"allowUnawaitedPromise",type:$a}]},t(Bl,Pl=al),Bl.prototype.getAssignableProperties=function(){return[{name:"confidential",type:$a}]},t(Vl,Ml=ys),Vl.prototype.getAssignableProperties=function(){return[{name:"name",type:Za},{name:"value",type:Za},{name:"domain",type:Za},{name:"path",type:Za},{name:"expires",type:el},{name:"maxAge",type:nl},{name:"secure",type:$a},{name:"httpOnly",type:$a},{name:"sameSite",type:Za}]};var ql,zl=(t(Xl,ql=ys),Xl.prototype.getAssignableProperties=function(){return[{name:"username",type:Za,required:!0},{name:"password",type:Za}]},Xl);function Xl(t,e){var n=ql.call(this)||this;return n._assignFrom(t,e),n}var jl,Yl,Jl,Kl,$l,Ql=(t(Zl,jl=ys),Zl.prototype.getAssignableProperties=function(){return[{name:"protocol",type:Za},{name:"host",type:Za,required:!0},{name:"port",type:nl,required:!0},{name:"auth",type:ol,init:ru}]},Zl);function Zl(t,e){var n=jl.call(this)||this;return n._assignFrom(t,e),n}function tu(t,e){var n=Yl.call(this)||this;return n._assignFrom(t,e),n}function eu(t,e){var n=Jl.call(this)||this;return n._assignFrom(t,e),n}function nu(t,e){var n=Kl.call(this)||this;return n._assignFrom(t,e),n}function iu(t,e){var n=$l.call(this)||this;return n._assignFrom(t,e),n}function ru(t,e,n,i){return void 0===i&&(i=!0),new zl(e,i)}function ou(t,e,n,i){return void 0===i&&(i=!0),new Ql(e,i)}function su(t,e,n,i){return void 0===i&&(i=!0),new gl(e,i)}function au(t,e,n,i){return void 0===i&&(i=!0),new Cl(e,i)}function lu(t){return t.top!==t}t(tu,Yl=ys),tu.prototype.getAssignableProperties=function(){return[{name:"url",type:il},{name:"method",type:Za},{name:"headers",type:ol},{name:"params",type:rl},{name:"body"},{name:"timeout",type:nl},{name:"withCredentials",type:$a},{name:"auth",type:ol,init:ru},{name:"proxy",type:ol,init:ou},{name:"rawResponse",type:$a}]},t(eu,Jl=ys),eu.prototype.getAssignableProperties=function(){return[{name:"credentials",type:nl}]},t(nu,Kl=ys),nu.prototype.getAssignableProperties=function(){return[{name:"stack",type:tl,required:!1},{name:"message",type:tl,required:!1},{name:"pageUrl",type:tl,required:!1}]},t(iu,$l=ys),iu.prototype.getAssignableProperties=function(){return[{name:"fn",type:sl,required:!0},{name:"dependencies",type:ol,required:!1}]};var uu=c.eventSandbox.message,cu="driver|browser-manipulation|request",du="driver|browser-manipulation|response";uu.on(uu.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,i,r,o;e.message.cmd===cu&&(t=_.domUtils.findIframeByWindow(e.source),i=(n=e.message).command,(r=n.cropDimensions)&&(i.options=new yl({crop:r,includePaddings:!1})),(o=new hu(i)).element=t,o.execute().then(function(t){return uu.sendServiceMsg({cmd:du,result:t},e.source)}))});var hu=(pu.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 i=n+this.command.options.crop.right,r=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:r,right:i}},pu.prototype._createManipulationReadyMessage=function(){var t=bc.devicePixelRatio||1,e={cmd:d.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:bc.innerWidth,innerHeight:bc.innerHeight,documentWidth:Tc.documentElement.clientWidth,documentHeight:Tc.documentElement.clientHeight,bodyWidth:Tc.body.clientWidth,bodyHeight:Tc.body.clientHeight},disableResending:!0};return this.command.type===h.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},pu.prototype._runScrollBeforeScreenshot=function(){var r=this;return c.Promise.resolve().then(function(){if(r.element||!r.command.selector)return c.Promise.resolve();var t,e,n=r.command.selector.timeout,i="number"==typeof n?n:r.globalSelectorTimeout;return r.statusBar.showWaitingElementStatus(i),t=[{selector:r.command.selector,createNotFoundError:function(t){return new ze(null,t)},createIsInvisibleError:function(t){return new Ye(null,t)},createHasWrongNodeTypeError:function(t){return new $e(t)}}],e=r.globalSelectorTimeout,new Pa(t,e).getElements().then(function(t){r.statusBar.hideWaitingElementStatus(),r.element=t[0]}).catch(function(t){throw r.statusBar.hideWaitingElementStatus(),t})}).then(function(){return function(w,y){return l(this,void 0,void 0,function(){var e,n,i,r,o,s,a,l,u,c,d,h,p,f,m,g,v;return C(this,function(t){if(e=w.getBoundingClientRect(),n={left:e.left,right:e.right,top:e.top,bottom:e.bottom},i=_.styleUtils.getElementMargin(w),r=_.styleUtils.getElementPadding(w),o=_.styleUtils.getBordersWidth(w),y.originOffset={x:0,y:0},s=n.left+w.scrollWidth+o.left+o.right,a=n.top+w.scrollHeight+o.top+o.bottom,n.right=Math.max(n.right,s),n.bottom=Math.max(n.bottom,a),y.includeBorders&&y.includePaddings?y.includeMargins&&(y.originOffset.x-=i.left,y.originOffset.y-=i.top,n.left-=i.left,n.top-=i.top,n.right+=i.right,n.bottom+=i.bottom):(y.originOffset.x+=o.left,y.originOffset.y+=o.top,n.left+=o.left,n.top+=o.top,n.right-=o.right,n.bottom-=o.bottom,y.includePaddings||(y.originOffset.x+=r.left,y.originOffset.y+=r.top,n.left+=r.left,n.top+=r.top,n.right-=r.right,n.bottom-=r.bottom)),n.width=n.right-n.left,n.height=n.bottom-n.top,l=ba({min:y.crop.left,max:y.crop.right,length:y.crop.width},n.width),u=ba({min:y.crop.top,max:y.crop.bottom,length:y.crop.height},n.height),y.crop.left=l.min,y.crop.right=l.max,y.crop.width=l.length,y.crop.top=u.min,y.crop.bottom=u.max,y.crop.height=u.length,y.crop.width<=0||y.crop.height<=0)throw new kn(y.crop.width,y.crop.height);if(c=_.styleUtils.getViewportDimensions(),(n.width>c.width||n.height>c.height)&&(y.scrollToCenter=!0),d="number"==typeof y.scrollTargetX,h="number"==typeof y.scrollTargetY,d||(y.scrollTargetX=Ta(y.crop.left,y.crop.right,c.width)),h||(y.scrollTargetY=Ta(y.crop.top,y.crop.bottom,c.height)),p=E.getOffsetOptions(w,y.scrollTargetX,y.scrollTargetY),f=p.offsetX,m=p.offsetY,y.scrollTargetX=f,y.scrollTargetY=m,g=!d||y.scrollTargetX>=y.crop.left&&y.scrollTargetX<=y.crop.right,v=!h||y.scrollTargetY>=y.crop.top&&y.scrollTargetY<=y.crop.bottom,!g||!v)throw new Mn(g,v);return[2]})})}(r.element,r.command.options)}).then(function(){var t=r.command.options,e=t.scrollTargetX,n=t.scrollTargetY,i=t.scrollToCenter;return new _.ScrollAutomation(r.element,new pl({offsetX:e,offsetY:n,scrollToCenter:i,skipParentFrames:!0})).run()})},pu.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),_.delay(500)},pu.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},pu.prototype._requestManipulation=function(){if(!lu(bc))return c.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return _.sendRequestToFrame({cmd:cu,command:this.command,cropDimensions:t},du,bc.parent).then(function(t){if(!t.result)return{result:null};var e=t.result,n=e.result,i=e.executionError;if(i)throw i;return{result:n}})},pu.prototype._runManipulation=function(){var i=this,r=null;return c.Promise.resolve().then(function(){return i.command.type!==h.takeElementScreenshot?c.Promise.resolve():(_.scrollController.stopPropagation(),i._runScrollBeforeScreenshot())}).then(function(){return lu(bc)?c.Promise.resolve():i._hideUI()}).then(function(){return i._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return _.scrollController.enablePropagation(),r=e,lu(bc)||i._showUI(),_.delay(200)}).then(function(){return new Cs({isCommandResult:!0,result:r})}).catch(function(t){return _.scrollController.enablePropagation(),new Cs({isCommandResult:!0,executionError:t})})},pu.prototype.execute=function(){var t=this;return function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=new _.ClientRequestEmitter,r=new _.RequestBarrier(i),o=new _.ScriptExecutionEmitter,s=new _.ScriptExecutionBarrier(o);_.pageUnloadBarrier.watchForPageNavigationTriggers();var a=null,l=t.apply(void 0,e),u=l.then(function(t){return a=t,c.Promise.all([r.wait().then(function(){return s.wait()}),_.pageUnloadBarrier.wait()])}).then(function(){return a});return{actionPromise:l,barriersPromise:u}}(function(){return t._runManipulation()}).barriersPromise},pu);function pu(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}function fu(e){return e.getResult().then(function(t){return new Cs({isCommandResult:!0,result:e.encodeResult(t)})}).catch(function(t){return new Cs({isCommandResult:!0,executionError:t})})}var mu=s.Promise,gu=(vu.prototype.setAsMaster=function(t){var e=this;return Ss(new To(t),this.driverWindow,As,ei).catch(function(t){if(!e._isNonPageWindow)throw t})},vu.prototype.closeAllChildWindows=function(){return Ss(new xo,this.driverWindow,As,ri)},vu.prototype.findChildWindows=function(t,e){return Ss(new e(t),this.driverWindow,As,ei)},vu.prototype.startToRestore=function(){return Ss(new Mo,this.driverWindow,As,ei)},vu.prototype.closeFileDownloadingWindow=function(){this._isNonPageWindow=!0,this.driverWindow.close()},vu);function vu(t,e){this._isNonPageWindow=!1,this.driverWindow=t,this.windowId=e}var wu=(yu.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},yu.prototype._setAsMaster=function(t,e){return Ss(new To(e),t,As,ei)},yu.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},yu.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},yu.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},yu.prototype.restoreChild=function(i){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){return e=new ko(i),n=this.currentDriverWindow.opener,Ss(e,n,As,ei),[2]})})},yu);function yu(t){this.currentDriverWindow=t}var _u="master",Eu="replica",Cu=(Iu.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},Iu.prototype.toSerializable=function(t){return new Hs(t)},Iu.prototype.fromSerializable=function(){},Iu);function Iu(){this.type="Node"}var Su=(Au.prototype._startListening=function(){var e=this;this._emitter.onRequestSend(function(t){return e._onRequestSend(t)}),this._emitter.onRequestCompleted(function(t){return e._onRequestCompleted(t)}),this._emitter.onRequestError(function(t){return e._onRequestError(t)})},Au.prototype._offListening=function(){this._emitter.offAll()},Au.prototype._onRequestSend=function(t){this._collectingReqs&&this._requests.add(t)},Au.prototype._onRequestCompleted=function(t){var e=this;$s(this._delays.additionalRequestsCollection).then(function(){return e._onRequestFinished(t)})},Au.prototype._onRequestFinished=function(t){this._requests.has(t)&&(this._requests.delete(t),this._collectingReqs||this._requests.size||!this._watchdog||this._finishWaiting())},Au.prototype._onRequestError=function(t){this._onRequestFinished(t)},Au.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._requests.clear(),this._offListening(),this._waitResolve()},Au.prototype.wait=function(t){var n=this;return $s(t?this._delays.pageInitialRequestsCollection:this._delays.requestsCollection).then(function(){return new c.Promise(function(t){var e;n._collectingReqs=!1,n._waitResolve=t,n._requests.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},Au.TIMEOUT)):n._finishWaiting()})})},Au.TIMEOUT=3e3,Au);function Au(t,e){var n,i,r;void 0===e&&(e={}),this._delays={requestsCollection:null!==(n=e.requestsCollection)&&void 0!==n?n:50,additionalRequestsCollection:null!==(i=e.additionalRequestsCollection)&&void 0!==i?i:50,pageInitialRequestsCollection:null!==(r=e.pageInitialRequestsCollection)&&void 0!==r?r:50},this._emitter=t,this._waitResolve=null,this._watchdog=null,this._requests=new Set,this._collectingReqs=!0,this._startListening()}var Wu=(bu.prototype._startListening=function(){var e=this;this._emitter.onScriptAdded(function(t){return e._onScriptElementAdded(t)}),this._emitter.onScriptLoadedOrFailed(function(t){return e._onScriptLoadedOrFailed(t)})},bu.prototype._offListening=function(){this._emitter.offAll()},bu.prototype._onScriptElementAdded=function(t){var e=this,n=(0,c.nativeMethods.setTimeout)(function(){return e._onScriptLoadedOrFailed(t,!0)},bu.LOADING_TIMEOUT);this._scripts.set(t,n)},bu.prototype._onScriptLoadedOrFailed=function(t,e){var n=this;void 0===e&&(e=!1),this._scripts.has(t)&&(e||(0,c.nativeMethods.clearTimeout)(this._scripts.get(t)),this._scripts.delete(t),this._scripts.size||$s(25).then(function(){n._waitResolve&&!n._scripts.size&&n._finishWaiting()}))},bu.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._scripts.clear(),this._offListening(),this._waitResolve(),this._waitResolve=null},bu.prototype.wait=function(){var n=this;return new c.Promise(function(t){var e;n._waitResolve=t,n._scripts.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},bu.TIMEOUT)):n._finishWaiting()})},bu.TIMEOUT=3e3,bu.LOADING_TIMEOUT=2e3,bu);function bu(t){this._emitter=t,this._watchdog=null,this._waitResolve=null,this._scripts=new Map,this._startListening()}var Tu=(Nu.prototype.wait=function(){var t=this;return c.Promise.all([this._requestBarrier.wait().then(function(){return t._scriptExecutionBarrier.wait()}),this._unloadBarrier.wait()]).then()},Nu);function Nu(t,e,n){this._requestBarrier=new Su(t),this._scriptExecutionBarrier=new Wu(e),(this._unloadBarrier=n).watchForPageNavigationTriggers&&n.watchForPageNavigationTriggers()}function Ru(t,e){var n=E.calculateSelectTextArguments(e[0],t);return new E.SelectText(e[0],n.startPos,n.endPos,t.options)}function xu(t){if(!_.domUtils.isFileInput(t))throw new xn}function Du(r,o){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return f(r)?[4,(e=r,i={stack:(n=o).stack,pageUrl:n.pageUrl,message:n.msg},e.args=[[i]],new fr(e).getResult())]:[3,2];case 1:return[2,t.sent()];case 2:return[2,r||!1]}var e,n,i})})}Sa.ACTIONS_HANDLERS[h.dispatchEvent]={additionalSelectorProps:["relatedTarget"],create:function(t,e){return e[1]&&(t.options.relatedTarget=e[1]),new E.DispatchEvent(e[0],t.eventName,t.options)}},Sa.ACTIONS_HANDLERS[h.pressKey]={create:function(t,e,n){return new E.Press(_.parseKeySequence(t.keys).combinations,t.options,n)},ensureCmdArgs:function(t){if(_.parseKeySequence(t.keys).error)throw new An("keys")}},Sa.ACTIONS_HANDLERS[h.click]={create:function(t,e,n){return/option|optgroup/.test(_.domUtils.getTagName(e[0]))?new E.SelectChildClick(e[0],t.options):new E.Click(e[0],t.options,bc,E.cursor,n)}},Sa.ACTIONS_HANDLERS[h.rightClick]={create:function(t,e){return new E.RClick(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.doubleClick]={create:function(t,e){return new E.DblClick(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.hover]={create:function(t,e,n){return new E.Hover(e[0],t.options,n)}},Sa.ACTIONS_HANDLERS[h.drag]={create:function(t,e){return new E.DragToOffset(e[0],t.dragOffsetX,t.dragOffsetY,t.options)}},Sa.ACTIONS_HANDLERS[h.dragToElement]={additionalSelectorProps:["destinationSelector"],create:function(t,e){return new E.DragToElement(e[0],e[1],t.options)}},Sa.ACTIONS_HANDLERS[h.scroll]={create:function(t,e){var n=t.x,i=t.y,r=t.position,o=t.options;return new E.SetScroll(e[0],{x:n,y:i,position:r},o)}},Sa.ACTIONS_HANDLERS[h.scrollBy]={create:function(t,e){var n=t.byX,i=t.byY,r=t.options;return new E.SetScroll(e[0],{byX:n,byY:i},r)}},Sa.ACTIONS_HANDLERS[h.scrollIntoView]={create:function(t,e){return new E.ScrollIntoView(e[0],t.options)}},Sa.ACTIONS_HANDLERS[h.typeText]={create:function(t,e,n){return new E.Type(e[0],t.text,t.options,n)}},Sa.ACTIONS_HANDLERS[h.selectText]={create:Ru,ensureElsProps:function(t){if(!_.domUtils.isEditableElement(t[0]))throw new pn}},Sa.ACTIONS_HANDLERS[h.selectTextAreaContent]={create:Ru,ensureElsProps:function(t){if(!_.domUtils.isTextAreaElement(t[0]))throw new gn}},Sa.ACTIONS_HANDLERS[h.selectEditableContent]={additionalSelectorProps:["startSelector","endSelector"],create:function(t,e){return t.endSelector=t.endSelector||t.startSelector,new E.SelectEditableContent(e[0],e[1],t.options)},ensureElsProps:function(t){if(!_.domUtils.isContentEditableElement(t[0]))throw new yn("startSelector");if(!_.domUtils.isContentEditableElement(t[1]))throw new yn("endSelector");if(!_.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Cn}},Sa.ACTIONS_HANDLERS[h.setFilesToUpload]={create:function(t,e,n){return new E.Upload(e[0],t.filePath,function(t,e){return new Tn(t,e)},n)},ensureElsProps:function(t){return xu(t[0])}},Sa.ACTIONS_HANDLERS[h.clearUpload]={create:function(t,e){return new E.Upload(e[0])},ensureElsProps:function(t){return xu(t[0])}};var Pu,Mu=s.settings,Fu=s.transport,Ou=s.Promise,ku=s.eventSandbox.message,Lu=s.storages,Uu=s.nativeMethods,Hu=Uu.date,Gu=s.eventSandbox.listeners,Bu=s.utils.url,Vu="testcafe|driver|test-done-sent-flag",qu="testcafe|driver|pending-status",zu="testcafe|driver|executing-client-function-descriptor",Xu="testcafe|driver|executing-skip-js-errors-function-flag",ju="testcafe|driver|selector-execution-start-time",Yu="testcafe|driver|pending-page-error",Ju="testcafe|driver|active-iframe-selector",Ku="testcafe|driver|test-speed",$u="testcafe|driver|assertion-retries-timeout",Qu="testcafe|driver|assertion-retries-start-time",Zu="testcafe|driver|console-messages",tc="testcafe|driver|pending-child-window-count",ec={NotLoadedError:Vn,NotFoundError:ze,IsInvisibleError:Ye},nc={NotLoadedError:Xn,NotFoundError:xi,IsInvisibleError:Mi},ic=Math.pow(2,31)-1,rc="status-with-command-result-event",oc="empty-command-event",sc="child-window-closed",ac="skip-js-errors-function-execution-complete",lc=(t(uc,Pu=_.serviceUtils.EventEmitter),uc.prototype._isOpenedInIframe=function(){var t=bc.opener;return t&&t.top&&t.top!==t},Object.defineProperty(uc.prototype,"speed",{get:function(){return this.contextStorage.getItem(Ku)},set:function(t){this.contextStorage.setItem(Ku,t)},enumerable:!1,configurable:!0}),Object.defineProperty(uc.prototype,"consoleMessages",{get:function(){return new Ki(this.contextStorage.getItem(Zu))},set:function(t){this.contextStorage.setItem(Zu,t?t.getCopy():null)},enumerable:!1,configurable:!0}),uc.prototype._getReadyPromise=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,_.eventUtils.documentReady(this.options.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},uc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},uc.prototype._getCurrentWindowId=function(){if(this.options.nativeAutomation)return this.runInfo.windowId;var t=bc.location.toString(),e=s.utils.url.parseProxyUrl(t);return e&&e.windowId||null},uc.prototype._onJsError=function(n){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:if(this.contextStorage.getItem(Vu))return[2];if(!this.options.skipJsErrors)return[3,6];this.contextStorage.setItem(Xu,!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,Du(this.options.skipJsErrors,n)];case 2:return t.sent()||this._setUncaughtErrorOnPage(n),[3,5];case 3:return e=t.sent(),this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,e),[3,5];case 4:return this.contextStorage.setItem(Xu,!1),this.emit(ac),[7];case 5:return[2];case 6:return this._setUncaughtErrorOnPage(n),[2]}})})},uc.prototype._setUncaughtErrorOnPage=function(t){var e=new zt(t.stack,t.pageUrl);this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,e)},uc.prototype._unlockPageAfterTestIsDone=function(){return this.options.nativeAutomation||_.disableRealEventsPreventing(),Ou.resolve()},uc.prototype._getActiveElement=function(){return l(this,void 0,void 0,function(){var e;return C(this,function(t){return e=_.domUtils.getActiveElement(),[2,this.replicator.encode(e)]})})},uc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(zu);return!!t&&(this._onReady(new Cs({isCommandResult:!0,executionError:new Rt(t.instantiationCallsiteName)})),!0)},uc.prototype.onCustomClientScriptError=function(t,e){var n=e?new ie(t,e):new te(t);this.contextStorage.getItem(Yu)||this.contextStorage.setItem(Yu,n)},uc.prototype._addChildWindowDriverLink=function(t,e){var n=new gu(t,e);this.childWindowDriverLinks.push(n),this._ensureClosedChildWindowWatcher()},uc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=Uu.setInterval.call(bc,function(){var t=_.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(sc),_.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(Uu.clearInterval.call(bc,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},uc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===_u},uc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Ou.resolve().then(function(){return _.browser.setActiveWindowId(t.communicationUrls.activeWindowId,s.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new Cs({isCommandResult:!0,executionError:new ei}))}))},uc.prototype._onBeforeChildWindowOpened=function(t){this.options.nativeAutomation&&(this.options.experimentalMultipleWindows||(this._onReady(new Cs({isCommandResult:!0,executionError:new Vi})),t.isPrevented=!0))},uc.prototype._ensureNewWindowOpenedInNativeAutomation=function(n){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,_.browser.ensureWindowInNativeAutomation(this.communicationUrls.ensureWindowInNativeAutomationUrl,s.createNativeXHR)];case 1:return(e=t.sent()).windowId?(n.form?Uu.formSubmit.apply(n.form):Uu.windowOpen.call(bc,n.pageUrl,n.windowName),[2,e.windowId]):[2,null]}})})},uc.prototype._onChildWindowOpened=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return e=n.windowId,!this.options.nativeAutomation||i?[3,2]:(this._waitChildWindowOpenedInNativeAutomation=this._ensureNewWindowOpenedInNativeAutomation(n),[4,this._waitChildWindowOpenedInNativeAutomation]);case 1:if(!(e=t.sent()))return[2];t.label=2;case 2:return this._addChildWindowDriverLink(n.window,e),this._switchToChildWindow(e),[2]}})})},uc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(tc,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},uc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(Vu)&&(t.preventSubmit=!0)},uc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,i=this.consoleMessages;i.addMessage(e,n,this.windowId),this.consoleMessages=i},uc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(Yu);e&&(this.contextStorage.setItem(Yu,null),t.pageError=e)},uc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},uc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},uc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=this._isPendingSwitchingWindow()},uc.prototype._sendStatusRequest=function(t){function e(){return _.getTimeLimitedPromise(Fu.asyncServiceMsg(i),5e3)}function n(){return _.delay(300).then(e)}for(var i={cmd:d.ready,status:t,disableResending:!0,allowRejecting:!0},r=e(),o=0;o<u;o++)r=r.catch(n);return r},uc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem(qu,t);var n=null;return _.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,_.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem(qu,null),n})},uc.prototype._addChildIframeDriverLink=function(t,e){var n,i=this._getChildIframeDriverLinkByWindow(e);i||(n="".concat(this.testRunId,"-").concat(Rr()),i=new bs(e,n,{single:this.communicationUrls.dispatchNativeAutomationEvent,sequence:this.communicationUrls.dispatchNativeAutomationEventSequence}),this.childIframeDriverLinks.push(i)),i.sendConfirmationMessage(t)},uc.prototype._getTargetWindowNotFoundResult=function(t,e){return Ou.resolve({success:!1,errCode:t,errMsg:e})},uc.prototype._getChildWindowValidateResult=function(t){var e=t.find(function(t){return t.result.success});if(e)return e.result;var n=t.find(function(t){return t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError||t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},uc.prototype._handleWindowValidation=function(n,i,r,o){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,i,r,o)];case 1:return e=t.sent(),Ws({requestMsgId:n.id,window:i,result:e}),[2]}})})},uc.prototype._getWindowInfo=function(){var t=bc.location.toString();return this.options.nativeAutomation||(t=s.utils.url.parseProxyUrl(t).destUrl),{id:this.windowId,title:Tc.title,url:t}},uc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},uc.prototype._validateWindow=function(i,t,r,o){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return this._isTargetWindow(i)?[2,r()]:this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(i,o)}),[4,Ou.all(e)]):[2,this._getTargetWindowNotFoundResult(_.TEST_RUN_ERRORS.targetWindowNotFoundError)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},uc._createWindowValidationError=function(t){var e=t.errCode;return new(e===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError?ai:e===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent?ci:gi)},uc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Ou.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError}):Ou.resolve({success:!0}):Ou.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent})},uc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},to)},uc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Ou.resolve({success:!0})},io)},uc.prototype._handleCloseWindow=function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),Ws({requestMsgId:e.id,window:n}),[2]}})})},uc.prototype._closeWindowAndWait=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return e=this._createWaitForEventPromise(sc,2e3),n.ignoreMasterSwitching=!i.isCurrentWindow,this.closing?[3,2]:(this.closing=!0,[4,_.browser.closeWindow(this.communicationUrls.closeWindow,s.createNativeXHR,this.windowId)]);case 1:t.sent(),t.label=2;case 2:return n.driverWindow.close(),[2,e]}})})},uc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Ou.resolve();var t=this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId});if(t)return this._closeWindowAndWait(t,e);var n=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,uo)});return Ou.all(n)},uc.prototype._getWindows=function(){return l(this,void 0,void 0,function(){var e,n,i,r,o,s;return C(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},so)}),[4,Ou.all(e)]):[2,[this._getWindowInfo()]];case 1:for(n=t.sent(),i=[this._getWindowInfo()],r=0,o=n;r<o.length;r++)s=o[r],Array.isArray(s.result)&&(i=i.concat(s.result));return[2,i]}})})},uc.prototype._handleGetWindows=function(n,i){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,i)];case 1:return e=t.sent(),Ws({requestMsgId:n.id,window:i,result:e}),[2]}})})},uc.prototype._handleSwitchToWindow=function(e,n){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),Ws({requestMsgId:e.id,window:n}),[2]}})})},uc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Ou.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Ou.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,po)})):Ou.resolve()},uc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,Ws({requestMsgId:t.id,window:e}),Ou.resolve().then(function(){return _.browser.setActiveWindowId(n.communicationUrls.activeWindowId,s.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new Cs({isCommandResult:!0,executionError:new ei}))}))},uc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){Ws({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new Cs({isCommandResult:!0,executionError:new ri}))})},uc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},uc.prototype._handleHasPendingActionFlags=function(t,e){var n=this._hasPendingActionFlags(this.contextStorage);Ws({requestMsgId:t.id,window:e,result:n})},uc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink(e,t.windowId),this.childWindowDriverLinks.length===this.contextStorage.getItem(tc)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(tc,0)),Ws({requestMsgId:t.id,window:e}))},uc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Ou(function(t){e._resolvePendingChildWindowInIframe=t})},uc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){Ws({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId},!0)},uc.prototype._handleStopInternalFromFrame=function(t,e){Ws({requestMsgId:t.id,window:e}),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._stopInternal()},uc.prototype._initChildDriverListening=function(){var i=this;ku.on(ku.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case Pr:i._addChildIframeDriverLink(e.id,n);break;case Yr:i._handleChildWindowIsOpenedInIFrame(e,n);break;case jr:i._handleChildWindowIsLoadedInIFrame(e,n);break;case Jr:i._handleStopInternalFromFrame(e,n);break;case Vr:i._handleSetAsMasterMessage(e,n);break;case Mr:i._handleSwitchToWindow(e,n);break;case Fr:i._handleCloseWindow(e,n);break;case kr:i._handleSwitchToWindowValidation(e,n);break;case Or:i._handleCloseWindowValidation(e,n);break;case Lr:i._handleGetWindows(e,n);break;case qr:i._handleCloseAllWindowsMessage(e,n);break;case zr:i._handleStartToRestoreChildLinkMessage();break;case Kr:i._handleHasPendingActionFlags(e,n);break;case Xr:i._handleRestoreChildLink(e,n)}})},uc.prototype._getChildIframeDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},uc.prototype._getChildWindowDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},uc.prototype._runInActiveIframe=function(t){var e=this,n=Ou.resolve(),i=this.contextStorage.getItem(Ju);!this.activeChildIframeDriverLink&&i&&(n=this._switchToIframe(i,nc)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed,e.options.nativeAutomation)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new Cs({isCommandResult:!0,executionError:t}))})},uc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Ou.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},uc.prototype._ensureChildIframeDriverLink=function(t,e,n){var i=this;return _.waitFor(function(){return i._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},uc.prototype._ensureChildWindowDriverLink=function(t,e,n){var i=this;return _.waitFor(function(){return i._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},uc.prototype._switchToIframe=function(e,n){var t,i,r,o,s,a,l,u=this,c="number"==typeof e.timeout,d=c?e.timeout:this.options.selectorTimeout;return t=e,i=d,r=null,o=function(t){return new n.NotFoundError(null,t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new Ra(t,i,r,o,s),a.showWaitingElementStatus(l.timeout),l.getResult().then(function(t){return a.hideWaitingElementStatus(!!t).then(function(){return t})}).catch(function(t){return a.hideWaitingElementStatus(!1).then(function(){throw t})}).then(function(t){if(!_.domUtils.isIframeElement(t))throw new Hn;var e=c?d:Math.max(d,5e3);return u._ensureChildIframeDriverLink(Uu.contentWindowGetter.call(t),n.NotLoadedError,e)}).then(function(t){t.availabilityTimeout=d,u.activeChildIframeDriverLink=t,u.contextStorage.setItem(Ju,e)})},uc.prototype._createWaitForEventPromise=function(e,n){var i=this,r=null,t=new Ou(function(t){Uu.setTimeout.call(bc,function(){i.off(e,r),t()},n)}),o=new Ou(function(t){r=function(){this.off(e,r),t()},i.on(e,r)});return Ou.race([t,o])},uc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(rc,ic):Ou.resolve()},uc.prototype._waitForSkipJsErrorFunctionCompletion=function(n){var i=this;return this.contextStorage.getItem(Xu)?new Ou(function(t){var e=function(){i.off(ac,e),t(n)};i.on(ac,e)}):Ou.resolve(n)},uc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(oc,3e4)},uc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw _.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Ai},uc.prototype._switchToChildWindow=function(t){var e=this;this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0);var n=this.contextStorage.getItem(this.WINDOW_COMMAND_API_CALL_FLAG);return function(e,t){if("string"!=typeof e)return mu.resolve(null);var n=_.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return mu.resolve(n);var i=new Jn;return mu.reject(i)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,Qn,e.options.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return e._observeFileDownloadingInNewWindow(),e._abortSwitchingToChildWindowIfItClosed(),e._stopInternal(),e.activeChildWindowDriverLink.setAsMaster(n)}).then(function(){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(t){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1),t instanceof Ai?e._onReady(new Cs):e._onReady(new Cs({isCommandResult:!0,executionError:new ei}))})},uc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},uc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},uc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Ou.resolve().then(function(){return n._stopInternal(),t(e)}).then(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1),n._onReady(new Cs({isCommandResult:!0,executionError:new ei}))})},uc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},uc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(Ju,null),this.activeChildIframeDriverLink=null},uc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new Ao(t),n=0;n<this.childIframeDriverLinks.length;n++)ku.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},uc.prototype.createDispatchNativeAutomationEventFunctions=function(){return this.options.nativeAutomation?{single:this._createDispatchNativeAutomationEventFn("dispatchNativeAutomationEvent"),sequence:this._createDispatchNativeAutomationEventFn("dispatchNativeAutomationEventSequence")}:null},uc.prototype._createDispatchNativeAutomationEventFn=function(t){return Uu.functionBind.call(_.browser[t],_.browser[t],this.communicationUrls[t],s.createNativeXHR)},uc.prototype._onActionCommand=function(t){var o=this,e=new Sa(t,{globalSelectorTimeout:this.options.selectorTimeout,testSpeed:this.speed,executeSelectorFn:function(t,e,n){var i=ea(e.notFound),r=ea(e.invisible);return new Ra(t,o.options.selectorTimeout,n,i,r).getResult()},dispatchNativeAutomationEventFn:this.createDispatchNativeAutomationEventFunctions()}),n=[];e.on(Sa.EXECUTION_STARTED_EVENT,function(){o.statusBar.hideWaitingElementStatus(!0),o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),e.on(Sa.WAITING_FOR_ELEMENT_EVENT,function(t){o.statusBar.showWaitingElementStatus(t)}),e.on(Sa.WARNING_EVENT,function(t){n.push(t)});var i=new _.ClientRequestEmitter,r=new _.ScriptExecutionEmitter,s=new Tu(i,r,_.pageUnloadBarrier);e.execute(s).then(function(t){return new Cs({isCommandResult:!0,result:nr(new Cu).encode(t),warnings:n})}).catch(function(t){return o.statusBar.hideWaitingElementStatus(!1).then(function(){return new Cs({isCommandResult:!0,executionError:t})})}).then(function(t){return o._waitForSkipJsErrorFunctionCompletion(t)}).then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o.contextStorage.setItem(Xu,!1),o._waitChildWindowOpenedInNativeAutomation?o._waitChildWindowOpenedInNativeAutomation.then(function(){return t}):t}).then(function(t){o._onReady(t)})},uc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},uc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onNavigateToCommand=function(t){var e,n,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),this.options.nativeAutomation&&(void 0===(n=t.url)&&(n=""),0===n.indexOf("file://"))?(e={createXHR:s.createNativeXHR,openFileProtocolUrl:this.communicationUrls.openFileProtocolUrl},_.browser.redirectUsingCdp(t,e)):function(r){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new _.ClientRequestEmitter,n=new _.RequestBarrier(e),c.navigateTo(r.url,r.forceReload),[4,c.Promise.all([n.wait(),_.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new Cs({isCommandResult:!0})];case 2:return i=t.sent(),[2,new Cs({isCommandResult:!0,executionError:i})];case 3:return[2]}})})}(t).then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},uc.prototype._onGetProxyUrlCommand=function(t){this._onReady(new Cs({isCommandResult:!0,result:Bu.getProxyUrl(t.url,t.options)}))},uc.prototype._onSkipJsErrorsCommand=function(t){var e=t.options;this.options.skipJsErrors=e,this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(zu,{instantiationCallsiteName:t.instantiationCallsiteName}),fu(new fr(t)).then(function(t){e.contextStorage.setItem(zu,null),e._onReady(t)})},uc.prototype._onExecuteSelectorCommand=function(t){var e,n,i,r,o,s,a,l=this,u=this.contextStorage.getItem(ju)||new Hu,c=ea("CannotObtainInfoForElementSpecifiedBySelectorError"),d=t.strictError?ea(ta()):c,h=t.strictError?ea(Zs()):c;e=t,n=this.options.selectorTimeout,i=u,r=t.needError?d:null,o=t.needError?h:null,s=this.statusBar,a=new Ra(e,n,i,r,o),s.showWaitingElementStatus(a.timeout),fu(a).then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem(ju,null),l._onReady(t)})},uc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,ec).then(function(){return e._onReady(new Cs({isCommandResult:!0}))}).catch(function(t){return e._onReady(new Cs({isCommandResult:!0,executionError:t}))})},uc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),bc.open(t.url)},uc.prototype._onWindowCloseCommand=function(a){return l(this,void 0,void 0,function(){var e,n,i,r,o,s;return C(this,function(t){switch(t.label){case 0:e=this._getTopOpenedWindow(),n=a.windowId||this.windowId,i=n===this.windowId,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this._validateChildWindowCloseCommandExists(n,e)];case 2:if(r=t.sent(),!(o=r.result).success)throw uc._createWindowValidationError(o);return[4,Ss(new uo({windowId:n,isCurrentWindow:i}),e,As,ei)];case 3:return t.sent(),i||this._onReady(new Cs({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new Cs({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},uc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:{id:this.windowId}}))},uc.prototype._onGetWindowsCommand=function(){return l(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,Ss(new so,e,As,ei)];case 1:return n=t.sent(),this._onReady(new Cs({isCommandResult:!0,result:n.result})),[2]}})})},uc.prototype._validateChildWindowCloseCommandExists=function(t,e){return Ss(new to({windowId:t}),e,As,ei)},uc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,i=t.fn;return Ss(new io({windowId:n,fn:i}),e,As,ei)},uc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||bc).top},uc.prototype._onSwitchToWindow=function(r,o){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:r.windowId,fn:r.checkWindow},e)];case 1:return n=t.sent(),(i=n.result).success?(this._stopInternal(),Ss(new po({windowId:r.windowId,fn:r.checkWindow}),e,As,ei)):this._onReady(new Cs({isCommandResult:!0,executionError:o||uc._createWindowValidationError(i)})),[2]}})})},uc.prototype._restoreChildWindowLinks=function(){return l(this,void 0,void 0,function(){var e,n,i=this;return C(this,function(t){switch(t.label){case 0:if(!(e=this.contextStorage.getItem(tc))||e===this.childWindowDriverLinks.length)return[2];n=new Ou(function(t){i._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,_.getTimeLimitedPromise(n,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new Cs({isCommandResult:!0,executionError:new Ti})),[3,4];case 4:return[2]}})})},uc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Ci)},uc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new Cs({isCommandResult:!0,executionError:new yi}))},uc.prototype._onBrowserManipulationCommand=function(t){var e,n,i,r=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.options.selectorTimeout,i=this.statusBar,new hu(e,n,i).execute().then(function(t){return r.contextStorage.setItem(r.COMMAND_EXECUTING_FLAG,!1),r._onReady(t)})},uc.prototype._onSetBreakpointCommand=function(t){var n=this,e=t.isTestError,i=t.selector,r=this.statusBar.showDebuggingStatus(e);this.selectorInspectorPanel.show(i),r.then(function(t){var e=t===y;n._onReady(new Cs({isCommandResult:!0,result:e}))})},uc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem($u,t.timeout),this.contextStorage.setItem(Qu,Uu.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new Cs({isCommandResult:!0}))},uc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem($u,null),this.contextStorage.setItem(Qu,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new Cs({isCommandResult:!0}))})},uc.prototype._checkStatus=function(){var i=this,t={statusUrl:this.communicationUrls.statusDone};return _.browser.checkStatus(t,s.createNativeXHR,{manualRedirect:!0,nativeAutomation:this.options.nativeAutomation}).then(function(t){var e,n=t.command;n.testRunId!==i.testRunId?(Lu.clear(),Lu.lock(),e={createXHR:s.createNativeXHR,openFileProtocolUrl:i.communicationUrls.openFileProtocolUrl,nativeAutomation:i.options.nativeAutomation},_.browser.redirect(n,e)):(i.contextStorage.setItem(Vu,!1),i._onReady({isCommandResult:!1}))}).catch(function(){return _.delay(1e3)})},uc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new Cs({isCommandResult:!0,result:t}))})},uc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Ou.all(this.childWindowDriverLinks.map(function(t){return t.ignoreMasterSwitching=!0,t.closeAllChildWindows()})).then(function(){Uu.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Ou.resolve()},uc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(Vu,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new Cs({isCommandResult:!0,executionError:ri}))})},uc.prototype._onBackupStoragesCommand=function(){this._onReady(new Cs({isCommandResult:!0,result:Lu.backup()}))},uc.prototype._isPendingSwitchingWindow=function(){return!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},uc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&this._isPendingSwitchingWindow()},uc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&this._isPendingSwitchingWindow()},uc.prototype._observeFileDownloadingInNewWindow=function(){var e=this,t=new Cs({isObservingFileDownloadingInNewWindow:!0});this._isPendingSwitchingWindow()&&this._sendStatus(t).then(function(t){t?e._onCommand(t):e._observeFileDownloadingInNewWindow()})},uc.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(rc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(oc);e._onReady(new Cs)}})},uc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.selectorInspectorPanel&&this.selectorInspectorPanel.hide(),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===h.testDone?this._onTestDone(new Cs({isCommandResult:!0})):t.type===h.setBreakpoint?this._onSetBreakpointCommand(t):t.type===h.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===h.switchToIframe?this._onSwitchToIframeCommand(t):t.type===h.openWindow?this._onWindowOpenCommand(t):t.type===h.closeWindow?this._onWindowCloseCommand(t):t.type===h.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===h.getCurrentWindows?this._onGetWindowsCommand():t.type===h.switchToWindow?this._onSwitchToWindow(t):t.type===h.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===h.switchToParentWindow?this._onSwitchToParentWindow():g(t)?this._onBrowserManipulationCommand(t):t.type===h.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===h.executeSelector?this._onExecuteSelectorCommand(t):t.type===h.navigateTo?this._onNavigateToCommand(t):t.type===h.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===h.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===h.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===h.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===h.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===h.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===h.backupStorages?this._onBackupStoragesCommand():t.type===h.closeChildWindowOnFileDownloading?this._closeChildWindowOnFileDownloading():t.type===h.getProxyUrl?this._onGetProxyUrlCommand(t):t.type===h.skipJsErrors?this._onSkipJsErrorsCommand(t):this._onActionCommand(t)},uc.prototype._closeChildWindowOnFileDownloading=function(){this.activeChildWindowDriverLink.closeFileDownloadingWindow(),_.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),E.cursor.show(),this._startInternal()},uc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===h.testDone||e.type===h.switchToMainWindow||e.type===h.setNativeDialogHandler||e.type===h.getNativeDialogHistory||e.type===h.setTestSpeed||e.type===h.showAssertionRetriesStatus||e.type===h.hideAssertionRetriesStatus||e.type===h.setBreakpoint||g(e)&&e.type!==h.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},uc.prototype._onCommand=function(n){var i=this;this.readyPromise.then(function(){var t,e=p(n);i.contextStorage.getItem(Yu)&&e?i._onReady(new Cs({isCommandResult:!0})):(t=i.activeChildIframeDriverLink||i.contextStorage.getItem(Ju),i._isExecutableInTopWindowOnly(n)||!t?i._executeCommand(n):i._runInActiveIframe(n))})},uc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},uc.prototype._startInternal=function(t){this.role=_u,_.browser.startHeartbeat(this.communicationUrls.heartbeat,s.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},uc.prototype._stopInternal=function(){this.role=Eu,_.browser.stopHeartbeat(),E.cursor.hide()},uc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem($u);e&&(t=n.contextStorage.getItem(Qu),0<e-(new Hu-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},uc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,i=this.contextStorage.getItem(qu);i&&(i.resent=!0),this.contextStorage.getItem(Vu)?i?this._onTestDone(i):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=i||new Cs({isCommandResult:e,isFirstRequestAfterWindowSwitching:t.isFirstRequestAfterWindowSwitching,result:t.result}),this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!1),this._onReady(n))},uc.prototype._initParentWindowLink=function(){bc.opener&&bc.opener!==bc&&this.windowId&&(this.parentWindowDriverLink=new wu(bc))},uc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},uc.prototype._getDriverRole=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return this.windowId||this.options.nativeAutomation?[4,_.browser.getActiveWindowId(this.communicationUrls.activeWindowId,s.createNativeXHR)]:[2,_u];case 1:return[2,t.sent().activeWindowId===this.windowId?_u:Eu]}})})},uc.prototype._init=function(){var t=this.options,e=t.nativeAutomation,n=t.dialogHandler,i=t.speed;this.contextStorage=new ls(bc,{testRunId:this.testRunId,windowId:this.windowId,nativeAutomation:e}),this.nativeDialogsTracker=new Tr(this.contextStorage,{nativeAutomation:e,dialogHandler:n}),this.statusBar=new o.StatusBar(this.runInfo.userAgent,this.runInfo.fixtureName,this.runInfo.testName,this.contextStorage,e),this.selectorInspectorPanel=new o.SelectorInspectorPanel(this.statusBar);var r=this;this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,function(){r.options.nativeAutomation||_.disableRealEventsPreventing()}),this.speed=i,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&Ss(new Ho(this.windowId),bc.opener.top,As,gi)},uc.prototype._doFirstPageLoadSetup=function(){return l(this,void 0,void 0,function(){return C(this,function(t){return this.isFirstPageLoad&&this.options.canUseDefaultWindowActions,[2]})})},uc.prototype.start=function(){return l(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return this._init(),[4,this._doFirstPageLoadSetup()];case 1:return t.sent(),[4,this._restoreChildWindowLinks()];case 2:return t.sent(),[4,this._getDriverRole()];case 3:return e=t.sent(),this.role===_u||e===_u&&this._startInternal(),[2]}})})},uc);function uc(t,e,n,i){var r=Pu.call(this)||this;r.COMMAND_EXECUTING_FLAG="testcafe|driver|command-executing-flag",r.EXECUTING_IN_IFRAME_FLAG="testcafe|driver|executing-in-iframe-flag",r.PENDING_WINDOW_SWITCHING_FLAG="testcafe|driver|pending-window-switching-flag",r.WINDOW_COMMAND_API_CALL_FLAG="testcafe|driver|window-command-api-flag",r.testRunId=t,r.communicationUrls=e,r.runInfo=n,r.options=i,r.isFirstPageLoad=Mu.get().isFirstPageLoad,r.customCommandHandlers={},r.contextStorage=null,r.nativeDialogsTracker=null,r.childIframeDriverLinks=[],r.activeChildIframeDriverLink=null,r.childWindowDriverLinks=[],r.parentWindowDriverLink=null,r.statusBar=null,r.selectorInspectorPanel=null,r.windowId=r._getCurrentWindowId(),r.role=Eu,r.setAsMasterInProgress=!1,r.checkClosedChildWindowIntervalId=null;var o=new _.ClientRequestEmitter;return r.pageInitialRequestBarrier=new _.RequestBarrier(o),r.readyPromise=r._getReadyPromise(),r._initChildDriverListening(),_.pageUnloadBarrier.init(),r.options.nativeAutomation||_.preventRealEvents(),s.on(s.EVENTS.uncaughtJsError,function(t){return r._onJsError(t)}),s.on(s.EVENTS.unhandledRejection,function(t){return r._onJsError(t)}),s.on(s.EVENTS.consoleMethCalled,function(t){return r._onConsoleMessage(t)}),s.on(s.EVENTS.beforeFormSubmit,function(t){return r._onFormSubmit(t)}),s.on(s.EVENTS.beforeWindowOpened,function(t){return r._onBeforeChildWindowOpened(t)}),s.on(s.EVENTS.windowOpened,function(t){return r._onChildWindowOpened(t)}),r.setCustomCommandHandlers(h.unlockPage,function(){return r._unlockPageAfterTestIsDone()}),r.setCustomCommandHandlers(h.getActiveElement,function(){return r._getActiveElement()}),Gu.addInternalEventBeforeListener(bc,["beforeunload"],function(){r._sendStartToRestoreCommand()}),r.replicator=nr([new zs]),r}var cc=(dc.prototype.establishConnection=function(){return Ss(new $r,this.driverWindow,5e3,Xn).then(function(t){return t.result})},dc.prototype.sendConfirmationMessage=function(t){Ws({requestMsgId:t,window:this.driverWindow})},dc.prototype.onCommandExecuted=function(t){var e=new go(t);c.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},dc.prototype.hasPendingActionFlags=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,Ss(new Jo,this.driverWindow,5e3,Xn)];case 1:return[2,t.sent().result]}})})},dc);function dc(t){this.driverWindow=t}var hc,pc=s.eventSandbox.message,fc=(t(mc,hc=Tr),mc.prototype._defaultDialogHandler=function(t){pc.sendServiceMsg({type:vr,dialogType:t,url:Tr._getPageUrl()},bc.top)},mc.prototype._addAppearedDialogs=function(t,e){pc.sendServiceMsg({type:gr,dialogType:t,text:e,url:Tr._getPageUrl()},bc.top)},mc.prototype._onHandlerError=function(t,e){pc.sendServiceMsg({type:wr,dialogType:t,message:e,url:Tr._getPageUrl()},bc.top)},mc);function mc(t){return hc.call(this,null,t)||this}var gc,vc=c.eventSandbox.message,wc=(t(yc,gc=lc),yc.prototype._onJsError=function(){},yc.prototype._onConsoleMessage=function(){},yc.prototype._onChildWindowOpened=function(e){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return this.options.nativeAutomation?[4,this._ensureNewWindowOpenedInNativeAutomation(e)]:[3,2];case 1:if(!t.sent())return[2];t.label=2;case 2:return vc.sendServiceMsg(new Vo,bc.top),[2]}})})},yc.prototype._stopInternal=function(){vc.sendServiceMsg(new Xo,bc.top)},yc.prototype._initParentDriverListening=function(){var n=this;c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;_.pageUnloadBarrier.wait(0).then(function(){if(e.type===Hr){if(n.lastParentDriverMessageId===e.id)return;n.lastParentDriverMessageId=e.id,n.readyPromise.then(function(){n.speed=e.testSpeed,n.parentDriverLink.sendConfirmationMessage(e.id),n._onCommand(e.command)})}e.type===Br&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},yc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},yc.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},yc.prototype._isInCommandExecution=function(){return l(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return c.utils.dom.isCrossDomainWindows(bc,bc.parent)?[4,this.parentDriverLink.hasPendingActionFlags()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,this._hasPendingActionFlags(this.contextStorage)]}})})},yc.prototype._init=function(){return l(this,void 0,void 0,function(){var e,n,i;return C(this,function(t){switch(t.label){case 0:return[4,this.parentDriverLink.establishConnection()];case 1:return e=t.sent(),n=e.id,i=e.dispatchNativeAutomationEventUrls,this.contextStorage=new ls(bc,{testRunId:n,windowId:this.windowId,nativeAutomation:this.options.nativeAutomation}),this.communicationUrls.dispatchNativeAutomationEvent=i.single,this.communicationUrls.dispatchNativeAutomationEventSequence=i.sequence,this._failIfClientCodeExecutionIsInterrupted()?[2]:[4,this._isInCommandExecution()];case 2:return t.sent()&&(this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._onReady(new Cs({isCommandResult:!0}))),[2]}})})},yc.prototype.start=function(){this.nativeDialogsTracker=new fc({dialogHandler:this.options.dialogHandler,nativeAutomation:this.options.nativeAutomation}),this.statusBar=new n.IframeStatusBar;var t=this._init();this.readyPromise=c.Promise.all([this.readyPromise,t])},yc);function yc(t,e,n){var i=gc.call(this,t,e,{},n)||this;return i.lastParentDriverMessageId=null,i.parentDriverLink=new cc(bc.parent),i._initParentDriverListening(),i}var _c={NodeSnapshot:Os,ElementSnapshot:Vs,SelectorExecutor:Ra},Ec="%testCafeDriver%",Cc="%testCafeIframeDriver%",Ic="%testCafeEmbeddingUtils%",Sc=s.nativeMethods,Ac=s.EVENTS.evalIframeScript;Sc.objectDefineProperty(bc,Ec,{configurable:!0,value:lc}),Sc.objectDefineProperty(bc,Cc,{configurable:!0,value:wc}),Sc.objectDefineProperty(bc,Ic,{configurable:!0,value:_c}),s.on(Ac,function(t){return Wc(Sc.contentWindowGetter.call(t.iframe))})}(bc["%hammerhead%"],bc["%hammerhead%"].Promise,bc["%testCafeCore%"],bc["%testCafeAutomation%"],bc["%testCafeUI%"])}(window);
|