JSON Wire Protocol
The JSONWireProtocol is deprecated and replaced by the WebDriver protocol.
status
Query the server's current status. The server should respond with a general "HTTP 200 OK" response if it is alive and accepting commands. The response body should be a JSON object describing the state of the server. All server implementations should return two basic objects describing the server's current platform and when the server was built. All fields are optional; if omitted, the client should assume the value is unknown. Furthermore, server implementations may include additional fields not listed here.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.status()
Returns
- <Object>
status
: An object describing the general status of the server.
newSession
Create a new session. The server should attempt to create a session that most closely matches the desired and required capabilities. Required capabilities have higher priority than desired capabilities and must be set for the session to be created.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.newSession(desiredCapabilities, requiredCapabilities)
Parameters
Name | Type | Details |
---|---|---|
desiredCapabilities | object | An object describing the session's desired capabilities. |
requiredCapabilities optional | object | An object describing the session's required capabilities (Optional). |
Returns
- <Object>
capabilities
: An object describing the session's capabilities.
getSessions
Returns a list of the currently active sessions. Each session will be returned as a list of JSON objects containing id
and capabilities
.
JSON Wire Protocol command. More details can be found in the official protocol docs.
This protocol command is deprecated
This command is deprecated and likely not supported by any browser.
Usage
browser.getSessions()
Returns
- <Object[]>
capabilities
: A list of the currently active sessions.
getSession
Retrieve the capabilities of the specified session.
JSON Wire Protocol command. More details can be found in the official protocol docs.
This protocol command is deprecated
This command is deprecated and likely not supported by any browser.
Usage
browser.getSession()
Returns
- <Object>
capabilities
: An object describing the session's capabilities.
deleteSession
Delete the session.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deleteSession(deleteSessionOpts)
Parameters
Name | Type | Details |
---|---|---|
deleteSessionOpts optional | object | Object containing options for the deleteSession command, e.g. { shutdownDriver: boolean } |
setTimeouts
Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setTimeouts(type, ms)
Parameters
Name | Type | Details |
---|---|---|
type | string | The type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. |
ms | number | The amount of time, in milliseconds, that time-limited commands are permitted to run |
setAsyncTimeout
Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async
are permitted to run before they are aborted and a Timeout
error is returned to the client.
JSON Wire Protocol command. More details can be found in the official protocol docs.
This protocol command is deprecated
This command is deprecated and likely not supported by any browser. Use the "setTimeouts" command instead!
Usage
browser.setAsyncTimeout(ms)
Parameters
Name | Type | Details |
---|---|---|
ms | number | The amount of time, in milliseconds, that time-limited commands are permitted to run |
setImplicitTimeout
Set the amount of time the driver should wait when searching for elements. When searching for a single element, the driver should poll the page until an element is found or the timeout expires, whichever occurs first. When searching for multiple elements, the driver should poll the page until at least one element is found or the timeout expires, at which point it should return an empty list. If this command is never sent, the driver should default to an implicit wait of 0ms.
JSON Wire Protocol command. More details can be found in the official protocol docs.
This protocol command is deprecated
This command is deprecated and likely not supported by any browser. Use the "setTimeouts" command instead!
Usage
browser.setImplicitTimeout(ms)
Parameters
Name | Type | Details |
---|---|---|
ms | number | The amount of time, in milliseconds, to wait on an element. |
getUrl
Retrieve the URL of the current page.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getUrl()
Returns
- <String>
url
: The current URL.
navigateTo
Navigate to a new URL.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.navigateTo(url)
Parameters
Name | Type | Details |
---|---|---|
url | string | The URL to navigate to. |
back
Navigate backwards in the browser history, if possible.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.back()
forward
Navigate forwards in the browser history, if possible.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.forward()
refresh
Refresh the current page.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.refresh()
getTitle
Get the current page title.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getTitle()
Returns
- <String>
title
: The current page title.
getWindowHandle
Retrieve the current window handle.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getWindowHandle()
Returns
- <String>
windowHandle
: The current window handle.
getWindowHandles
Retrieve the list of all window handles available to the session.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getWindowHandles()
Returns
- <String[]>
windowHandles
: A list of window handles.
closeWindow
Close the current window.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.closeWindow()
switchToWindow
Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name
attribute.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.switchToWindow(name)
Parameters
Name | Type | Details |
---|---|---|
name | string | The window to change focus to |
switchToFrame
Change focus to another frame on the page. If the frame id
is null
, the server should switch to the page's default content.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.switchToFrame(id)
Parameters
Name | Type | Details |
---|---|---|
id | string, number, object, null | Identifier for the frame to change focus to |