JSON Wire Protocol
The JSONWireProtocol is decrecated 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.
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.
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()
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.
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.
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 |
switchToParentFrame
Change focus to the parent context. If the current context is the top level browsing context, the context remains unchanged.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.switchToParentFrame()
getWindowPosition
Get the position of the current focussed window.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getWindowPosition()
Returns
- <Object>
positon
: The X and Y coordinates for the window, relative to the upper left corner of the screen.
setWindowPosition
Change the position of the current focussed window.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setWindowPosition(x, y)
Parameters
Name | Type | Details |
---|---|---|
x | number | The X coordinate to position the window at, relative to the upper left corner of the screen. |
y | number | The Y coordinate to position the window at, relative to the upper left corner of the screen. |
Returns
- <Object>
positon
: The X and Y coordinates for the window, relative to the upper left corner of the screen.
_getWindowSize
Get the size of the current focused window.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser._getWindowSize()
Returns
- <Object>
size
: The size of the window.
_setWindowSize
Change the size of the current focused window.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser._setWindowSize(width, height)
Parameters
Name | Type | Details |
---|---|---|
width | number | the new window width |
height | number | the new window height |
maximizeWindow
Maximize the current focused window if not already maximized.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.maximizeWindow()
findElement
Search for an element on the page, starting from the document root. The located element will be returned as a WebElement JSON object. The table below lists the locator strategies that each server should support. Each locator must return the first matching element located in the DOM.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.findElement(using, value)
Parameters
Name | Type | Details |
---|---|---|
using | string | the locator strategy to use |
value | string | the search target |
Returns
- <object>
ELEMENT
: A WebElement JSON object for the located element.
findElements
Search for multiple elements on the page, starting from the document root. The located elements will be returned as a WebElement JSON objects. The table below lists the locator strategies that each server should support. Elements should be returned in the order located in the DOM.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.findElements(using, value)
Parameters
Name | Type | Details |
---|---|---|
using | string | the locator strategy to use |
value | string | the search target |
Returns
- <object[]>
ELEMENTS
: A list of WebElement JSON objects for the located elements.
findElementFromElement
Search for an element on the page, starting from the identified element. The located element will be returned as a WebElement JSON object. The table below lists the locator strategies that each server should support. Each locator must return the first matching element located in the DOM.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.findElementFromElement(elementId, using, value)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
using | string | the locator strategy to use |
value | string | the search target |
Returns
- <object>
ELEMENT
: A WebElement JSON object for the located element.
findElementsFromElement
Search for multiple elements on the page, starting from the identified element. The located elements will be returned as a WebElement JSON objects. The table below lists the locator strategies that each server should support. Elements should be returned in the order located in the DOM.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.findElementsFromElement(elementId, using, value)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
using | string | the locator strategy to use |
value | string | the search target |
Returns
- <object[]>
ELEMENTS
: A list of WebElement JSON objects for the located elements.
getActiveElement
Get the element on the page that currently has focus. The element will be returned as a WebElement JSON object.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getActiveElement()
Returns
- <String>
ELEMENT
: A WebElement JSON object for the active element.
isElementSelected
Determine if an OPTION
element, or an INPUT
element of type checkbox
or radiobutton
is currently selected.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.isElementSelected(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Boolean>
isSelected
: Whether the element is selected.
isElementDisplayed
Determine if an element is currently displayed.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.isElementDisplayed(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Boolean>
isDisplayed
: Whether the element is displayed.
getElementAttribute
Get the value of an element's attribute.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementAttribute(elementId, name)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
name | String | name of the attribute value to retrieve |
Returns
- <String|Null>
attribute
: The value of the attribute, or null if it is not set on the element.
getElementCSSValue
Query the value of an element's computed CSS property. The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color
instead of backgroundColor
).
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementCSSValue(elementId, propertyName)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
propertyName | String | name of the CSS property to retrieve |
Returns
- <String>
propertyName
: The value of the specified CSS property.
getElementText
Returns the visible text for the element.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementText(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <String>
text
: The visible text of the element.
getElementTagName
Query for an element's tag name.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementTagName(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <String>
tagName
: The element's tag name, as a lowercase string.
getElementLocation
Determine an element's location on the page. The point (0, 0)
refers to the upper-left corner of the page. The element's coordinates are returned as a JSON object with x
and y
properties.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementLocation(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Object>
location
: The X and Y coordinates for the element on the page.
getElementLocationInView
Determine an element's location on the screen once it has been scrolled into view.
Note: This is considered an internal command and should only be used to determine an element's location for correctly generating native events.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementLocationInView(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Object>
location
: The X and Y coordinates for the element on the page.
getElementSize
Determine an element's size in pixels. The size will be returned as a JSON object with width
and height
properties.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getElementSize(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Object>
size
: The width and height of the element, in pixels.
isElementEnabled
Determine if an element is currently enabled.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.isElementEnabled(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returns
- <Boolean>
isEnabled
: Whether the element is enabled.
elementClick
Click any mouse button (at the coordinates set by the last moveto command). Note that calling this command after calling buttondown and before calling button up (or any out-of-order interactions sequence) will yield undefined behaviour).
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.elementClick(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
elementEquals
Compare elements with each other.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.elementEquals(elementId, otherElementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
otherElementId | String | ID of the element to compare against |
Returns
- <Boolean>
isEqual
: Whether the two IDs refer to the same element.
elementSubmit
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.elementSubmit(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the form element to be submitted |
elementClear
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.elementClear(elementId)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
elementSendKeys
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.elementSendKeys(elementId, value)
Parameters
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
value | string[] | The sequence of keys to type. An array must be provided. |
sendKeys
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.sendKeys(value)
Parameters
Name | Type | Details |
---|---|---|
value | string[] | The sequence of keys to type. An array must be provided. |
getPageSource
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getPageSource()
Returns
- <String>
source
: The current page source.
executeScript
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.executeScript(script, args)
Parameters
Name | Type | Details |
---|---|---|
script | string | the script to execute |
args optional | string, object, number, boolean, undefined[] | the script arguments |
Returns
- <*>
result
: The script result.
executeAsyncScript
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.executeAsyncScript(script, args)
Parameters
Name | Type | Details |
---|---|---|
script | string | the script to execute |
args | string, object, number, boolean, undefined[] | the script arguments |
Returns
- <*>
result
: The script result.
getAllCookies
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getAllCookies()
Returns
- <Object[]>
cookies
: A list of cookies.
addCookie
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.addCookie(cookie)
Parameters
Name | Type | Details |
---|---|---|
cookie | object | A JSON object representing a cookie. It must have at least the name and value fields and could have more, including expiry-time and so on |
deleteAllCookies
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deleteAllCookies()
deleteCookie
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deleteCookie(name)
Parameters
Name | Type | Details |
---|---|---|
name | String | name of the cookie to retrieve |
dismissAlert
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.dismissAlert()
acceptAlert
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.acceptAlert()
getAlertText
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getAlertText()
Returns
- <String>
alertText
: The text of the currently displayed alert.
sendAlertText
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.sendAlertText(text)
Parameters
Name | Type | Details |
---|---|---|
text | string | keystrokes to send to the prompt() dialog |
takeScreenshot
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.takeScreenshot()
Returns
- <String>
screenshot
: screenshot as a base64 encoded PNG
getAvailableEngines
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getAvailableEngines()
Returns
- <String[]>
engines
: A list of available engines
getActiveEngine
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getActiveEngine()
Returns
- <String>
engine
: The name of the active IME engine
isIMEActivated
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.isIMEActivated()
Returns
- <Boolean>
isActive
: true if IME input is available and currently active, false otherwise
deactivateIME
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deactivateIME()
activateIME
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.activateIME(engine)
Parameters
Name | Type | Details |
---|---|---|
engine | string | name of the engine to activate |
getOrientation
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getOrientation()
Returns
- <String>
orientation
: The current browser orientation corresponding to a value defined in ScreenOrientation: {LANDSCAPE|PORTRAIT}.
setOrientation
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setOrientation(orientation)
Parameters
Name | Type | Details |
---|---|---|
orientation | string | the new browser orientation as defined in ScreenOrientation: {LANDSCAPE |
moveToElement
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.moveToElement(element, xoffset, yoffset)
Parameters
Name | Type | Details |
---|---|---|
element optional | string, null | opaque ID assigned to the element to move to, as described in the WebElement JSON Object, if not specified or is null, the offset is relative to current position of the mouse |
xoffset optional | number | x offset to move to, relative to the top-left corner of the element, if not specified, the mouse will move to the middle of the element |
yoffset optional | number | y offset to move to, relative to the top-left corner of the element, if not specified, the mouse will move to the middle of the element |
buttonDown
Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is buttonup . Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.buttonDown(button)
Parameters
Name | Type | Details |
---|---|---|
button optional | number | which button, enum: LEFT = 0, MIDDLE = 1 , RIGHT = 2, defaults to the left mouse button if not specified |
buttonUp
Releases the mouse button previously held (where the mouse is currently at). Must be called once for every buttondown command issued. See the note in click and buttondown about implications of out-of-order commands.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.buttonUp(button)
Parameters
Name | Type | Details |
---|---|---|
button optional | number | which button, enum: LEFT = 0, MIDDLE = 1 , RIGHT = 2, defaults to the left mouse button if not specified |
positionClick
Clicks at the current mouse coordinates (set by moveto).
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.positionClick(button)
Parameters
Name | Type | Details |
---|---|---|
button optional | number | which button, enum: LEFT = 0, RIGHT = 2, defaults to the left mouse button if not specified |
positionDoubleClick
Double-clicks at the current mouse coordinates (set by moveto).
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.positionDoubleClick()
touchClick
Single tap on the touch enabled device.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchClick(element)
Parameters
Name | Type | Details |
---|---|---|
element | string | ID of the element to single tap on. |
touchDown
Finger down on the screen.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchDown(x, y)
Parameters
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
touchUp
Finger up on the screen.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchUp(x, y)
Parameters
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
touchMove
Finger move on the screen.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchMove(x, y)
Parameters
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
touchScroll
Finger move on the screen.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchScroll(xoffset, yoffset, element)
Parameters
Name | Type | Details |
---|---|---|
xoffset | number | the x offset in pixels to scroll by |
yoffset | number | the y offset in pixels to scroll by |
element optional | string | ID of the element where the scroll starts |
touchDoubleClick
Double tap on the touch screen using finger motion events.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchDoubleClick(element)
Parameters
Name | Type | Details |
---|---|---|
element | string | ID of the element to double tap on |
touchLongClick
Long press on the touch screen using finger motion events.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchLongClick(element)
Parameters
Name | Type | Details |
---|---|---|
element | string | ID of the element to long press on |
touchFlick
Flick on the touch screen using finger motion events. This flickcommand starts at a particulat screen location.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.touchFlick(xoffset, yoffset, element, speed, xspeed, yspeed)
Parameters
Name | Type | Details |
---|---|---|
xoffset optional | number | the x offset in pixels to flick by |
yoffset optional | number | the y offset in pixels to flick by |
element optional | string | ID of the element where the flick starts |
speed optional | number | the speed in pixels per seconds |
xspeed optional | number | the x speed in pixels per second |
yspeed optional | number | the y speed in pixels per second |
getGeoLocation
Get the current geo location.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getGeoLocation()
Returns
- <Object>
location
: The current geo location.
setGeoLocation
Set the current geo location.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setGeoLocation(location)
Parameters
Name | Type | Details |
---|---|---|
location | object | the new location ({latitude: number, longitude: number, altitude: number} ) |
getLocalStorage
Get all keys of the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getLocalStorage()
Returns
- <String[]>
keys
: The list of keys.
setLocalStorage
Set the storage item for the given key.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setLocalStorage(key, value)
Parameters
Name | Type | Details |
---|---|---|
key | string | the key to set |
value | string | the value to set |
clearLocalStorage
Clear the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.clearLocalStorage()
getLocalStorageItem
Get the storage item for the given key.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getLocalStorageItem(key)
Parameters
Name | Type | Details |
---|---|---|
key | String | the key to get |
Returns
- <String>
item
: The storage item of given key.
deleteLocalStorageItem
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deleteLocalStorageItem(key)
Parameters
Name | Type | Details |
---|---|---|
key | String | the key to remove |
getLocalStorageSize
Get the number of items in the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getLocalStorageSize()
Returns
- <Number>
itemCnt
: The number of items in the storage.
getSessionStorage
Get all keys of the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getSessionStorage()
Returns
- <String[]>
keys
: The list of keys.
setSessionStorage
Set the storage item for the given key.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.setSessionStorage(key, value)
Parameters
Name | Type | Details |
---|---|---|
key | string | the key to set |
value | string | the value to set |
clearSessionStorage
Clear the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.clearSessionStorage()
getSessionStorageItem
Get the storage item for the given key.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getSessionStorageItem(key)
Parameters
Name | Type | Details |
---|---|---|
key | String | the key to get |
Returns
- <String>
item
: The storage item of given key.
deleteSessionStorageItem
Remove the storage item for the given key.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.deleteSessionStorageItem(key)
Parameters
Name | Type | Details |
---|---|---|
key | String | the key to remove |
getSessionStorageSize
Get the number of items in the storage.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getSessionStorageSize()
Returns
- <Number>
itemCnt
: The number of items in the storage.
getLogs
Get the log for a given log type. Log buffer is reset after each request.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getLogs(type)
Parameters
Name | Type | Details |
---|---|---|
type | string | the log type |
Returns
- <Object[]>
logs
: The list of log entries.
getLogTypes
Get available log types.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getLogTypes()
Returns
- <String[]>
logTypes
: The list of available log types.
getApplicationCacheStatus
Get the status of the html5 application cache.
JSON Wire Protocol command. More details can be found in the official protocol docs.
Usage
browser.getApplicationCacheStatus()
Returns
- <Number>
statusCode
: Status code for application cache:{UNCACHED = 0, IDLE = 1, CHECKING = 2, DOWNLOADING = 3, UPDATE_READY = 4, OBSOLETE = 5}