123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- {
- "/session/:sessionId/alert": {
- "GET": {
- "command": "isAlertOpen",
- "description": "Whether a simple dialog is currently open.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/alert_commands.cc#L42-L49",
- "examples": [
- [
- "console.log(browser.isAlertOpen()); // outputs: false",
- "browser.execute('window.alert()');",
- "console.log(browser.isAlertOpen()); // outputs: true"
- ]
- ],
- "parameters": [],
- "returns": {
- "type": "Boolean",
- "name": "isAlertOpen",
- "description": "`true` or `false` based on whether simple dialog is present or not."
- }
- }
- },
- "/session/:sessionId/autoreport": {
- "GET": {
- "command": "isAutoReporting",
- "description": "Whether it should automatically raises errors on browser logs.",
- "ref": "https://codereview.chromium.org/101203012",
- "parameters": [],
- "returns": {
- "type": "Boolean",
- "name": "isAutoReporting",
- "description": "`true` or `false` based on whether auto reporting is enabled."
- }
- },
- "POST": {
- "command": "setAutoReporting",
- "description": "Toggle whether to return response with unknown error with first browser error (e.g. failed to load resource due to 403/404 response) for all subsequent commands (once enabled).",
- "ref": "https://codereview.chromium.org/101203012",
- "examples": [
- [
- "// Enable auto reporting first thing after session was initiated with empty browser logs",
- "console.log(browser.setAutoReporting(true)); // outputs: null",
- "// Upon requesting an non-existing resource it will abort execution due to thrown unknown error",
- "browser.url('https://webdriver.io/img/404-does-not-exist.png');"
- ],
- [
- "// During the session do some operations which populate the browser logs",
- "browser.url('https://webdriver.io/img/404-does-not-exist.png');",
- "browser.url('https://webdriver.io/403/no-access');",
- "// Enable auto reporting which throws an unknown error for first browser log (404 response)",
- "browser.setAutoReporting(true);"
- ]
-
- ],
- "parameters": [{
- "name": "enabled",
- "type": "boolean",
- "description": "`true` if auto reporting should be enabled, use `false` to disable previously enabled auto reporting.",
- "required": true
- }],
- "returns": {
- "type": "Object|Null",
- "name": "firstBrowserError",
- "description": "In case first browser error already occured prior to executing this command it will throw unknown error as response, which is an object with 'message' key describing first browser error. Otherwise it returns `null` on success."
- }
- }
- },
- "/session/:sessionId/is_loading": {
- "GET": {
- "command": "isLoading",
- "description": "Determines load status for active window handle.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L783-L802",
- "examples": [
- [
- "console.log(browser.isLoading()); // outputs: false",
- "browser.newWindow('https://webdriver.io');",
- "console.log(browser.isLoading()); // outputs: true"
- ]
- ],
- "parameters": [],
- "returns": {
- "type": "Boolean",
- "name": "isLoading",
- "description": "`true` or `false` based on whether active window handle is loading or not."
- }
- }
- },
- "/session/:sessionId/chromium/heap_snapshot": {
- "GET": {
- "command": "takeHeapSnapshot",
- "description": "Takes a heap snapshot of the current execution context.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/chrome/web_view.h#L198-L202",
- "parameters": [],
- "returns": {
- "type": "Object",
- "name": "heapSnapshot",
- "description": "A JSON representation of the heap snapshot. Which can be inspected by loading as file into Chrome DevTools."
- }
- }
- },
- "/session/:sessionId/network_connection": {
- "GET": {
- "command": "getNetworkConnection",
- "description": "Get the connection type for network emulation. This command is only applicable when remote end replies with `networkConnectionEnabled` capability set to `true`.",
- "ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
- "examples": [
- [
- "const browser = remote({",
- " capabilities: {",
- " browserName: 'chrome',",
- " 'goog:chromeOptions': {",
- " // Network emulation requires device mode, which is only enabled when mobile emulation is on",
- " mobileEmulation: { deviceName: 'iPad' },",
- " },",
- " // Allow control over the state of network connectivity for testing",
- " networkConnectionEnabled: true",
- " }",
- "});",
- "console.log(browser.getNetworkConnection()); // outputs: 6 (Both Wi-Fi and data)"
- ]
- ],
- "parameters": [],
- "returns": {
- "type": "Number",
- "name": "connectionType",
- "description": "A bitmask to represent the network connection type. Airplane Mode (`1`), Wi-Fi only (`2`), Wi-Fi and data (`6`), 4G (`8`), 3G (`10`), 2G (`20`). By default [Wi-Fi and data are enabled](https://github.com/bayandin/chromedriver/blob/v2.45/chrome/chrome_desktop_impl.cc#L36-L37)."
- }
- },
- "POST": {
- "command": "setNetworkConnection",
- "description": "Change connection type for network connection. This command is only applicable when remote end replies with `networkConnectionEnabled` capability set to `true`.",
- "ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
- "examples": [
- [
- "const browser = remote({",
- " capabilities: {",
- " browserName: 'chrome',",
- " 'goog:chromeOptions': {",
- " // Network emulation requires device mode, which is only enabled when mobile emulation is on",
- " mobileEmulation: { deviceName: 'iPad' },",
- " },",
- " // Allow control over the state of network connectivity for testing",
- " networkConnectionEnabled: true",
- " }",
- "});",
- "console.log(browser.setNetworkConnection({ type: 1 })); // outputs: 1 (Airplane Mode)"
- ]
- ],
- "parameters": [{
- "name": "parameters",
- "type": "object",
- "description": "Object containing ConnectionType, set bitmask as value for `type` key in object. Airplane Mode (`1`), Wi-Fi only (`2`), Wi-Fi and data (`6`), 4G (`8`), 3G (`10`), 2G (`20`).",
- "required": true
- }],
- "returns": {
- "type": "Number",
- "name": "connectionType",
- "description": "A bitmask to represent the network connection type. Value should match specified `type` in object, however device might not be capable of the network connection type requested."
- }
- }
- },
- "/session/:sessionId/chromium/network_conditions": {
- "GET": {
- "command": "getNetworkConditions",
- "description": "Get current network conditions used for emulation.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L839-L859",
- "parameters": [],
- "returns": {
- "type": "Object",
- "name": "networkConditions",
- "description": "Object containing network conditions for `offline`, `latency`, `download_throughput` and `upload_throughput`. Network conditions must be set before it can be retrieved."
- }
- },
- "POST": {
- "command": "setNetworkConditions",
- "description": "Set network conditions used for emulation by throttling connection.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1663-L1722",
- "examples": [
- [
- "// Use different download (25kb/s) and upload (50kb/s) throughput values for throttling with a latency of 1000ms",
- "browser.setNetworkConditions({ latency: 1000, download_throughput: 25600, upload_throughput: 51200 });"
- ],
- [
- "// Force disconnected from network by setting 'offline' to true",
- "browser.setNetworkConditions({ latency: 0, throughput: 0, offline: true });"
- ],
- [
- "// When preset name (e.g. 'DSL') is specified it does not respect values in object (e.g. 'offline')",
- "browser.setNetworkConditions({ latency: 0, throughput: 0, offline: true }, 'DSL');"
- ],
- [
- "// Best practice for specifying network throttling preset is to use an empty object",
- "browser.setNetworkConditions({}, 'Good 3G');"
- ]
- ],
- "parameters": [{
- "name": "network_conditions",
- "type": "object",
- "description": "Object containing network conditions which are `latency`, `throughput` (or `download_throughput`/`upload_throughput`) and `offline` (optional).",
- "required": true
- }, {
- "name": "network_name",
- "type": "string",
- "description": "Name of [network throttling preset](https://github.com/bayandin/chromedriver/blob/v2.45/chrome/network_list.cc#L12-L25). `GPRS`, `Regular 2G`, `Good 2G`, `Regular 3G`, `Good 3G`, `Regular 4G`, `DSL`, `WiFi` or `No throttling` to disable. When preset is specified values passed in first argument are not respected.",
- "required": false
- }]
- },
- "DELETE": {
- "command": "deleteNetworkConditions",
- "description": "Disable any network throttling which might have been set. Equivalent of setting the `No throttling` preset.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1724-L1745",
- "parameters": []
- }
- },
- "/session/:sessionId/chromium/send_command": {
- "POST": {
- "command": "sendCommand",
- "description": "Send a command to the DevTools debugger.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1290-L1304",
- "parameters": [{
- "name": "cmd",
- "type": "string",
- "description": "Name of the command (e.g. [`Browser.close`](https://chromedevtools.github.io/devtools-protocol/1-3/Browser#method-close)).",
- "required": true
- }, {
- "name": "params",
- "type": "object",
- "description": "Parameters to the command. In case no parameters for command, specify an empty object.",
- "required": true
- }]
- }
- },
- "/session/:sessionId/chromium/send_command_and_get_result": {
- "POST": {
- "command": "sendCommandAndGetResult",
- "description": "Send a command to the DevTools debugger and wait for the result.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1306-L1320",
- "parameters": [{
- "name": "cmd",
- "type": "string",
- "description": "Name of the command which returns a result (e.g. [`Network.getAllCookies`](https://chromedevtools.github.io/devtools-protocol/1-3/Network#method-getAllCookies)).",
- "required": true
- }, {
- "name": "params",
- "type": "object",
- "description": "Parameters to the command. In case no parameters for command, specify an empty object.",
- "required": true
- }],
- "returns": {
- "type": "*",
- "name": "result",
- "description": "Either the return value of your command, or the error which was the reason for your command's failure."
- }
- }
- },
- "/session/:sessionId/file": {
- "POST": {
- "command": "file",
- "description": "Upload a file to remote machine on which the browser is running.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L1037-L1065",
- "parameters": [{
- "name": "file",
- "type": "string",
- "description": "Base64-encoded zip archive containing __single__ file which to upload. In case base64-encoded data does not represent a zip archive or archive contains more than one file it will throw an unknown error.",
- "required": true
- }],
- "returns": {
- "type": "String",
- "name": "path",
- "description": "Absolute path of uploaded file on remote machine."
- }
- }
- },
- "/session/:sessionId/chromium/launch_app": {
- "POST": {
- "command": "launchChromeApp",
- "description": "Launches a Chrome app by specified id.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L521-L539",
- "examples": [
- [
- "const browser = remote({",
- " capabilities: {",
- " browserName: 'chrome',",
- " 'goog:chromeOptions': {",
- " // Install upon starting browser in order to launch it",
- " extensions: [",
- " // Entry should be a base64-encoded packed Chrome app (.crx)",
- " require('fs').readFileSync('/absolute/path/app.crx').toString('base64')",
- " ]",
- " }",
- " }",
- "});",
- "browser.launchChromeApp('aohghmighlieiainnegkcijnfilokake')); // Google Docs (https://chrome.google.com/webstore/detail/docs/aohghmighlieiainnegkcijnfilokake)"
- ]
- ],
- "parameters": [{
- "name": "id",
- "type": "string",
- "description": "Extension id of app to be launched, as defined in chrome://extensions.",
- "required": true
- }]
- }
- },
- "/session/:sessionId/element/:elementId/value": {
- "GET": {
- "command": "getElementValue",
- "description": "Retrieves the value of a given form control element.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/element_commands.cc#L431-L443",
- "variables": [{
- "name": "elementId",
- "description": "id of element to get value from"
- }],
- "parameters": [],
- "returns": {
- "type": "String|Null",
- "name": "value",
- "description": "Current value of the element. In case specified element is not a form control element, it will return `null`."
- }
- }
- },
- "/session/:sessionId/element/:elementId/hover": {
- "POST": {
- "command": "elementHover",
- "description": "Enable hover state for an element, which is reset upon next interaction.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/element_commands.cc#L126-L146",
- "variables": [{
- "name": "elementId",
- "description": "id of element to hover over to"
- }],
- "parameters": []
- }
- },
- "/session/:sessionId/touch/pinch": {
- "POST": {
- "command": "touchPinch",
- "description": "Trigger a pinch zoom effect.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L813-L827",
- "parameters": [{
- "name": "x",
- "type": "number",
- "description": "x position to pinch on",
- "required": true
- }, {
- "name": "y",
- "type": "number",
- "description": "y position to pinch on",
- "required": true
- }, {
- "name": "scale",
- "type": "number",
- "description": "pinch zoom scale",
- "required": true
- }]
- }
- },
- "/session/:sessionId/goog/page/freeze": {
- "POST": {
- "command": "freeze",
- "description": "Freeze the current page. Extension for [Page Lifecycle API](https://developers.google.com/web/updates/2018/07/page-lifecycle-api).",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L625-L633",
- "parameters": []
- }
- },
- "/session/:sessionId/goog/page/resume": {
- "POST": {
- "command": "resume",
- "description": "Resume the current page. Extension for [Page Lifecycle API](https://developers.google.com/web/updates/2018/07/page-lifecycle-api).",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L635-L645",
- "parameters": []
- }
- },
- "/shutdown": {
- "POST": {
- "command": "shutdown",
- "description": "Shutdown ChromeDriver process and consequently terminating all active sessions.",
- "ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L489-L498",
- "parameters": []
- }
- },
- "/session/:sessionId/element/:elementId/screenshot": {
- "GET": {
- "command": "takeElementScreenshot",
- "description": "The Take Element Screenshot command takes a screenshot of the visible region encompassed by the bounding rectangle of an element.",
- "ref": "https://w3c.github.io/webdriver/#dfn-take-element-screenshot",
- "variables": [{
- "name": "elementId",
- "description": "the id of an element returned in a previous call to Find Element(s)"
- }],
- "parameters": [{
- "name": "scroll",
- "type": "boolean",
- "description": "scroll into view the element. Default: true",
- "required": false
- }],
- "returns": {
- "type": "String",
- "name": "screenshot",
- "description": "The base64-encoded PNG image data comprising the screenshot of the visible region of an element’s bounding rectangle after it has been scrolled into view."
- }
- }
- },
- "/session/:sessionId/se/log/types": {
- "GET": {
- "command": "getLogTypes",
- "description": "Get available log types.",
- "ref": "https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidlogtypes",
- "parameters": [],
- "returns": {
- "type": "String[]",
- "name": "logTypes",
- "description": "The list of available log types, example: browser, driver."
- }
- }
- },
- "/session/:sessionId/se/log": {
- "POST": {
- "command": "getLogs",
- "description": "Get the log for a given log type. Log buffer is reset after each request.",
- "ref": "https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidlog",
- "parameters": [{
- "name": "type",
- "type": "string",
- "description": "the log type",
- "required": true
- }],
- "returns": {
- "type": "Object[]",
- "name": "logs",
- "description": "The list of log entries."
- }
- }
- }
- }
|