| <!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: lib/input.js</title><!--[if lt IE 9]> |
| <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
| <![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Selenium WebDriver JavaScript API</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome.html">selenium-webdriver/chrome</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium.html">selenium-webdriver/chromium</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge.html">selenium-webdriver/edge</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox.html">selenium-webdriver/firefox</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie.html">selenium-webdriver/ie</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari.html">selenium-webdriver/safari</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Actions.html">Actions</a></div><div class="sidebar-section-children"><a href="Alert.html">Alert</a></div><div class="sidebar-section-children"><a href="AlertPromise.html">AlertPromise</a></div><div class="sidebar-section-children"><a href="ArgumentValue.html">ArgumentValue</a></div><div class="sidebar-section-children"><a href="BaseLogEntry.html">BaseLogEntry</a></div><div class="sidebar-section-children"><a href="BaseParameters.html">BaseParameters</a></div><div class="sidebar-section-children"><a href="BeforeRequestSent.html">BeforeRequestSent</a></div><div class="sidebar-section-children"><a href="BoxClipRectangle.html">BoxClipRectangle</a></div><div class="sidebar-section-children"><a href="global.html#Browser">Browser</a></div><div class="sidebar-section-children"><a href="BrowsingContext.html">BrowsingContext</a></div><div class="sidebar-section-children"><a href="BrowsingContextInfo.html">BrowsingContextInfo</a></div><div class="sidebar-section-children"><a href="BrowsingContextInspector.html">BrowsingContextInspector</a></div><div class="sidebar-section-children"><a href="BrowsingContextPartitionDescriptor.html">BrowsingContextPartitionDescriptor</a></div><div class="sidebar-section-children"><a href="Build.html">Build</a></div><div class="sidebar-section-children"><a href="Builder.html">Builder</a></div><div class="sidebar-section-children"><a href="By.html">By</a></div><div class="sidebar-section-children"><a href="BytesValue.html">BytesValue</a></div><div class="sidebar-section-children"><a href="Capabilities.html">Capabilities</a></div><div class="sidebar-section-children"><a href="CaptureScreenshotParameters.html">CaptureScreenshotParameters</a></div><div class="sidebar-section-children"><a href="ChannelValue.html">ChannelValue</a></div><div class="sidebar-section-children"><a href="ClientWindowInfo.html">ClientWindowInfo</a></div><div class="sidebar-section-children"><a href="ClipRectangle.html">ClipRectangle</a></div><div class="sidebar-section-children"><a href="Command.html">Command</a></div><div class="sidebar-section-children"><a href="Command.html">Command</a></div><div class="sidebar-section-children"><a href="Condition.html">Condition</a></div><div class="sidebar-section-children"><a href="ConsoleLogEntry.html">ConsoleLogEntry</a></div><div class="sidebar-section-children"><a href="ContinueRequestParameters.html">ContinueRequestParameters</a></div><div class="sidebar-section-children"><a href="ContinueResponseParameters.html">ContinueResponseParameters</a></div><div class="sidebar-section-children"><a href="Cookie.html">Cookie</a></div><div class="sidebar-section-children"><a href="CookieFilter.html">CookieFilter</a></div><div class="sidebar-section-children"><a href="CreateContextParameters.html">CreateContextParameters</a></div><div class="sidebar-section-children"><a href="Credential.html">Credential</a></div><div class="sidebar-section-children"><a href="DetachedShadowRootError.html">DetachedShadowRootError</a></div><div class="sidebar-section-children"><a href="Device.html">Device</a></div><div class="sidebar-section-children"><a href="DriverService.html">DriverService</a></div><div class="sidebar-section-children"><a href="DriverService.Builder.html">Builder</a></div><div class="sidebar-section-children"><a href="ElementClickInterceptedError.html">ElementClickInterceptedError</a></div><div class="sidebar-section-children"><a href="ElementClipRectangle.html">ElementClipRectangle</a></div><div class="sidebar-section-children"><a href="ElementNotInteractableError.html">ElementNotInteractableError</a></div><div class="sidebar-section-children"><a href="ElementNotSelectableError.html">ElementNotSelectableError</a></div><div class="sidebar-section-children"><a href="Entry.html">Entry</a></div><div class="sidebar-section-children"><a href="Environment.html">Environment</a></div><div class="sidebar-section-children"><a href="EvaluateResultException.html">EvaluateResultException</a></div><div class="sidebar-section-children"><a href="EvaluateResultSuccess.html">EvaluateResultSuccess</a></div><div class="sidebar-section-children"><a href="ExceptionDetails.html">ExceptionDetails</a></div><div class="sidebar-section-children"><a href="Executor.html">Executor</a></div><div class="sidebar-section-children"><a href="FetchError.html">FetchError</a></div><div class="sidebar-section-children"><a href="FetchTimingInfo.html">FetchTimingInfo</a></div><div class="sidebar-section-children"><a href="FileDetector.html">FileDetector</a></div><div class="sidebar-section-children"><a href="FileDetector.html">FileDetector</a></div><div class="sidebar-section-children"><a href="GenericLogEntry.html">GenericLogEntry</a></div><div class="sidebar-section-children"><a href="Header.html">Header</a></div><div class="sidebar-section-children"><a href="HttpClient.html">HttpClient</a></div><div class="sidebar-section-children"><a href="HttpResponse.html">HttpResponse</a></div><div class="sidebar-section-children"><a href="Index_.html">Index</a></div><div class="sidebar-section-children"><a href="Initiator.html">Initiator</a></div><div class="sidebar-section-children"><a href="Input.html">Input</a></div><div class="sidebar-section-children"><a href="InsecureCertificateError.html">InsecureCertificateError</a></div><div class="sidebar-section-children"><a href="InvalidArgumentError.html">InvalidArgumentError</a></div><div class="sidebar-section-children"><a href="InvalidCharacterError.html">InvalidCharacterError</a></div><div class="sidebar-section-children"><a href="InvalidCookieDomainError.html">InvalidCookieDomainError</a></div><div class="sidebar-section-children"><a href="InvalidCoordinatesError.html">InvalidCoordinatesError</a></div><div class="sidebar-section-children"><a href="InvalidElementStateError.html">InvalidElementStateError</a></div><div class="sidebar-section-children"><a href="InvalidSelectorError.html">InvalidSelectorError</a></div><div class="sidebar-section-children"><a href="JavascriptError.html">JavascriptError</a></div><div class="sidebar-section-children"><a href="JavascriptLogEntry.html">JavascriptLogEntry</a></div><div class="sidebar-section-children"><a href="Keyboard.html">Keyboard</a></div><div class="sidebar-section-children"><a href="Level.html">Level</a></div><div class="sidebar-section-children"><a href="LocalValue.html">LocalValue</a></div><div class="sidebar-section-children"><a href="Locator.html">Locator</a></div><div class="sidebar-section-children"><a href="LogManager.html">LogManager</a></div><div class="sidebar-section-children"><a href="Logger.html">Logger</a></div><div class="sidebar-section-children"><a href="Message.html">Message</a></div><div class="sidebar-section-children"><a href="MoveTargetOutOfBoundsError.html">MoveTargetOutOfBoundsError</a></div><div class="sidebar-section-children"><a href="NavigateResult.html">NavigateResult</a></div><div class="sidebar-section-children"><a href="NavigationInfo.html">NavigationInfo</a></div><div class="sidebar-section-children"><a href="Network.html">Network</a></div><div class="sidebar-section-children"><a href="NetworkInspector.html">NetworkInspector</a></div><div class="sidebar-section-children"><a href="NoSuchAlertError.html">NoSuchAlertError</a></div><div class="sidebar-section-children"><a href="NoSuchCookieError.html">NoSuchCookieError</a></div><div class="sidebar-section-children"><a href="NoSuchElementError.html">NoSuchElementError</a></div><div class="sidebar-section-children"><a href="NoSuchFrameError.html">NoSuchFrameError</a></div><div class="sidebar-section-children"><a href="NoSuchSessionError.html">NoSuchSessionError</a></div><div class="sidebar-section-children"><a href="NoSuchShadowRootError.html">NoSuchShadowRootError</a></div><div class="sidebar-section-children"><a href="NoSuchWindowError.html">NoSuchWindowError</a></div><div class="sidebar-section-children"><a href="PartialCookie.html">PartialCookie</a></div><div class="sidebar-section-children"><a href="PartitionDescriptor.html">PartitionDescriptor</a></div><div class="sidebar-section-children"><a href="PartitionKey.html">PartitionKey</a></div><div class="sidebar-section-children"><a href="Pointer.html">Pointer</a></div><div class="sidebar-section-children"><a href="Preferences.html">Preferences</a></div><div class="sidebar-section-children"><a href="PrintResult.html">PrintResult</a></div><div class="sidebar-section-children"><a href="ProvideResponseParameters.html">ProvideResponseParameters</a></div><div class="sidebar-section-children"><a href="RealmInfo.html">RealmInfo</a></div><div class="sidebar-section-children"><a href="ReferenceValue.html">ReferenceValue</a></div><div class="sidebar-section-children"><a href="RegExpValue.html">RegExpValue</a></div><div class="sidebar-section-children"><a href="RelativeBy.html">RelativeBy</a></div><div class="sidebar-section-children"><a href="RemoteValue.html">RemoteValue</a></div><div class="sidebar-section-children"><a href="Request.html">Request</a></div><div class="sidebar-section-children"><a href="RequestData.html">RequestData</a></div><div class="sidebar-section-children"><a href="Response.html">Response</a></div><div class="sidebar-section-children"><a href="ResponseData.html">ResponseData</a></div><div class="sidebar-section-children"><a href="ResponseStarted.html">ResponseStarted</a></div><div class="sidebar-section-children"><a href="Result.html">Result</a></div><div class="sidebar-section-children"><a href="ScriptManager.html">ScriptManager</a></div><div class="sidebar-section-children"><a href="ScriptTimeoutError.html">ScriptTimeoutError</a></div><div class="sidebar-section-children"><a href="Select.html">Select</a></div><div class="sidebar-section-children"><a href="SeleniumServer.html">SeleniumServer</a></div><div class="sidebar-section-children"><a href="SerializationOptions.html">SerializationOptions</a></div><div class="sidebar-section-children"><a href="Server.html">Server</a></div><div class="sidebar-section-children"><a href="Session.html">Session</a></div><div class="sidebar-section-children"><a href="SessionNotCreatedError.html">SessionNotCreatedError</a></div><div class="sidebar-section-children"><a href="ShadowRoot.html">ShadowRoot</a></div><div class="sidebar-section-children"><a href="ShadowRootPromise.html">ShadowRootPromise</a></div><div class="sidebar-section-children"><a href="Source.html">Source</a></div><div class="sidebar-section-children"><a href="StaleElementReferenceError.html">StaleElementReferenceError</a></div><div class="sidebar-section-children"><a href="Storage.html">Storage</a></div><div class="sidebar-section-children"><a href="StorageKeyPartitionDescriptor.html">StorageKeyPartitionDescriptor</a></div><div class="sidebar-section-children"><a href="TimeoutError.html">TimeoutError</a></div><div class="sidebar-section-children"><a href="UnableToCaptureScreenError.html">UnableToCaptureScreenError</a></div><div class="sidebar-section-children"><a href="UnableToSetCookieError.html">UnableToSetCookieError</a></div><div class="sidebar-section-children"><a href="UnexpectedAlertOpenError.html">UnexpectedAlertOpenError</a></div><div class="sidebar-section-children"><a href="UnknownCommandError.html">UnknownCommandError</a></div><div class="sidebar-section-children"><a href="UnknownMethodError.html">UnknownMethodError</a></div><div class="sidebar-section-children"><a href="UnsupportedOperationError.html">UnsupportedOperationError</a></div><div class="sidebar-section-children"><a href="UrlPattern.html">UrlPattern</a></div><div class="sidebar-section-children"><a href="VirtualAuthenticatorOptions.html">VirtualAuthenticatorOptions</a></div><div class="sidebar-section-children"><a href="WebDriver.html">WebDriver</a></div><div class="sidebar-section-children"><a href="WebDriverError.html">WebDriverError</a></div><div class="sidebar-section-children"><a href="WebElement.html">WebElement</a></div><div class="sidebar-section-children"><a href="WebElementCondition.html">WebElementCondition</a></div><div class="sidebar-section-children"><a href="WebElementPromise.html">WebElementPromise</a></div><div class="sidebar-section-children"><a href="Wheel.html">Wheel</a></div><div class="sidebar-section-children"><a href="WindowRealmInfo.html">WindowRealmInfo</a></div><div class="sidebar-section-children"><a href="Zip.html">Zip</a></div><div class="sidebar-section-children"><a href="createDriver-thenableWebDriverProxy.html">thenableWebDriverProxy</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Extensions.html">Extensions</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-AddonFormatError.html">AddonFormatError</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Channel.html">Channel</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-ServiceBuilder.html">ServiceBuilder</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-interfaces"><div>Interfaces</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Action.html">Action</a></div><div class="sidebar-section-children"><a href="Client.html">Client</a></div><div class="sidebar-section-children"><a href="global.html#Config">Config</a></div><div class="sidebar-section-children"><a href="Executor.html">Executor</a></div><div class="sidebar-section-children"><a href="ISelect.html">ISelect</a></div><div class="sidebar-section-children"><a href="IWebDriver.html">IWebDriver</a></div><div class="sidebar-section-children"><a href="global.html#ManualConfig">ManualConfig</a></div><div class="sidebar-section-children"><a href="Options.html">Options</a></div><div class="sidebar-section-children"><a href="Options.Cookie.html">Cookie</a></div><div class="sidebar-section-children"><a href="global.html#PacConfig">PacConfig</a></div><div class="sidebar-section-children"><a href="SeleniumServer.Options.html">Options</a></div><div class="sidebar-section-children"><a href="ServiceOptions.html">ServiceOptions</a></div><div class="sidebar-section-children"><a href="SuiteOptions.html">SuiteOptions</a></div><div class="sidebar-section-children"><a href="TargetBrowser.html">TargetBrowser</a></div><div class="sidebar-section-children"><a href="ThenableWebDriver.html">ThenableWebDriver</a></div><div class="sidebar-section-children"><a href="Timeouts.html">Timeouts</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#Atom">Atom</a></div><div class="sidebar-section-children"><a href="global.html#Browser">Browser</a></div><div class="sidebar-section-children"><a href="global.html#Button">Button</a></div><div class="sidebar-section-children"><a href="global.html#ByHash">ByHash</a></div><div class="sidebar-section-children"><a href="global.html#Capability">Capability</a></div><div class="sidebar-section-children"><a href="global.html#CommandLineFlag">CommandLineFlag</a></div><div class="sidebar-section-children"><a href="global.html#CommandSpec">CommandSpec</a></div><div class="sidebar-section-children"><a href="global.html#CommandTransformer">CommandTransformer</a></div><div class="sidebar-section-children"><a href="global.html#Config">Config</a></div><div class="sidebar-section-children"><a href="global.html#ErrorCode">ErrorCode</a></div><div class="sidebar-section-children"><a href="global.html#EvaluateResultType">EvaluateResultType</a></div><div class="sidebar-section-children"><a href="global.html#INTERNAL_COMPUTE_OFFSET_SCRIPT">INTERNAL_COMPUTE_OFFSET_SCRIPT</a></div><div class="sidebar-section-children"><a href="global.html#InterceptPhase">InterceptPhase</a></div><div class="sidebar-section-children"><a href="global.html#Key">Key</a></div><div class="sidebar-section-children"><a href="global.html#ManualConfig">ManualConfig</a></div><div class="sidebar-section-children"><a href="global.html#Name">Name</a></div><div class="sidebar-section-children"><a href="global.html#NonPrimitiveType">NonPrimitiveType</a></div><div class="sidebar-section-children"><a href="global.html#Origin">Origin</a></div><div class="sidebar-section-children"><a href="global.html#Origin">Origin</a></div><div class="sidebar-section-children"><a href="global.html#PacConfig">PacConfig</a></div><div class="sidebar-section-children"><a href="global.html#PageLoadStrategy">PageLoadStrategy</a></div><div class="sidebar-section-children"><a href="global.html#Platform">Platform</a></div><div class="sidebar-section-children"><a href="global.html#PrimitiveType">PrimitiveType</a></div><div class="sidebar-section-children"><a href="global.html#Protocol">Protocol</a></div><div class="sidebar-section-children"><a href="global.html#RealmType">RealmType</a></div><div class="sidebar-section-children"><a href="global.html#RemoteReferenceType">RemoteReferenceType</a></div><div class="sidebar-section-children"><a href="global.html#RemoteType">RemoteType</a></div><div class="sidebar-section-children"><a href="global.html#RequestOptions">RequestOptions</a></div><div class="sidebar-section-children"><a href="global.html#ResultOwnership">ResultOwnership</a></div><div class="sidebar-section-children"><a href="global.html#SameSite">SameSite</a></div><div class="sidebar-section-children"><a href="global.html#SpecialNumberType">SpecialNumberType</a></div><div class="sidebar-section-children"><a href="global.html#StdIoOptions">StdIoOptions</a></div><div class="sidebar-section-children"><a href="global.html#THENABLE_DRIVERS">THENABLE_DRIVERS</a></div><div class="sidebar-section-children"><a href="global.html#Transport">Transport</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#USER_AGENT">USER_AGENT</a></div><div class="sidebar-section-children"><a href="global.html#UserPromptHandler">UserPromptHandler</a></div><div class="sidebar-section-children"><a href="global.html#W3C_COMMAND_MAP">W3C_COMMAND_MAP</a></div><div class="sidebar-section-children"><a href="global.html#ableToSwitchToFrame">ableToSwitchToFrame</a></div><div class="sidebar-section-children"><a href="global.html#addConsoleHandler">addConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#alertIsPresent">alertIsPresent</a></div><div class="sidebar-section-children"><a href="global.html#arraysEqual">arraysEqual</a></div><div class="sidebar-section-children"><a href="global.html#binaryPaths">binaryPaths</a></div><div class="sidebar-section-children"><a href="global.html#buildPath">buildPath</a></div><div class="sidebar-section-children"><a href="global.html#buildRequest">buildRequest</a></div><div class="sidebar-section-children"><a href="global.html#builtTargets">builtTargets</a></div><div class="sidebar-section-children"><a href="global.html#check">check</a></div><div class="sidebar-section-children"><a href="global.html#checkCodePoint">checkCodePoint</a></div><div class="sidebar-section-children"><a href="global.html#checkLegacyResponse">checkLegacyResponse</a></div><div class="sidebar-section-children"><a href="global.html#checkOptions">checkOptions</a></div><div class="sidebar-section-children"><a href="global.html#checkedCall">checkedCall</a></div><div class="sidebar-section-children"><a href="global.html#checkedNodeCall">checkedNodeCall</a></div><div class="sidebar-section-children"><a href="global.html#color">color</a></div><div class="sidebar-section-children"><a href="global.html#consoleHandler">consoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#copy">copy</a></div><div class="sidebar-section-children"><a href="global.html#copyDir">copyDir</a></div><div class="sidebar-section-children"><a href="global.html#createDriver">createDriver</a></div><div class="sidebar-section-children"><a href="global.html#delayed">delayed</a></div><div class="sidebar-section-children"><a href="global.html#direct">direct</a></div><div class="sidebar-section-children"><a href="global.html#elementIsDisabled">elementIsDisabled</a></div><div class="sidebar-section-children"><a href="global.html#elementIsEnabled">elementIsEnabled</a></div><div class="sidebar-section-children"><a href="global.html#elementIsNotSelected">elementIsNotSelected</a></div><div class="sidebar-section-children"><a href="global.html#elementIsNotVisible">elementIsNotVisible</a></div><div class="sidebar-section-children"><a href="global.html#elementIsSelected">elementIsSelected</a></div><div class="sidebar-section-children"><a href="global.html#elementIsVisible">elementIsVisible</a></div><div class="sidebar-section-children"><a href="global.html#elementLocated">elementLocated</a></div><div class="sidebar-section-children"><a href="global.html#elementTextContains">elementTextContains</a></div><div class="sidebar-section-children"><a href="global.html#elementTextIs">elementTextIs</a></div><div class="sidebar-section-children"><a href="global.html#elementTextMatches">elementTextMatches</a></div><div class="sidebar-section-children"><a href="global.html#elementsLocated">elementsLocated</a></div><div class="sidebar-section-children"><a href="global.html#encodeError">encodeError</a></div><div class="sidebar-section-children"><a href="global.html#ensureFileDetectorsAreEnabled">ensureFileDetectorsAreEnabled</a></div><div class="sidebar-section-children"><a href="global.html#escapeCss">escapeCss</a></div><div class="sidebar-section-children"><a href="global.html#exec">exec</a></div><div class="sidebar-section-children"><a href="global.html#executeCommand">executeCommand</a></div><div class="sidebar-section-children"><a href="global.html#exists">exists</a></div><div class="sidebar-section-children"><a href="global.html#extractId">extractId</a></div><div class="sidebar-section-children"><a href="global.html#filter">filter</a></div><div class="sidebar-section-children"><a href="global.html#filterNonW3CCaps">filterNonW3CCaps</a></div><div class="sidebar-section-children"><a href="global.html#findFreePort">findFreePort</a></div><div class="sidebar-section-children"><a href="global.html#findInPath">findInPath</a></div><div class="sidebar-section-children"><a href="global.html#formatSpawnArgs">formatSpawnArgs</a></div><div class="sidebar-section-children"><a href="global.html#fromWireValue">fromWireValue</a></div><div class="sidebar-section-children"><a href="global.html#fullyResolveKeys">fullyResolveKeys</a></div><div class="sidebar-section-children"><a href="global.html#fullyResolved">fullyResolved</a></div><div class="sidebar-section-children"><a href="global.html#getAddress">getAddress</a></div><div class="sidebar-section-children"><a href="global.html#getAvailableBrowsers">getAvailableBrowsers</a></div><div class="sidebar-section-children"><a href="global.html#getBinary">getBinary</a></div><div class="sidebar-section-children"><a href="global.html#getBinaryPaths">getBinaryPaths</a></div><div class="sidebar-section-children"><a href="global.html#getBrowsersToTestFromEnv">getBrowsersToTestFromEnv</a></div><div class="sidebar-section-children"><a href="global.html#getBrowsingContextInstance">getBrowsingContextInstance</a></div><div class="sidebar-section-children"><a href="global.html#getIPAddress">getIPAddress</a></div><div class="sidebar-section-children"><a href="global.html#getJavaPath">getJavaPath</a></div><div class="sidebar-section-children"><a href="global.html#getLevel">getLevel</a></div><div class="sidebar-section-children"><a href="global.html#getLogInspectorInstance">getLogInspectorInstance</a></div><div class="sidebar-section-children"><a href="global.html#getLogger">getLogger</a></div><div class="sidebar-section-children"><a href="global.html#getLoopbackAddress">getLoopbackAddress</a></div><div class="sidebar-section-children"><a href="global.html#getRequestOptions">getRequestOptions</a></div><div class="sidebar-section-children"><a href="global.html#getStatus">getStatus</a></div><div class="sidebar-section-children"><a href="global.html#getTestHook">getTestHook</a></div><div class="sidebar-section-children"><a href="global.html#headersToString">headersToString</a></div><div class="sidebar-section-children"><a href="global.html#ignore">ignore</a></div><div class="sidebar-section-children"><a href="global.html#init">init</a></div><div class="sidebar-section-children"><a href="global.html#installConsoleHandler">installConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#isErrorResponse">isErrorResponse</a></div><div class="sidebar-section-children"><a href="global.html#isFree">isFree</a></div><div class="sidebar-section-children"><a href="global.html#isId">isId</a></div><div class="sidebar-section-children"><a href="global.html#isIdle">isIdle</a></div><div class="sidebar-section-children"><a href="global.html#isObject">isObject</a></div><div class="sidebar-section-children"><a href="global.html#isPromise">isPromise</a></div><div class="sidebar-section-children"><a href="global.html#isRetryableNetworkError">isRetryableNetworkError</a></div><div class="sidebar-section-children"><a href="global.html#isSelenium3x">isSelenium3x</a></div><div class="sidebar-section-children"><a href="global.html#legacyTimeout">legacyTimeout</a></div><div class="sidebar-section-children"><a href="global.html#load">load</a></div><div class="sidebar-section-children"><a href="global.html#locate">locate</a></div><div class="sidebar-section-children"><a href="global.html#locateWith">locateWith</a></div><div class="sidebar-section-children"><a href="global.html#manual">manual</a></div><div class="sidebar-section-children"><a href="global.html#map">map</a></div><div class="sidebar-section-children"><a href="global.html#mkdir">mkdir</a></div><div class="sidebar-section-children"><a href="global.html#mkdirp">mkdirp</a></div><div class="sidebar-section-children"><a href="global.html#of">of</a></div><div class="sidebar-section-children"><a href="global.html#pac">pac</a></div><div class="sidebar-section-children"><a href="global.html#pad">pad</a></div><div class="sidebar-section-children"><a href="global.html#parseHttpResponse">parseHttpResponse</a></div><div class="sidebar-section-children"><a href="global.html#path">path</a></div><div class="sidebar-section-children"><a href="global.html#projectRoot">projectRoot</a></div><div class="sidebar-section-children"><a href="global.html#read">read</a></div><div class="sidebar-section-children"><a href="global.html#removeConsoleHandler">removeConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#requireAtom">requireAtom</a></div><div class="sidebar-section-children"><a href="global.html#resolveCommandLineFlags">resolveCommandLineFlags</a></div><div class="sidebar-section-children"><a href="global.html#resolveWaitMessage">resolveWaitMessage</a></div><div class="sidebar-section-children"><a href="global.html#rmDir">rmDir</a></div><div class="sidebar-section-children"><a href="global.html#sendIndex">sendIndex</a></div><div class="sidebar-section-children"><a href="global.html#sendRequest">sendRequest</a></div><div class="sidebar-section-children"><a href="global.html#serialize">serialize</a></div><div class="sidebar-section-children"><a href="global.html#setFileDetector">setFileDetector</a></div><div class="sidebar-section-children"><a href="global.html#shouldRetryRequest">shouldRetryRequest</a></div><div class="sidebar-section-children"><a href="global.html#socks">socks</a></div><div class="sidebar-section-children"><a href="global.html#splitHostAndPort">splitHostAndPort</a></div><div class="sidebar-section-children"><a href="global.html#stalenessOf">stalenessOf</a></div><div class="sidebar-section-children"><a href="global.html#start">start</a></div><div class="sidebar-section-children"><a href="global.html#startSeleniumServer">startSeleniumServer</a></div><div class="sidebar-section-children"><a href="global.html#stat">stat</a></div><div class="sidebar-section-children"><a href="global.html#stop">stop</a></div><div class="sidebar-section-children"><a href="global.html#suite">suite</a></div><div class="sidebar-section-children"><a href="global.html#suite">suite</a></div><div class="sidebar-section-children"><a href="global.html#system">system</a></div><div class="sidebar-section-children"><a href="global.html#thenFinally">thenFinally</a></div><div class="sidebar-section-children"><a href="global.html#throwDecodedError">throwDecodedError</a></div><div class="sidebar-section-children"><a href="global.html#titleContains">titleContains</a></div><div class="sidebar-section-children"><a href="global.html#titleIs">titleIs</a></div><div class="sidebar-section-children"><a href="global.html#titleMatches">titleMatches</a></div><div class="sidebar-section-children"><a href="global.html#tmpDir">tmpDir</a></div><div class="sidebar-section-children"><a href="global.html#tmpFile">tmpFile</a></div><div class="sidebar-section-children"><a href="global.html#toExecuteAtomCommand">toExecuteAtomCommand</a></div><div class="sidebar-section-children"><a href="global.html#toMap">toMap</a></div><div class="sidebar-section-children"><a href="global.html#toWireValue">toWireValue</a></div><div class="sidebar-section-children"><a href="global.html#tryParse">tryParse</a></div><div class="sidebar-section-children"><a href="global.html#unlink">unlink</a></div><div class="sidebar-section-children"><a href="global.html#unzip">unzip</a></div><div class="sidebar-section-children"><a href="global.html#url">url</a></div><div class="sidebar-section-children"><a href="global.html#urlContains">urlContains</a></div><div class="sidebar-section-children"><a href="global.html#urlIs">urlIs</a></div><div class="sidebar-section-children"><a href="global.html#urlMatches">urlMatches</a></div><div class="sidebar-section-children"><a href="global.html#waitForServer">waitForServer</a></div><div class="sidebar-section-children"><a href="global.html#waitForUrl">waitForUrl</a></div><div class="sidebar-section-children"><a href="global.html#walkDir">walkDir</a></div><div class="sidebar-section-children"><a href="global.html#whereIs">whereIs</a></div><div class="sidebar-section-children"><a href="global.html#withTagName">withTagName</a></div><div class="sidebar-section-children"><a href="global.html#write">write</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"><div class="navbar-item"><a id="github" href="https://github.com/SeleniumHQ/selenium" target="">GitHub</a></div><div class="navbar-item"><a id="npm" href="https://www.npmjs.com/package/selenium-webdriver" target="">npm</a></div></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">lib_input.js</h1></header><article><pre class="prettyprint source lang-js"><code>// Licensed to the Software Freedom Conservancy (SFC) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The SFC licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| 'use strict' |
| |
| /** |
| * @fileoverview Defines types related to user input with the WebDriver API. |
| */ |
| const { Command, Name } = require('./command') |
| const { InvalidArgumentError } = require('./error') |
| |
| /** |
| * Enumeration of the buttons used in the advanced interactions API. |
| * @enum {number} |
| */ |
| const Button = { |
| LEFT: 0, |
| MIDDLE: 1, |
| RIGHT: 2, |
| BACK: 3, |
| FORWARD: 4, |
| } |
| |
| /** |
| * Representations of pressable keys that aren't text. These are stored in |
| * the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to |
| * http://www.google.com.au/search?&q=unicode+pua&btnK=Search |
| * |
| * @enum {string} |
| * @see <https://www.w3.org/TR/webdriver/#keyboard-actions> |
| */ |
| const Key = { |
| NULL: '\uE000', |
| CANCEL: '\uE001', // ^break |
| HELP: '\uE002', |
| BACK_SPACE: '\uE003', |
| TAB: '\uE004', |
| CLEAR: '\uE005', |
| RETURN: '\uE006', |
| ENTER: '\uE007', |
| SHIFT: '\uE008', |
| CONTROL: '\uE009', |
| ALT: '\uE00A', |
| PAUSE: '\uE00B', |
| ESCAPE: '\uE00C', |
| SPACE: '\uE00D', |
| PAGE_UP: '\uE00E', |
| PAGE_DOWN: '\uE00F', |
| END: '\uE010', |
| HOME: '\uE011', |
| ARROW_LEFT: '\uE012', |
| LEFT: '\uE012', |
| ARROW_UP: '\uE013', |
| UP: '\uE013', |
| ARROW_RIGHT: '\uE014', |
| RIGHT: '\uE014', |
| ARROW_DOWN: '\uE015', |
| DOWN: '\uE015', |
| INSERT: '\uE016', |
| DELETE: '\uE017', |
| SEMICOLON: '\uE018', |
| EQUALS: '\uE019', |
| |
| NUMPAD0: '\uE01A', // number pad keys |
| NUMPAD1: '\uE01B', |
| NUMPAD2: '\uE01C', |
| NUMPAD3: '\uE01D', |
| NUMPAD4: '\uE01E', |
| NUMPAD5: '\uE01F', |
| NUMPAD6: '\uE020', |
| NUMPAD7: '\uE021', |
| NUMPAD8: '\uE022', |
| NUMPAD9: '\uE023', |
| MULTIPLY: '\uE024', |
| ADD: '\uE025', |
| SEPARATOR: '\uE026', |
| SUBTRACT: '\uE027', |
| DECIMAL: '\uE028', |
| DIVIDE: '\uE029', |
| |
| F1: '\uE031', // function keys |
| F2: '\uE032', |
| F3: '\uE033', |
| F4: '\uE034', |
| F5: '\uE035', |
| F6: '\uE036', |
| F7: '\uE037', |
| F8: '\uE038', |
| F9: '\uE039', |
| F10: '\uE03A', |
| F11: '\uE03B', |
| F12: '\uE03C', |
| |
| COMMAND: '\uE03D', // Apple command key |
| META: '\uE03D', // alias for Windows key |
| |
| /** |
| * Japanese modifier key for switching between full- and half-width |
| * characters. |
| * @see <https://en.wikipedia.org/wiki/Language_input_keys> |
| */ |
| ZENKAKU_HANKAKU: '\uE040', |
| } |
| |
| /** |
| * Simulate pressing many keys at once in a "chord". Takes a sequence of |
| * {@linkplain Key keys} or strings, appends each of the values to a string, |
| * adds the chord termination key ({@link Key.NULL}) and returns the resulting |
| * string. |
| * |
| * Note: when the low-level webdriver key handlers see Keys.NULL, active |
| * modifier keys (CTRL/ALT/SHIFT/etc) release via a keyup event. |
| * |
| * @param {...string} keys The key sequence to concatenate. |
| * @return {string} The null-terminated key sequence. |
| */ |
| Key.chord = function (...keys) { |
| return keys.join('') + Key.NULL |
| } |
| |
| /** |
| * Used with {@link ./webelement.WebElement#sendKeys WebElement#sendKeys} on |
| * file input elements (`<input type="file">`) to detect when the entered key |
| * sequence defines the path to a file. |
| * |
| * By default, {@linkplain ./webelement.WebElement WebElement's} will enter all |
| * key sequences exactly as entered. You may set a |
| * {@linkplain ./webdriver.WebDriver#setFileDetector file detector} on the |
| * parent WebDriver instance to define custom behavior for handling file |
| * elements. Of particular note is the |
| * {@link selenium-webdriver/remote.FileDetector}, which should be used when |
| * running against a remote |
| * [Selenium Server](https://selenium.dev/downloads/). |
| */ |
| class FileDetector { |
| /** |
| * Handles the file specified by the given path, preparing it for use with |
| * the current browser. If the path does not refer to a valid file, it will |
| * be returned unchanged, otherwise a path suitable for use with the current |
| * browser will be returned. |
| * |
| * This default implementation is a no-op. Subtypes may override this function |
| * for custom tailored file handling. |
| * |
| * @param {!./webdriver.WebDriver} driver The driver for the current browser. |
| * @param {string} path The path to process. |
| * @return {!Promise<string>} A promise for the processed file path. |
| * @package |
| */ |
| handleFile(_driver, path) { |
| return Promise.resolve(path) |
| } |
| } |
| |
| /** |
| * Generic description of a single action to send to the remote end. |
| * |
| * @record |
| * @package |
| */ |
| class Action { |
| constructor() { |
| /** @type {!Action.Type} */ |
| this.type |
| /** @type {(number|undefined)} */ |
| this.duration |
| /** @type {(string|undefined)} */ |
| this.value |
| /** @type {(Button|undefined)} */ |
| this.button |
| /** @type {(number|undefined)} */ |
| this.x |
| /** @type {(number|undefined)} */ |
| this.y |
| } |
| } |
| |
| /** |
| * @enum {string} |
| * @package |
| * @see <https://w3c.github.io/webdriver/webdriver-spec.html#terminology-0> |
| */ |
| Action.Type = { |
| KEY_DOWN: 'keyDown', |
| KEY_UP: 'keyUp', |
| PAUSE: 'pause', |
| POINTER_DOWN: 'pointerDown', |
| POINTER_UP: 'pointerUp', |
| POINTER_MOVE: 'pointerMove', |
| POINTER_CANCEL: 'pointerCancel', |
| SCROLL: 'scroll', |
| } |
| |
| /** |
| * Represents a user input device. |
| * |
| * @abstract |
| */ |
| class Device { |
| /** |
| * @param {Device.Type} type the input type. |
| * @param {string} id a unique ID for this device. |
| */ |
| constructor(type, id) { |
| /** @private @const */ this.type_ = type |
| /** @private @const */ this.id_ = id |
| } |
| |
| /** @return {!Object} the JSON encoding for this device. */ |
| toJSON() { |
| return { type: this.type_, id: this.id_ } |
| } |
| } |
| |
| /** |
| * Device types supported by the WebDriver protocol. |
| * |
| * @enum {string} |
| * @see <https://w3c.github.io/webdriver/webdriver-spec.html#input-source-state> |
| */ |
| Device.Type = { |
| KEY: 'key', |
| NONE: 'none', |
| POINTER: 'pointer', |
| WHEEL: 'wheel', |
| } |
| |
| /** |
| * @param {(string|Key|number)} key |
| * @return {string} |
| * @throws {!(InvalidArgumentError|RangeError)} |
| */ |
| function checkCodePoint(key) { |
| if (typeof key === 'number') { |
| return String.fromCodePoint(key) |
| } |
| |
| if (typeof key !== 'string') { |
| throw new InvalidArgumentError(`key is not a string: ${key}`) |
| } |
| |
| key = key.normalize() |
| if (Array.from(key).length !== 1) { |
| throw new InvalidArgumentError(`key input is not a single code point: ${key}`) |
| } |
| return key |
| } |
| |
| /** |
| * Keyboard input device. |
| * |
| * @final |
| * @see <https://www.w3.org/TR/webdriver/#dfn-key-input-source> |
| */ |
| class Keyboard extends Device { |
| /** @param {string} id the device ID. */ |
| constructor(id) { |
| super(Device.Type.KEY, id) |
| } |
| |
| /** |
| * Generates a key down action. |
| * |
| * @param {(Key|string|number)} key the key to press. This key may be |
| * specified as a {@link Key} value, a specific unicode code point, |
| * or a string containing a single unicode code point. |
| * @return {!Action} a new key down action. |
| * @package |
| */ |
| keyDown(key) { |
| return { type: Action.Type.KEY_DOWN, value: checkCodePoint(key) } |
| } |
| |
| /** |
| * Generates a key up action. |
| * |
| * @param {(Key|string|number)} key the key to press. This key may be |
| * specified as a {@link Key} value, a specific unicode code point, |
| * or a string containing a single unicode code point. |
| * @return {!Action} a new key up action. |
| * @package |
| */ |
| keyUp(key) { |
| return { type: Action.Type.KEY_UP, value: checkCodePoint(key) } |
| } |
| } |
| |
| /** |
| * Defines the reference point from which to compute offsets for |
| * {@linkplain ./input.Pointer#move pointer move} actions. |
| * |
| * @enum {string} |
| */ |
| const Origin = { |
| /** Compute offsets relative to the pointer's current position. */ |
| POINTER: 'pointer', |
| /** Compute offsets relative to the viewport. */ |
| VIEWPORT: 'viewport', |
| } |
| |
| /** |
| * Pointer input device. |
| * |
| * @final |
| * @see <https://www.w3.org/TR/webdriver/#dfn-pointer-input-source> |
| */ |
| class Pointer extends Device { |
| /** |
| * @param {string} id the device ID. |
| * @param {Pointer.Type} type the pointer type. |
| */ |
| constructor(id, type) { |
| super(Device.Type.POINTER, id) |
| /** @private @const */ this.pointerType_ = type |
| } |
| |
| /** @override */ |
| toJSON() { |
| return Object.assign({ parameters: { pointerType: this.pointerType_ } }, super.toJSON()) |
| } |
| |
| /** |
| * @return {!Action} An action that cancels this pointer's current input. |
| * @package |
| */ |
| cancel() { |
| return { type: Action.Type.POINTER_CANCEL } |
| } |
| |
| /** |
| * @param {!Button=} button The button to press. |
| * @param width |
| * @param height |
| * @param pressure |
| * @param tangentialPressure |
| * @param tiltX |
| * @param tiltY |
| * @param twist |
| * @param altitudeAngle |
| * @param azimuthAngle |
| * @return {!Action} An action to press the specified button with this device. |
| * @package |
| */ |
| press( |
| button = Button.LEFT, |
| width = 0, |
| height = 0, |
| pressure = 0, |
| tangentialPressure = 0, |
| tiltX = 0, |
| tiltY = 0, |
| twist = 0, |
| altitudeAngle = 0, |
| azimuthAngle = 0, |
| ) { |
| return { |
| type: Action.Type.POINTER_DOWN, |
| button, |
| width, |
| height, |
| pressure, |
| tangentialPressure, |
| tiltX, |
| tiltY, |
| twist, |
| altitudeAngle, |
| azimuthAngle, |
| } |
| } |
| |
| /** |
| * @param {!Button=} button The button to release. |
| * @return {!Action} An action to release the specified button with this |
| * device. |
| * @package |
| */ |
| release(button = Button.LEFT) { |
| return { type: Action.Type.POINTER_UP, button } |
| } |
| |
| /** |
| * Creates an action for moving the pointer `x` and `y` pixels from the |
| * specified `origin`. The `origin` may be defined as the pointer's |
| * {@linkplain Origin.POINTER current position}, the |
| * {@linkplain Origin.VIEWPORT viewport}, or the center of a specific |
| * {@linkplain ./webdriver.WebElement WebElement}. |
| * |
| * @param {{ |
| * x: (number|undefined), |
| * y: (number|undefined), |
| * duration: (number|undefined), |
| * origin: (!Origin|!./webdriver.WebElement|undefined), |
| * }=} options the move options. |
| * @return {!Action} The new action. |
| * @package |
| */ |
| move({ |
| x = 0, |
| y = 0, |
| duration = 100, |
| origin = Origin.VIEWPORT, |
| width = 0, |
| height = 0, |
| pressure = 0, |
| tangentialPressure = 0, |
| tiltX = 0, |
| tiltY = 0, |
| twist = 0, |
| altitudeAngle = 0, |
| azimuthAngle = 0, |
| }) { |
| return { |
| type: Action.Type.POINTER_MOVE, |
| origin, |
| duration, |
| x, |
| y, |
| width, |
| height, |
| pressure, |
| tangentialPressure, |
| tiltX, |
| tiltY, |
| twist, |
| altitudeAngle, |
| azimuthAngle, |
| } |
| } |
| } |
| |
| /** |
| * The supported types of pointers. |
| * @enum {string} |
| */ |
| Pointer.Type = { |
| MOUSE: 'mouse', |
| PEN: 'pen', |
| TOUCH: 'touch', |
| } |
| |
| class Wheel extends Device { |
| /** |
| * @param {string} id the device ID.. |
| */ |
| constructor(id) { |
| super(Device.Type.WHEEL, id) |
| } |
| |
| /** |
| * Scrolls a page via the coordinates given |
| * @param {number} x starting x coordinate |
| * @param {number} y starting y coordinate |
| * @param {number} deltaX Delta X to scroll to target |
| * @param {number} deltaY Delta Y to scroll to target |
| * @param {WebElement} origin element origin |
| * @param {number} duration duration ratio be the ratio of time delta and duration |
| * @returns {!Action} An action to scroll with this device. |
| */ |
| scroll(x, y, deltaX, deltaY, origin, duration) { |
| return { |
| type: Action.Type.SCROLL, |
| duration: duration, |
| x: x, |
| y: y, |
| deltaX: deltaX, |
| deltaY: deltaY, |
| origin: origin, |
| } |
| } |
| } |
| |
| /** |
| * User facing API for generating complex user gestures. This class should not |
| * be instantiated directly. Instead, users should create new instances by |
| * calling {@link ./webdriver.WebDriver#actions WebDriver.actions()}. |
| * |
| * ### Action Ticks |
| * |
| * Action sequences are divided into a series of "ticks". At each tick, the |
| * WebDriver remote end will perform a single action for each device included |
| * in the action sequence. At tick 0, the driver will perform the first action |
| * defined for each device, at tick 1 the second action for each device, and |
| * so on until all actions have been executed. If an individual device does |
| * not have an action defined at a particular tick, it will automatically |
| * pause. |
| * |
| * By default, action sequences will be synchronized so only one device has a |
| * define action in each tick. Consider the following code sample: |
| * |
| * const actions = driver.actions(); |
| * |
| * await actions |
| * .keyDown(SHIFT) |
| * .move({origin: el}) |
| * .press() |
| * .release() |
| * .keyUp(SHIFT) |
| * .perform(); |
| * |
| * This sample produces the following sequence of ticks: |
| * |
| * | Device | Tick 1 | Tick 2 | Tick 3 | Tick 4 | Tick 5 | |
| * | -------- | -------------- | ------------------ | ------- | --------- | ------------ | |
| * | Keyboard | keyDown(SHIFT) | pause() | pause() | pause() | keyUp(SHIFT) | |
| * | Mouse | pause() | move({origin: el}) | press() | release() | pause() | |
| * |
| * If you'd like the remote end to execute actions with multiple devices |
| * simultaneously, you may pass `{async: true}` when creating the actions |
| * builder. With synchronization disabled (`{async: true}`), the ticks from our |
| * previous example become: |
| * |
| * | Device | Tick 1 | Tick 2 | Tick 3 | |
| * | -------- | ------------------ | ------------ | --------- | |
| * | Keyboard | keyDown(SHIFT) | keyUp(SHIFT) | | |
| * | Mouse | move({origin: el}) | press() | release() | |
| * |
| * When synchronization is disabled, it is your responsibility to insert |
| * {@linkplain #pause() pauses} for each device, as needed: |
| * |
| * const actions = driver.actions({async: true}); |
| * const kb = actions.keyboard(); |
| * const mouse = actions.mouse(); |
| * |
| * actions.keyDown(SHIFT).pause(kb).pause(kb).key(SHIFT); |
| * actions.pause(mouse).move({origin: el}).press().release(); |
| * actions.perform(); |
| * |
| * With pauses insert for individual devices, we're back to: |
| * |
| * | Device | Tick 1 | Tick 2 | Tick 3 | Tick 4 | |
| * | -------- | -------------- | ------------------ | ------- | ------------ | |
| * | Keyboard | keyDown(SHIFT) | pause() | pause() | keyUp(SHIFT) | |
| * | Mouse | pause() | move({origin: el}) | press() | release() | |
| * |
| * #### Tick Durations |
| * |
| * The length of each action tick is however long it takes the remote end to |
| * execute the actions for every device in that tick. Most actions are |
| * "instantaneous", however, {@linkplain #pause pause} and |
| * {@linkplain #move pointer move} actions allow you to specify a duration for |
| * how long that action should take. The remote end will always wait for all |
| * actions within a tick to finish before starting the next tick, so a device |
| * may implicitly pause while waiting for other devices to finish. |
| * |
| * | Device | Tick 1 | Tick 2 | |
| * | --------- | --------------------- | ------- | |
| * | Pointer 1 | move({duration: 200}) | press() | |
| * | Pointer 2 | move({duration: 300}) | press() | |
| * |
| * In table above, the move for Pointer 1 should only take 200 ms, but the |
| * remote end will wait for the move for Pointer 2 to finish |
| * (an additional 100 ms) before proceeding to Tick 2. |
| * |
| * This implicit waiting also applies to pauses. In the table below, even though |
| * the keyboard only defines a pause of 100 ms, the remote end will wait an |
| * additional 200 ms for the mouse move to finish before moving to Tick 2. |
| * |
| * | Device | Tick 1 | Tick 2 | |
| * | -------- | --------------------- | -------------- | |
| * | Keyboard | pause(100) | keyDown(SHIFT) | |
| * | Mouse | move({duration: 300}) | | |
| * |
| * [client rect]: https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects |
| * [bounding client rect]: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect |
| * |
| * @final |
| * @see <https://www.w3.org/TR/webdriver/#actions> |
| */ |
| class Actions { |
| /** |
| * @param {!Executor} executor The object to execute the configured |
| * actions with. |
| * @param {{async: (boolean|undefined)}} options Options for this action |
| * sequence (see class description for details). |
| */ |
| constructor(executor, { async = false } = {}) { |
| /** @private @const */ |
| this.executor_ = executor |
| |
| /** @private @const */ |
| this.sync_ = !async |
| |
| /** @private @const */ |
| this.keyboard_ = new Keyboard('default keyboard') |
| |
| /** @private @const */ |
| this.mouse_ = new Pointer('default mouse', Pointer.Type.MOUSE) |
| |
| /** @private @const */ |
| this.wheel_ = new Wheel('default wheel') |
| |
| /** @private @const {!Map<!Device, !Array<!Action>>} */ |
| this.sequences_ = new Map([ |
| [this.keyboard_, []], |
| [this.mouse_, []], |
| [this.wheel_, []], |
| ]) |
| } |
| |
| /** @return {!Keyboard} the keyboard device handle. */ |
| keyboard() { |
| return this.keyboard_ |
| } |
| |
| /** @return {!Pointer} the mouse pointer device handle. */ |
| mouse() { |
| return this.mouse_ |
| } |
| |
| /** @return {!Wheel} the wheel device handle. */ |
| wheel() { |
| return this.wheel_ |
| } |
| |
| /** |
| * @param {!Device} device |
| * @return {!Array<!Action>} |
| * @private |
| */ |
| sequence_(device) { |
| let sequence = this.sequences_.get(device) |
| if (!sequence) { |
| sequence = [] |
| this.sequences_.set(device, sequence) |
| } |
| return sequence |
| } |
| |
| /** |
| * Appends `actions` to the end of the current sequence for the given |
| * `device`. If device synchronization is enabled, after inserting the |
| * actions, pauses will be inserted for all other devices to ensure all action |
| * sequences are the same length. |
| * |
| * @param {!Device} device the device to update. |
| * @param {...!Action} actions the actions to insert. |
| * @return {!Actions} a self reference. |
| */ |
| insert(device, ...actions) { |
| this.sequence_(device).push(...actions) |
| return this.sync_ ? this.synchronize() : this |
| } |
| |
| /** |
| * Ensures the action sequence for every device referenced in this action |
| * sequence is the same length. For devices whose sequence is too short, |
| * this will insert {@linkplain #pause pauses} so that every device has an |
| * explicit action defined at each tick. |
| * |
| * @param {...!Device} devices The specific devices to synchronize. |
| * If unspecified, the action sequences for every device will be |
| * synchronized. |
| * @return {!Actions} a self reference. |
| */ |
| synchronize(...devices) { |
| let sequences |
| let max = 0 |
| if (devices.length === 0) { |
| for (const s of this.sequences_.values()) { |
| max = Math.max(max, s.length) |
| } |
| sequences = this.sequences_.values() |
| } else { |
| sequences = [] |
| for (const device of devices) { |
| const seq = this.sequence_(device) |
| max = Math.max(max, seq.length) |
| sequences.push(seq) |
| } |
| } |
| |
| const pause = { type: Action.Type.PAUSE, duration: 0 } |
| for (const seq of sequences) { |
| while (seq.length < max) { |
| seq.push(pause) |
| } |
| } |
| |
| return this |
| } |
| |
| /** |
| * Inserts a pause action for the specified devices, ensuring each device is |
| * idle for a tick. The length of the pause (in milliseconds) may be specified |
| * as the first parameter to this method (defaults to 0). Otherwise, you may |
| * just specify the individual devices that should pause. |
| * |
| * If no devices are specified, a pause action will be created (using the same |
| * duration) for every device. |
| * |
| * When device synchronization is enabled (the default for new {@link Actions} |
| * objects), there is no need to specify devices as pausing one automatically |
| * pauses the others for the same duration. In other words, the following are |
| * all equivalent: |
| * |
| * let a1 = driver.actions(); |
| * a1.pause(100).perform(); |
| * |
| * let a2 = driver.actions(); |
| * a2.pause(100, a2.keyboard()).perform(); |
| * // Synchronization ensures a2.mouse() is automatically paused too. |
| * |
| * let a3 = driver.actions(); |
| * a3.pause(100, a3.keyboard(), a3.mouse()).perform(); |
| * |
| * When device synchronization is _disabled_, you can cause individual devices |
| * to pause during a tick. For example, to hold the SHIFT key down while |
| * moving the mouse: |
| * |
| * let actions = driver.actions({async: true}); |
| * |
| * actions.keyDown(Key.SHIFT); |
| * actions.pause(actions.mouse()) // Pause for shift down |
| * .press(Button.LEFT) |
| * .move({x: 10, y: 10}) |
| * .release(Button.LEFT); |
| * actions |
| * .pause( |
| * actions.keyboard(), // Pause for press left |
| * actions.keyboard(), // Pause for move |
| * actions.keyboard()) // Pause for release left |
| * .keyUp(Key.SHIFT); |
| * await actions.perform(); |
| * |
| * @param {(number|!Device)=} duration The length of the pause to insert, in |
| * milliseconds. Alternatively, the duration may be omitted (yielding a |
| * default 0 ms pause), and the first device to pause may be specified. |
| * @param {...!Device} devices The devices to insert the pause for. If no |
| * devices are specified, the pause will be inserted for _all_ devices. |
| * @return {!Actions} a self reference. |
| */ |
| pause(duration, ...devices) { |
| if (duration instanceof Device) { |
| devices.push(duration) |
| duration = 0 |
| } else if (!duration) { |
| duration = 0 |
| } |
| |
| const action = { type: Action.Type.PAUSE, duration } |
| |
| // NB: need a properly typed variable for type checking. |
| /** @type {!Iterable<!Device>} */ |
| const iterable = devices.length === 0 ? this.sequences_.keys() : devices |
| for (const device of iterable) { |
| this.sequence_(device).push(action) |
| } |
| return this.sync_ ? this.synchronize() : this |
| } |
| |
| /** |
| * Inserts an action to press a single key. |
| * |
| * @param {(Key|string|number)} key the key to press. This key may be |
| * specified as a {@link Key} value, a specific unicode code point, |
| * or a string containing a single unicode code point. |
| * @return {!Actions} a self reference. |
| */ |
| keyDown(key) { |
| return this.insert(this.keyboard_, this.keyboard_.keyDown(key)) |
| } |
| |
| /** |
| * Inserts an action to release a single key. |
| * |
| * @param {(Key|string|number)} key the key to release. This key may be |
| * specified as a {@link Key} value, a specific unicode code point, |
| * or a string containing a single unicode code point. |
| * @return {!Actions} a self reference. |
| */ |
| keyUp(key) { |
| return this.insert(this.keyboard_, this.keyboard_.keyUp(key)) |
| } |
| |
| /** |
| * Inserts a sequence of actions to type the provided key sequence. |
| * For each key, this will record a pair of {@linkplain #keyDown keyDown} |
| * and {@linkplain #keyUp keyUp} actions. An implication of this pairing |
| * is that modifier keys (e.g. {@link ./input.Key.SHIFT Key.SHIFT}) will |
| * always be immediately released. In other words, `sendKeys(Key.SHIFT, 'a')` |
| * is the same as typing `sendKeys('a')`, _not_ `sendKeys('A')`. |
| * |
| * @param {...(Key|string|number)} keys the keys to type. |
| * @return {!Actions} a self reference. |
| */ |
| sendKeys(...keys) { |
| const { WebElement } = require('./webdriver') |
| |
| const actions = [] |
| if (keys.length > 1 && keys[0] instanceof WebElement) { |
| this.click(keys[0]) |
| keys.shift() |
| } |
| for (const key of keys) { |
| if (typeof key === 'string') { |
| for (const symbol of key) { |
| actions.push(this.keyboard_.keyDown(symbol), this.keyboard_.keyUp(symbol)) |
| } |
| } else { |
| actions.push(this.keyboard_.keyDown(key), this.keyboard_.keyUp(key)) |
| } |
| } |
| return this.insert(this.keyboard_, ...actions) |
| } |
| |
| /** |
| * Inserts an action to press a mouse button at the mouse's current location. |
| * |
| * @param {!Button=} button The button to press; defaults to `LEFT`. |
| * @return {!Actions} a self reference. |
| */ |
| press(button = Button.LEFT) { |
| return this.insert(this.mouse_, this.mouse_.press(button)) |
| } |
| |
| /** |
| * Inserts an action to release a mouse button at the mouse's current |
| * location. |
| * |
| * @param {!Button=} button The button to release; defaults to `LEFT`. |
| * @return {!Actions} a self reference. |
| */ |
| release(button = Button.LEFT) { |
| return this.insert(this.mouse_, this.mouse_.release(button)) |
| } |
| |
| /** |
| * scrolls a page via the coordinates given |
| * @param {number} x starting x coordinate |
| * @param {number} y starting y coordinate |
| * @param {number} deltax delta x to scroll to target |
| * @param {number} deltay delta y to scroll to target |
| * @param {number} duration duration ratio be the ratio of time delta and duration |
| * @returns {!Actions} An action to scroll with this device. |
| */ |
| scroll(x, y, targetDeltaX, targetDeltaY, origin, duration) { |
| return this.insert(this.wheel_, this.wheel_.scroll(x, y, targetDeltaX, targetDeltaY, origin, duration)) |
| } |
| |
| /** |
| * Inserts an action for moving the mouse `x` and `y` pixels relative to the |
| * specified `origin`. The `origin` may be defined as the mouse's |
| * {@linkplain ./input.Origin.POINTER current position}, the top-left corner of the |
| * {@linkplain ./input.Origin.VIEWPORT viewport}, or the center of a specific |
| * {@linkplain ./webdriver.WebElement WebElement}. Default is top left corner of the view-port if origin is not specified |
| * |
| * You may adjust how long the remote end should take, in milliseconds, to |
| * perform the move using the `duration` parameter (defaults to 100 ms). |
| * The number of incremental move events generated over this duration is an |
| * implementation detail for the remote end. |
| * |
| * @param {{ |
| * x: (number|undefined), |
| * y: (number|undefined), |
| * duration: (number|undefined), |
| * origin: (!Origin|!./webdriver.WebElement|undefined), |
| * }=} options The move options. Defaults to moving the mouse to the top-left |
| * corner of the viewport over 100ms. |
| * @return {!Actions} a self reference. |
| */ |
| move({ x = 0, y = 0, duration = 100, origin = Origin.VIEWPORT } = {}) { |
| return this.insert(this.mouse_, this.mouse_.move({ x, y, duration, origin })) |
| } |
| |
| /** |
| * Short-hand for performing a simple left-click (down/up) with the mouse. |
| * |
| * @param {./webdriver.WebElement=} element If specified, the mouse will |
| * first be moved to the center of the element before performing the |
| * click. |
| * @return {!Actions} a self reference. |
| */ |
| click(element) { |
| if (element) { |
| this.move({ origin: element }) |
| } |
| return this.press().release() |
| } |
| |
| /** |
| * Short-hand for performing a simple right-click (down/up) with the mouse. |
| * |
| * @param {./webdriver.WebElement=} element If specified, the mouse will |
| * first be moved to the center of the element before performing the |
| * click. |
| * @return {!Actions} a self reference. |
| */ |
| contextClick(element) { |
| if (element) { |
| this.move({ origin: element }) |
| } |
| return this.press(Button.RIGHT).release(Button.RIGHT) |
| } |
| |
| /** |
| * Short-hand for performing a double left-click with the mouse. |
| * |
| * @param {./webdriver.WebElement=} element If specified, the mouse will |
| * first be moved to the center of the element before performing the |
| * click. |
| * @return {!Actions} a self reference. |
| */ |
| doubleClick(element) { |
| return this.click(element).press().release() |
| } |
| |
| /** |
| * Configures a drag-and-drop action consisting of the following steps: |
| * |
| * 1. Move to the center of the `from` element (element to be dragged). |
| * 2. Press the left mouse button. |
| * 3. If the `to` target is a {@linkplain ./webdriver.WebElement WebElement}, |
| * move the mouse to its center. Otherwise, move the mouse by the |
| * specified offset. |
| * 4. Release the left mouse button. |
| * |
| * @param {!./webdriver.WebElement} from The element to press the left mouse |
| * button on to start the drag. |
| * @param {(!./webdriver.WebElement|{x: number, y: number})} to Either another |
| * element to drag to (will drag to the center of the element), or an |
| * object specifying the offset to drag by, in pixels. |
| * @return {!Actions} a self reference. |
| */ |
| dragAndDrop(from, to) { |
| // Do not require up top to avoid a cycle that breaks static analysis. |
| const { WebElement } = require('./webdriver') |
| if (!(to instanceof WebElement) && (!to || typeof to.x !== 'number' || typeof to.y !== 'number')) { |
| throw new InvalidArgumentError('Invalid drag target; must specify a WebElement or {x, y} offset') |
| } |
| |
| this.move({ origin: from }).press() |
| if (to instanceof WebElement) { |
| this.move({ origin: to }) |
| } else { |
| this.move({ x: to.x, y: to.y, origin: Origin.POINTER }) |
| } |
| return this.release() |
| } |
| |
| /** |
| * Releases all keys, pointers, and clears internal state. |
| * |
| * @return {!Promise<void>} a promise that will resolve when finished |
| * clearing all action state. |
| */ |
| clear() { |
| for (const s of this.sequences_.values()) { |
| s.length = 0 |
| } |
| return this.executor_.execute(new Command(Name.CLEAR_ACTIONS)) |
| } |
| |
| /** |
| * Performs the configured action sequence. |
| * |
| * @return {!Promise<void>} a promise that will resolve when all actions have |
| * been completed. |
| */ |
| async perform() { |
| const _actions = [] |
| this.sequences_.forEach((actions, device) => { |
| if (!isIdle(actions)) { |
| actions = actions.concat() // Defensive copy. |
| _actions.push(Object.assign({ actions }, device.toJSON())) |
| } |
| }) |
| |
| if (_actions.length === 0) { |
| return Promise.resolve() |
| } |
| |
| await this.executor_.execute(new Command(Name.ACTIONS).setParameter('actions', _actions)) |
| } |
| |
| getSequences() { |
| const _actions = [] |
| this.sequences_.forEach((actions, device) => { |
| if (!isIdle(actions)) { |
| actions = actions.concat() |
| _actions.push(Object.assign({ actions }, device.toJSON())) |
| } |
| }) |
| |
| return _actions |
| } |
| } |
| |
| /** |
| * @param {!Array<!Action>} actions |
| * @return {boolean} |
| */ |
| function isIdle(actions) { |
| return actions.length === 0 || actions.every((a) => a.type === Action.Type.PAUSE && !a.duration) |
| } |
| |
| /** |
| * Script used to compute the offset from the center of a DOM element's first |
| * client rect from the top-left corner of the element's bounding client rect. |
| * The element's center point is computed using the algorithm defined here: |
| * <https://w3c.github.io/webdriver/webdriver-spec.html#dfn-center-point>. |
| * |
| * __This is only exported for use in internal unit tests. DO NOT USE.__ |
| * |
| * @package |
| */ |
| const INTERNAL_COMPUTE_OFFSET_SCRIPT = ` |
| function computeOffset(el) { |
| var rect = el.getClientRects()[0]; |
| var left = Math.max(0, Math.min(rect.x, rect.x + rect.width)); |
| var right = |
| Math.min(window.innerWidth, Math.max(rect.x, rect.x + rect.width)); |
| var top = Math.max(0, Math.min(rect.y, rect.y + rect.height)); |
| var bot = |
| Math.min(window.innerHeight, Math.max(rect.y, rect.y + rect.height)); |
| var x = Math.floor(0.5 * (left + right)); |
| var y = Math.floor(0.5 * (top + bot)); |
| |
| var bbox = el.getBoundingClientRect(); |
| return [x - bbox.left, y - bbox.top]; |
| } |
| return computeOffset(arguments[0]);` |
| |
| // PUBLIC API |
| |
| module.exports = { |
| Action, // For documentation only. |
| Actions, |
| Button, |
| Device, |
| Key, |
| Keyboard, |
| FileDetector, |
| Origin, |
| Pointer, |
| INTERNAL_COMPUTE_OFFSET_SCRIPT, |
| } |
| </code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Selenium WebDriver JavaScript API</a><div class="mobile-nav-links"><div class="navbar-item"><a id="github-mobile" href="https://github.com/SeleniumHQ/selenium" target="">GitHub</a></div><div class="navbar-item"><a id="npm-mobile" href="https://www.npmjs.com/package/selenium-webdriver" target="">npm</a></div></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome.html">selenium-webdriver/chrome</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium.html">selenium-webdriver/chromium</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge.html">selenium-webdriver/edge</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox.html">selenium-webdriver/firefox</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie.html">selenium-webdriver/ie</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari.html">selenium-webdriver/safari</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Actions.html">Actions</a></div><div class="sidebar-section-children"><a href="Alert.html">Alert</a></div><div class="sidebar-section-children"><a href="AlertPromise.html">AlertPromise</a></div><div class="sidebar-section-children"><a href="ArgumentValue.html">ArgumentValue</a></div><div class="sidebar-section-children"><a href="BaseLogEntry.html">BaseLogEntry</a></div><div class="sidebar-section-children"><a href="BaseParameters.html">BaseParameters</a></div><div class="sidebar-section-children"><a href="BeforeRequestSent.html">BeforeRequestSent</a></div><div class="sidebar-section-children"><a href="BoxClipRectangle.html">BoxClipRectangle</a></div><div class="sidebar-section-children"><a href="global.html#Browser">Browser</a></div><div class="sidebar-section-children"><a href="BrowsingContext.html">BrowsingContext</a></div><div class="sidebar-section-children"><a href="BrowsingContextInfo.html">BrowsingContextInfo</a></div><div class="sidebar-section-children"><a href="BrowsingContextInspector.html">BrowsingContextInspector</a></div><div class="sidebar-section-children"><a href="BrowsingContextPartitionDescriptor.html">BrowsingContextPartitionDescriptor</a></div><div class="sidebar-section-children"><a href="Build.html">Build</a></div><div class="sidebar-section-children"><a href="Builder.html">Builder</a></div><div class="sidebar-section-children"><a href="By.html">By</a></div><div class="sidebar-section-children"><a href="BytesValue.html">BytesValue</a></div><div class="sidebar-section-children"><a href="Capabilities.html">Capabilities</a></div><div class="sidebar-section-children"><a href="CaptureScreenshotParameters.html">CaptureScreenshotParameters</a></div><div class="sidebar-section-children"><a href="ChannelValue.html">ChannelValue</a></div><div class="sidebar-section-children"><a href="ClientWindowInfo.html">ClientWindowInfo</a></div><div class="sidebar-section-children"><a href="ClipRectangle.html">ClipRectangle</a></div><div class="sidebar-section-children"><a href="Command.html">Command</a></div><div class="sidebar-section-children"><a href="Command.html">Command</a></div><div class="sidebar-section-children"><a href="Condition.html">Condition</a></div><div class="sidebar-section-children"><a href="ConsoleLogEntry.html">ConsoleLogEntry</a></div><div class="sidebar-section-children"><a href="ContinueRequestParameters.html">ContinueRequestParameters</a></div><div class="sidebar-section-children"><a href="ContinueResponseParameters.html">ContinueResponseParameters</a></div><div class="sidebar-section-children"><a href="Cookie.html">Cookie</a></div><div class="sidebar-section-children"><a href="CookieFilter.html">CookieFilter</a></div><div class="sidebar-section-children"><a href="CreateContextParameters.html">CreateContextParameters</a></div><div class="sidebar-section-children"><a href="Credential.html">Credential</a></div><div class="sidebar-section-children"><a href="DetachedShadowRootError.html">DetachedShadowRootError</a></div><div class="sidebar-section-children"><a href="Device.html">Device</a></div><div class="sidebar-section-children"><a href="DriverService.html">DriverService</a></div><div class="sidebar-section-children"><a href="DriverService.Builder.html">Builder</a></div><div class="sidebar-section-children"><a href="ElementClickInterceptedError.html">ElementClickInterceptedError</a></div><div class="sidebar-section-children"><a href="ElementClipRectangle.html">ElementClipRectangle</a></div><div class="sidebar-section-children"><a href="ElementNotInteractableError.html">ElementNotInteractableError</a></div><div class="sidebar-section-children"><a href="ElementNotSelectableError.html">ElementNotSelectableError</a></div><div class="sidebar-section-children"><a href="Entry.html">Entry</a></div><div class="sidebar-section-children"><a href="Environment.html">Environment</a></div><div class="sidebar-section-children"><a href="EvaluateResultException.html">EvaluateResultException</a></div><div class="sidebar-section-children"><a href="EvaluateResultSuccess.html">EvaluateResultSuccess</a></div><div class="sidebar-section-children"><a href="ExceptionDetails.html">ExceptionDetails</a></div><div class="sidebar-section-children"><a href="Executor.html">Executor</a></div><div class="sidebar-section-children"><a href="FetchError.html">FetchError</a></div><div class="sidebar-section-children"><a href="FetchTimingInfo.html">FetchTimingInfo</a></div><div class="sidebar-section-children"><a href="FileDetector.html">FileDetector</a></div><div class="sidebar-section-children"><a href="FileDetector.html">FileDetector</a></div><div class="sidebar-section-children"><a href="GenericLogEntry.html">GenericLogEntry</a></div><div class="sidebar-section-children"><a href="Header.html">Header</a></div><div class="sidebar-section-children"><a href="HttpClient.html">HttpClient</a></div><div class="sidebar-section-children"><a href="HttpResponse.html">HttpResponse</a></div><div class="sidebar-section-children"><a href="Index_.html">Index</a></div><div class="sidebar-section-children"><a href="Initiator.html">Initiator</a></div><div class="sidebar-section-children"><a href="Input.html">Input</a></div><div class="sidebar-section-children"><a href="InsecureCertificateError.html">InsecureCertificateError</a></div><div class="sidebar-section-children"><a href="InvalidArgumentError.html">InvalidArgumentError</a></div><div class="sidebar-section-children"><a href="InvalidCharacterError.html">InvalidCharacterError</a></div><div class="sidebar-section-children"><a href="InvalidCookieDomainError.html">InvalidCookieDomainError</a></div><div class="sidebar-section-children"><a href="InvalidCoordinatesError.html">InvalidCoordinatesError</a></div><div class="sidebar-section-children"><a href="InvalidElementStateError.html">InvalidElementStateError</a></div><div class="sidebar-section-children"><a href="InvalidSelectorError.html">InvalidSelectorError</a></div><div class="sidebar-section-children"><a href="JavascriptError.html">JavascriptError</a></div><div class="sidebar-section-children"><a href="JavascriptLogEntry.html">JavascriptLogEntry</a></div><div class="sidebar-section-children"><a href="Keyboard.html">Keyboard</a></div><div class="sidebar-section-children"><a href="Level.html">Level</a></div><div class="sidebar-section-children"><a href="LocalValue.html">LocalValue</a></div><div class="sidebar-section-children"><a href="Locator.html">Locator</a></div><div class="sidebar-section-children"><a href="LogManager.html">LogManager</a></div><div class="sidebar-section-children"><a href="Logger.html">Logger</a></div><div class="sidebar-section-children"><a href="Message.html">Message</a></div><div class="sidebar-section-children"><a href="MoveTargetOutOfBoundsError.html">MoveTargetOutOfBoundsError</a></div><div class="sidebar-section-children"><a href="NavigateResult.html">NavigateResult</a></div><div class="sidebar-section-children"><a href="NavigationInfo.html">NavigationInfo</a></div><div class="sidebar-section-children"><a href="Network.html">Network</a></div><div class="sidebar-section-children"><a href="NetworkInspector.html">NetworkInspector</a></div><div class="sidebar-section-children"><a href="NoSuchAlertError.html">NoSuchAlertError</a></div><div class="sidebar-section-children"><a href="NoSuchCookieError.html">NoSuchCookieError</a></div><div class="sidebar-section-children"><a href="NoSuchElementError.html">NoSuchElementError</a></div><div class="sidebar-section-children"><a href="NoSuchFrameError.html">NoSuchFrameError</a></div><div class="sidebar-section-children"><a href="NoSuchSessionError.html">NoSuchSessionError</a></div><div class="sidebar-section-children"><a href="NoSuchShadowRootError.html">NoSuchShadowRootError</a></div><div class="sidebar-section-children"><a href="NoSuchWindowError.html">NoSuchWindowError</a></div><div class="sidebar-section-children"><a href="PartialCookie.html">PartialCookie</a></div><div class="sidebar-section-children"><a href="PartitionDescriptor.html">PartitionDescriptor</a></div><div class="sidebar-section-children"><a href="PartitionKey.html">PartitionKey</a></div><div class="sidebar-section-children"><a href="Pointer.html">Pointer</a></div><div class="sidebar-section-children"><a href="Preferences.html">Preferences</a></div><div class="sidebar-section-children"><a href="PrintResult.html">PrintResult</a></div><div class="sidebar-section-children"><a href="ProvideResponseParameters.html">ProvideResponseParameters</a></div><div class="sidebar-section-children"><a href="RealmInfo.html">RealmInfo</a></div><div class="sidebar-section-children"><a href="ReferenceValue.html">ReferenceValue</a></div><div class="sidebar-section-children"><a href="RegExpValue.html">RegExpValue</a></div><div class="sidebar-section-children"><a href="RelativeBy.html">RelativeBy</a></div><div class="sidebar-section-children"><a href="RemoteValue.html">RemoteValue</a></div><div class="sidebar-section-children"><a href="Request.html">Request</a></div><div class="sidebar-section-children"><a href="RequestData.html">RequestData</a></div><div class="sidebar-section-children"><a href="Response.html">Response</a></div><div class="sidebar-section-children"><a href="ResponseData.html">ResponseData</a></div><div class="sidebar-section-children"><a href="ResponseStarted.html">ResponseStarted</a></div><div class="sidebar-section-children"><a href="Result.html">Result</a></div><div class="sidebar-section-children"><a href="ScriptManager.html">ScriptManager</a></div><div class="sidebar-section-children"><a href="ScriptTimeoutError.html">ScriptTimeoutError</a></div><div class="sidebar-section-children"><a href="Select.html">Select</a></div><div class="sidebar-section-children"><a href="SeleniumServer.html">SeleniumServer</a></div><div class="sidebar-section-children"><a href="SerializationOptions.html">SerializationOptions</a></div><div class="sidebar-section-children"><a href="Server.html">Server</a></div><div class="sidebar-section-children"><a href="Session.html">Session</a></div><div class="sidebar-section-children"><a href="SessionNotCreatedError.html">SessionNotCreatedError</a></div><div class="sidebar-section-children"><a href="ShadowRoot.html">ShadowRoot</a></div><div class="sidebar-section-children"><a href="ShadowRootPromise.html">ShadowRootPromise</a></div><div class="sidebar-section-children"><a href="Source.html">Source</a></div><div class="sidebar-section-children"><a href="StaleElementReferenceError.html">StaleElementReferenceError</a></div><div class="sidebar-section-children"><a href="Storage.html">Storage</a></div><div class="sidebar-section-children"><a href="StorageKeyPartitionDescriptor.html">StorageKeyPartitionDescriptor</a></div><div class="sidebar-section-children"><a href="TimeoutError.html">TimeoutError</a></div><div class="sidebar-section-children"><a href="UnableToCaptureScreenError.html">UnableToCaptureScreenError</a></div><div class="sidebar-section-children"><a href="UnableToSetCookieError.html">UnableToSetCookieError</a></div><div class="sidebar-section-children"><a href="UnexpectedAlertOpenError.html">UnexpectedAlertOpenError</a></div><div class="sidebar-section-children"><a href="UnknownCommandError.html">UnknownCommandError</a></div><div class="sidebar-section-children"><a href="UnknownMethodError.html">UnknownMethodError</a></div><div class="sidebar-section-children"><a href="UnsupportedOperationError.html">UnsupportedOperationError</a></div><div class="sidebar-section-children"><a href="UrlPattern.html">UrlPattern</a></div><div class="sidebar-section-children"><a href="VirtualAuthenticatorOptions.html">VirtualAuthenticatorOptions</a></div><div class="sidebar-section-children"><a href="WebDriver.html">WebDriver</a></div><div class="sidebar-section-children"><a href="WebDriverError.html">WebDriverError</a></div><div class="sidebar-section-children"><a href="WebElement.html">WebElement</a></div><div class="sidebar-section-children"><a href="WebElementCondition.html">WebElementCondition</a></div><div class="sidebar-section-children"><a href="WebElementPromise.html">WebElementPromise</a></div><div class="sidebar-section-children"><a href="Wheel.html">Wheel</a></div><div class="sidebar-section-children"><a href="WindowRealmInfo.html">WindowRealmInfo</a></div><div class="sidebar-section-children"><a href="Zip.html">Zip</a></div><div class="sidebar-section-children"><a href="createDriver-thenableWebDriverProxy.html">thenableWebDriverProxy</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chrome-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Extensions.html">Extensions</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_chromium-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_edge-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-AddonFormatError.html">AddonFormatError</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Channel.html">Channel</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_firefox-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_ie-ServiceBuilder.html">ServiceBuilder</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-Driver.html">Driver</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-Options.html">Options</a></div><div class="sidebar-section-children"><a href="module-selenium-webdriver_safari-ServiceBuilder.html">ServiceBuilder</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-interfaces"><div>Interfaces</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Action.html">Action</a></div><div class="sidebar-section-children"><a href="Client.html">Client</a></div><div class="sidebar-section-children"><a href="global.html#Config">Config</a></div><div class="sidebar-section-children"><a href="Executor.html">Executor</a></div><div class="sidebar-section-children"><a href="ISelect.html">ISelect</a></div><div class="sidebar-section-children"><a href="IWebDriver.html">IWebDriver</a></div><div class="sidebar-section-children"><a href="global.html#ManualConfig">ManualConfig</a></div><div class="sidebar-section-children"><a href="Options.html">Options</a></div><div class="sidebar-section-children"><a href="Options.Cookie.html">Cookie</a></div><div class="sidebar-section-children"><a href="global.html#PacConfig">PacConfig</a></div><div class="sidebar-section-children"><a href="SeleniumServer.Options.html">Options</a></div><div class="sidebar-section-children"><a href="ServiceOptions.html">ServiceOptions</a></div><div class="sidebar-section-children"><a href="SuiteOptions.html">SuiteOptions</a></div><div class="sidebar-section-children"><a href="TargetBrowser.html">TargetBrowser</a></div><div class="sidebar-section-children"><a href="ThenableWebDriver.html">ThenableWebDriver</a></div><div class="sidebar-section-children"><a href="Timeouts.html">Timeouts</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#Atom">Atom</a></div><div class="sidebar-section-children"><a href="global.html#Browser">Browser</a></div><div class="sidebar-section-children"><a href="global.html#Button">Button</a></div><div class="sidebar-section-children"><a href="global.html#ByHash">ByHash</a></div><div class="sidebar-section-children"><a href="global.html#Capability">Capability</a></div><div class="sidebar-section-children"><a href="global.html#CommandLineFlag">CommandLineFlag</a></div><div class="sidebar-section-children"><a href="global.html#CommandSpec">CommandSpec</a></div><div class="sidebar-section-children"><a href="global.html#CommandTransformer">CommandTransformer</a></div><div class="sidebar-section-children"><a href="global.html#Config">Config</a></div><div class="sidebar-section-children"><a href="global.html#ErrorCode">ErrorCode</a></div><div class="sidebar-section-children"><a href="global.html#EvaluateResultType">EvaluateResultType</a></div><div class="sidebar-section-children"><a href="global.html#INTERNAL_COMPUTE_OFFSET_SCRIPT">INTERNAL_COMPUTE_OFFSET_SCRIPT</a></div><div class="sidebar-section-children"><a href="global.html#InterceptPhase">InterceptPhase</a></div><div class="sidebar-section-children"><a href="global.html#Key">Key</a></div><div class="sidebar-section-children"><a href="global.html#ManualConfig">ManualConfig</a></div><div class="sidebar-section-children"><a href="global.html#Name">Name</a></div><div class="sidebar-section-children"><a href="global.html#NonPrimitiveType">NonPrimitiveType</a></div><div class="sidebar-section-children"><a href="global.html#Origin">Origin</a></div><div class="sidebar-section-children"><a href="global.html#Origin">Origin</a></div><div class="sidebar-section-children"><a href="global.html#PacConfig">PacConfig</a></div><div class="sidebar-section-children"><a href="global.html#PageLoadStrategy">PageLoadStrategy</a></div><div class="sidebar-section-children"><a href="global.html#Platform">Platform</a></div><div class="sidebar-section-children"><a href="global.html#PrimitiveType">PrimitiveType</a></div><div class="sidebar-section-children"><a href="global.html#Protocol">Protocol</a></div><div class="sidebar-section-children"><a href="global.html#RealmType">RealmType</a></div><div class="sidebar-section-children"><a href="global.html#RemoteReferenceType">RemoteReferenceType</a></div><div class="sidebar-section-children"><a href="global.html#RemoteType">RemoteType</a></div><div class="sidebar-section-children"><a href="global.html#RequestOptions">RequestOptions</a></div><div class="sidebar-section-children"><a href="global.html#ResultOwnership">ResultOwnership</a></div><div class="sidebar-section-children"><a href="global.html#SameSite">SameSite</a></div><div class="sidebar-section-children"><a href="global.html#SpecialNumberType">SpecialNumberType</a></div><div class="sidebar-section-children"><a href="global.html#StdIoOptions">StdIoOptions</a></div><div class="sidebar-section-children"><a href="global.html#THENABLE_DRIVERS">THENABLE_DRIVERS</a></div><div class="sidebar-section-children"><a href="global.html#Transport">Transport</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#Type">Type</a></div><div class="sidebar-section-children"><a href="global.html#USER_AGENT">USER_AGENT</a></div><div class="sidebar-section-children"><a href="global.html#UserPromptHandler">UserPromptHandler</a></div><div class="sidebar-section-children"><a href="global.html#W3C_COMMAND_MAP">W3C_COMMAND_MAP</a></div><div class="sidebar-section-children"><a href="global.html#ableToSwitchToFrame">ableToSwitchToFrame</a></div><div class="sidebar-section-children"><a href="global.html#addConsoleHandler">addConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#alertIsPresent">alertIsPresent</a></div><div class="sidebar-section-children"><a href="global.html#arraysEqual">arraysEqual</a></div><div class="sidebar-section-children"><a href="global.html#binaryPaths">binaryPaths</a></div><div class="sidebar-section-children"><a href="global.html#buildPath">buildPath</a></div><div class="sidebar-section-children"><a href="global.html#buildRequest">buildRequest</a></div><div class="sidebar-section-children"><a href="global.html#builtTargets">builtTargets</a></div><div class="sidebar-section-children"><a href="global.html#check">check</a></div><div class="sidebar-section-children"><a href="global.html#checkCodePoint">checkCodePoint</a></div><div class="sidebar-section-children"><a href="global.html#checkLegacyResponse">checkLegacyResponse</a></div><div class="sidebar-section-children"><a href="global.html#checkOptions">checkOptions</a></div><div class="sidebar-section-children"><a href="global.html#checkedCall">checkedCall</a></div><div class="sidebar-section-children"><a href="global.html#checkedNodeCall">checkedNodeCall</a></div><div class="sidebar-section-children"><a href="global.html#color">color</a></div><div class="sidebar-section-children"><a href="global.html#consoleHandler">consoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#copy">copy</a></div><div class="sidebar-section-children"><a href="global.html#copyDir">copyDir</a></div><div class="sidebar-section-children"><a href="global.html#createDriver">createDriver</a></div><div class="sidebar-section-children"><a href="global.html#delayed">delayed</a></div><div class="sidebar-section-children"><a href="global.html#direct">direct</a></div><div class="sidebar-section-children"><a href="global.html#elementIsDisabled">elementIsDisabled</a></div><div class="sidebar-section-children"><a href="global.html#elementIsEnabled">elementIsEnabled</a></div><div class="sidebar-section-children"><a href="global.html#elementIsNotSelected">elementIsNotSelected</a></div><div class="sidebar-section-children"><a href="global.html#elementIsNotVisible">elementIsNotVisible</a></div><div class="sidebar-section-children"><a href="global.html#elementIsSelected">elementIsSelected</a></div><div class="sidebar-section-children"><a href="global.html#elementIsVisible">elementIsVisible</a></div><div class="sidebar-section-children"><a href="global.html#elementLocated">elementLocated</a></div><div class="sidebar-section-children"><a href="global.html#elementTextContains">elementTextContains</a></div><div class="sidebar-section-children"><a href="global.html#elementTextIs">elementTextIs</a></div><div class="sidebar-section-children"><a href="global.html#elementTextMatches">elementTextMatches</a></div><div class="sidebar-section-children"><a href="global.html#elementsLocated">elementsLocated</a></div><div class="sidebar-section-children"><a href="global.html#encodeError">encodeError</a></div><div class="sidebar-section-children"><a href="global.html#ensureFileDetectorsAreEnabled">ensureFileDetectorsAreEnabled</a></div><div class="sidebar-section-children"><a href="global.html#escapeCss">escapeCss</a></div><div class="sidebar-section-children"><a href="global.html#exec">exec</a></div><div class="sidebar-section-children"><a href="global.html#executeCommand">executeCommand</a></div><div class="sidebar-section-children"><a href="global.html#exists">exists</a></div><div class="sidebar-section-children"><a href="global.html#extractId">extractId</a></div><div class="sidebar-section-children"><a href="global.html#filter">filter</a></div><div class="sidebar-section-children"><a href="global.html#filterNonW3CCaps">filterNonW3CCaps</a></div><div class="sidebar-section-children"><a href="global.html#findFreePort">findFreePort</a></div><div class="sidebar-section-children"><a href="global.html#findInPath">findInPath</a></div><div class="sidebar-section-children"><a href="global.html#formatSpawnArgs">formatSpawnArgs</a></div><div class="sidebar-section-children"><a href="global.html#fromWireValue">fromWireValue</a></div><div class="sidebar-section-children"><a href="global.html#fullyResolveKeys">fullyResolveKeys</a></div><div class="sidebar-section-children"><a href="global.html#fullyResolved">fullyResolved</a></div><div class="sidebar-section-children"><a href="global.html#getAddress">getAddress</a></div><div class="sidebar-section-children"><a href="global.html#getAvailableBrowsers">getAvailableBrowsers</a></div><div class="sidebar-section-children"><a href="global.html#getBinary">getBinary</a></div><div class="sidebar-section-children"><a href="global.html#getBinaryPaths">getBinaryPaths</a></div><div class="sidebar-section-children"><a href="global.html#getBrowsersToTestFromEnv">getBrowsersToTestFromEnv</a></div><div class="sidebar-section-children"><a href="global.html#getBrowsingContextInstance">getBrowsingContextInstance</a></div><div class="sidebar-section-children"><a href="global.html#getIPAddress">getIPAddress</a></div><div class="sidebar-section-children"><a href="global.html#getJavaPath">getJavaPath</a></div><div class="sidebar-section-children"><a href="global.html#getLevel">getLevel</a></div><div class="sidebar-section-children"><a href="global.html#getLogInspectorInstance">getLogInspectorInstance</a></div><div class="sidebar-section-children"><a href="global.html#getLogger">getLogger</a></div><div class="sidebar-section-children"><a href="global.html#getLoopbackAddress">getLoopbackAddress</a></div><div class="sidebar-section-children"><a href="global.html#getRequestOptions">getRequestOptions</a></div><div class="sidebar-section-children"><a href="global.html#getStatus">getStatus</a></div><div class="sidebar-section-children"><a href="global.html#getTestHook">getTestHook</a></div><div class="sidebar-section-children"><a href="global.html#headersToString">headersToString</a></div><div class="sidebar-section-children"><a href="global.html#ignore">ignore</a></div><div class="sidebar-section-children"><a href="global.html#init">init</a></div><div class="sidebar-section-children"><a href="global.html#installConsoleHandler">installConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#isErrorResponse">isErrorResponse</a></div><div class="sidebar-section-children"><a href="global.html#isFree">isFree</a></div><div class="sidebar-section-children"><a href="global.html#isId">isId</a></div><div class="sidebar-section-children"><a href="global.html#isIdle">isIdle</a></div><div class="sidebar-section-children"><a href="global.html#isObject">isObject</a></div><div class="sidebar-section-children"><a href="global.html#isPromise">isPromise</a></div><div class="sidebar-section-children"><a href="global.html#isRetryableNetworkError">isRetryableNetworkError</a></div><div class="sidebar-section-children"><a href="global.html#isSelenium3x">isSelenium3x</a></div><div class="sidebar-section-children"><a href="global.html#legacyTimeout">legacyTimeout</a></div><div class="sidebar-section-children"><a href="global.html#load">load</a></div><div class="sidebar-section-children"><a href="global.html#locate">locate</a></div><div class="sidebar-section-children"><a href="global.html#locateWith">locateWith</a></div><div class="sidebar-section-children"><a href="global.html#manual">manual</a></div><div class="sidebar-section-children"><a href="global.html#map">map</a></div><div class="sidebar-section-children"><a href="global.html#mkdir">mkdir</a></div><div class="sidebar-section-children"><a href="global.html#mkdirp">mkdirp</a></div><div class="sidebar-section-children"><a href="global.html#of">of</a></div><div class="sidebar-section-children"><a href="global.html#pac">pac</a></div><div class="sidebar-section-children"><a href="global.html#pad">pad</a></div><div class="sidebar-section-children"><a href="global.html#parseHttpResponse">parseHttpResponse</a></div><div class="sidebar-section-children"><a href="global.html#path">path</a></div><div class="sidebar-section-children"><a href="global.html#projectRoot">projectRoot</a></div><div class="sidebar-section-children"><a href="global.html#read">read</a></div><div class="sidebar-section-children"><a href="global.html#removeConsoleHandler">removeConsoleHandler</a></div><div class="sidebar-section-children"><a href="global.html#requireAtom">requireAtom</a></div><div class="sidebar-section-children"><a href="global.html#resolveCommandLineFlags">resolveCommandLineFlags</a></div><div class="sidebar-section-children"><a href="global.html#resolveWaitMessage">resolveWaitMessage</a></div><div class="sidebar-section-children"><a href="global.html#rmDir">rmDir</a></div><div class="sidebar-section-children"><a href="global.html#sendIndex">sendIndex</a></div><div class="sidebar-section-children"><a href="global.html#sendRequest">sendRequest</a></div><div class="sidebar-section-children"><a href="global.html#serialize">serialize</a></div><div class="sidebar-section-children"><a href="global.html#setFileDetector">setFileDetector</a></div><div class="sidebar-section-children"><a href="global.html#shouldRetryRequest">shouldRetryRequest</a></div><div class="sidebar-section-children"><a href="global.html#socks">socks</a></div><div class="sidebar-section-children"><a href="global.html#splitHostAndPort">splitHostAndPort</a></div><div class="sidebar-section-children"><a href="global.html#stalenessOf">stalenessOf</a></div><div class="sidebar-section-children"><a href="global.html#start">start</a></div><div class="sidebar-section-children"><a href="global.html#startSeleniumServer">startSeleniumServer</a></div><div class="sidebar-section-children"><a href="global.html#stat">stat</a></div><div class="sidebar-section-children"><a href="global.html#stop">stop</a></div><div class="sidebar-section-children"><a href="global.html#suite">suite</a></div><div class="sidebar-section-children"><a href="global.html#suite">suite</a></div><div class="sidebar-section-children"><a href="global.html#system">system</a></div><div class="sidebar-section-children"><a href="global.html#thenFinally">thenFinally</a></div><div class="sidebar-section-children"><a href="global.html#throwDecodedError">throwDecodedError</a></div><div class="sidebar-section-children"><a href="global.html#titleContains">titleContains</a></div><div class="sidebar-section-children"><a href="global.html#titleIs">titleIs</a></div><div class="sidebar-section-children"><a href="global.html#titleMatches">titleMatches</a></div><div class="sidebar-section-children"><a href="global.html#tmpDir">tmpDir</a></div><div class="sidebar-section-children"><a href="global.html#tmpFile">tmpFile</a></div><div class="sidebar-section-children"><a href="global.html#toExecuteAtomCommand">toExecuteAtomCommand</a></div><div class="sidebar-section-children"><a href="global.html#toMap">toMap</a></div><div class="sidebar-section-children"><a href="global.html#toWireValue">toWireValue</a></div><div class="sidebar-section-children"><a href="global.html#tryParse">tryParse</a></div><div class="sidebar-section-children"><a href="global.html#unlink">unlink</a></div><div class="sidebar-section-children"><a href="global.html#unzip">unzip</a></div><div class="sidebar-section-children"><a href="global.html#url">url</a></div><div class="sidebar-section-children"><a href="global.html#urlContains">urlContains</a></div><div class="sidebar-section-children"><a href="global.html#urlIs">urlIs</a></div><div class="sidebar-section-children"><a href="global.html#urlMatches">urlMatches</a></div><div class="sidebar-section-children"><a href="global.html#waitForServer">waitForServer</a></div><div class="sidebar-section-children"><a href="global.html#waitForUrl">waitForUrl</a></div><div class="sidebar-section-children"><a href="global.html#walkDir">walkDir</a></div><div class="sidebar-section-children"><a href="global.html#whereIs">whereIs</a></div><div class="sidebar-section-children"><a href="global.html#withTagName">withTagName</a></div><div class="sidebar-section-children"><a href="global.html#write">write</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html> |