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