JsonWireProtocol wd
GET /status
Query the server's current status.
status(cb) -> cb(err, status)
POST /session
Create a new session.
init(desired, cb) -> cb(err, sessionID)
GET /sessions
Returns a list of the currently active sessions.
  • all sessions: sessions(cb) -> cb(err, sessions)
  • current session:
    altSessionCapabilities(cb) -> cb(err, capabilities)
GET /session/:sessionId
Retrieve the capabilities of the specified session.
sessionCapabilities(cb) -> cb(err, capabilities)
DELETE /session/:sessionId
Delete the session.
quit(cb) -> cb(err)
POST /session/:sessionId/timeouts
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.
  • configurable type: NA (but setImplicitWaitTimeout and setAsyncScriptTimeout do the same)
  • page load timeout:
    setPageLoadTimeout(ms, cb) -> cb(err)
POST /session/:sessionId/timeouts/async_script
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.
setAsyncScriptTimeout(ms, cb) -> cb(err)
POST /session/:sessionId/timeouts/implicit_wait
Set the amount of time the driver should wait when searching for elements.
setImplicitWaitTimeout(ms, cb) -> cb(err)
GET /session/:sessionId/window_handle
Retrieve the current window handle.
NA
GET /session/:sessionId/window_handles
Retrieve the list of all window handles available to the session.
NA
GET /session/:sessionId/url
Retrieve the URL of the current page.
url(cb) -> cb(err, url)
POST /session/:sessionId/url
Navigate to a new URL.
get(url,cb) -> cb(err)
POST /session/:sessionId/forward
Navigate forwards in the browser history, if possible.
forward(cb) -> cb(err)
POST /session/:sessionId/back
Navigate backwards in the browser history, if possible.
back(cb) -> cb(err)
POST /session/:sessionId/refresh
Refresh the current page.
refresh(cb) -> cb(err)
POST /session/:sessionId/execute
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
  • execute script:
    execute(code, args, cb) -> cb(err, value returned)
    • args is an optional Array
  • execute script within try/catch using eval(code):
    safeExecute(code, args, cb) -> cb(err, value returned)
    • args is an optional Array
  • evaluate expression (using execute):
    eval(code, cb) -> cb(err, value)
  • evaluate expression (using safeExecute):
    safeEval(code, cb) -> cb(err, value)
POST /session/:sessionId/execute_async
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
  • execute async script:
    executeAsync(code, args, cb) -> cb(err, value returned)
    • args is an optional Array
  • execute async script within try/catch using eval(code):
    safeExecuteAsync(code, args, cb) -> cb(err, value returned)
    • args is an optional Array
GET /session/:sessionId/screenshot
Take a screenshot of the current page.
NA
GET /session/:sessionId/ime/available_engines
List all available engines on the machine.
NA
GET /session/:sessionId/ime/active_engine
Get the name of the active IME engine.
NA
GET /session/:sessionId/ime/activated
Indicates whether IME input is active at the moment (not if it's available.
NA
POST /session/:sessionId/ime/deactivate
De-activates the currently-active IME engine.
NA
POST /session/:sessionId/ime/activate
Make an engines that is available (appears on the listreturned by getAvailableEngines) active.
NA
POST /session/:sessionId/frame
Change focus to another frame on the page.
NA
POST /session/:sessionId/window
Change focus to another window.
NA
DELETE /session/:sessionId/window
Close the current window.
close(cb) -> cb(err)
POST /session/:sessionId/window/:windowHandle/size
Change the size of the specified window.
NA
GET /session/:sessionId/window/:windowHandle/size
Get the size of the specified window.
NA
POST /session/:sessionId/window/:windowHandle/position
Change the position of the specified window.
NA
GET /session/:sessionId/window/:windowHandle/position
Get the position of the specified window.
NA
POST /session/:sessionId/window/:windowHandle/maximize
Maximize the specified window if not already maximized.
NA
GET /session/:sessionId/cookie
Retrieve all cookies visible to the current page.
allCookies() -> cb(err, cookies)
POST /session/:sessionId/cookie
Set a cookie.
setCookie(cookie, cb) -> cb(err)
DELETE /session/:sessionId/cookie
Delete all cookies visible to the current page.
deleteAllCookies(cb) -> cb(err)
DELETE /session/:sessionId/cookie/:name
Delete the cookie with the given name.
deleteCookie(name, cb) -> cb(err)
GET /session/:sessionId/source
Get the current page source.
NA
GET /session/:sessionId/title
Get the current page title.
title(cb) -> cb(err, title)
POST /session/:sessionId/element
Search for an element on the page, starting from the document root.
  • element(using, value, cb) -> cb(err, element)
  • elementsuffix(value, cb) -> cb(err, element)
    suffix: ByClassName, ByCssSelector, ById, ByName, ByLinkText, ByPartialLinkText, ByTagName, ByXPath, ByCss
  • see also hasElement, hasElementsuffix, elementOrNull, elementsuffixOrNull, elementIfExists, elementsuffixIfExists, in the elements section.
POST /session/:sessionId/elements
Search for multiple elements on the page, starting from the document root.
  • elements(using, value, cb) -> cb(err, elements)
  • elementssuffix(value, cb) -> cb(err, elements)
    suffix: ByClassName, ByCssSelector, ById, ByName, ByLinkText, ByPartialLinkText, ByTagName, ByXPath, ByCss
  • hasElement(using, value, cb) -> cb(err, boolean)
  • hasElementsuffix(value, cb) -> cb(err, boolean)
    suffix: ByClassName, ByCssSelector, ById, ByName, ByLinkText, ByPartialLinkText, ByTagName, ByXPath, ByCss
  • elementOrNull(using, value, cb) -> cb(err, element)
    (avoids not found error throw and returns null instead)
  • elementsuffixOrNull(value, cb) -> cb(err, element)
    (avoids not found error throw and returns null instead)
    suffix: ByClassName, ByCssSelector, ById, ByName, ByLinkText, ByPartialLinkText, ByTagName, ByXPath, ByCss
  • elementIfExists(using, value, cb) -> cb(err, element)
    (avoids not found error throw and returns undefined instead)
  • elementsuffixIfExists(value, cb) -> cb(err, element)
    (avoids not found error throw and returns undefined instead)
    suffix: ByClassName, ByCssSelector, ById, ByName, ByLinkText, ByPartialLinkText, ByTagName, ByXPath, ByCss
POST /session/:sessionId/element/active
Get the element on the page that currently has focus.
active(cb) -> cb(err, element)
GET /session/:sessionId/element/:id
Describe the identified element.
NA
POST /session/:sessionId/element/:id/element
Search for an element on the page, starting from the identified element.
NA
POST /session/:sessionId/element/:id/elements
Search for multiple elements on the page, starting from the identified element.
NA
POST /session/:sessionId/element/:id/click
Click on an element.
clickElement(element, cb) -> cb(err)
POST /session/:sessionId/element/:id/submit
Submit a FORM element.
NA
GET /session/:sessionId/element/:id/text
Returns the visible text for the element.
  • text(element, cb) -> (err, text)
  • textPresent(searchText, element, cb) -> (err, boolean)
POST /session/:sessionId/element/:id/value
Send a sequence of key strokes to an element.
  • type(element, keys, cb) -> cb(err)
  • special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
POST /session/:sessionId/keys
Send a sequence of key strokes to the active element.
  • keys(keys, cb) -> cb(err)
  • special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
GET /session/:sessionId/element/:id/name
Query for an element's tag name.
NA
POST /session/:sessionId/element/:id/clear
Clear a TEXTAREA or text INPUT element's value.
clear(element, cb) -> cb(err)
GET /session/:sessionId/element/:id/selected Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected.
NA
GET /session/:sessionId/element/:id/enabled
Determine if an element is currently enabled.
NA
GET /session/:sessionId/element/:id/attribute/:name
Get the value of an element's attribute.
  • getAttribute(element, attrName, cb) -> cb(err, value)
  • getValue(element, cb) -> cb(err, value)
GET /session/:sessionId/element/:id/equals/:other
Test if two element IDs refer to the same DOM element.
NA
GET /session/:sessionId/element/:id/displayed
Determine if an element is currently displayed.
NA
GET /session/:sessionId/element/:id/location
Determine an element's location on the page.
NA
GET /session/:sessionId/element/:id/location_in_view
Determine an element's location on the screen once it has been scrolled into view.
NA
GET /session/:sessionId/element/:id/size
Determine an element's size in pixels.
NA
GET /session/:sessionId/element/:id/css/:propertyName
Query the value of an element's computed CSS property.
NA
GET /session/:sessionId/orientation
Get the current browser orientation.
NA
POST /session/:sessionId/orientation
Set the browser orientation.
NA
GET /session/:sessionId/alert_text
Gets the text of the currently displayed JavaScript alert(), confirm(), or prompt() dialog.
NA
POST /session/:sessionId/alert_text
Sends keystrokes to a JavaScript prompt() dialog.
NA
POST /session/:sessionId/accept_alert
Accepts the currently displayed alert dialog.
acceptAlert(cb) -> cb(err)
POST /session/:sessionId/dismiss_alert
Dismisses the currently displayed alert dialog.
dismissAlert(cb) -> cb(err)
POST /session/:sessionId/moveto
Move the mouse by an offset of the specificed element.
moveTo(element, xoffset, yoffset, cb) -> cb(err)
POST /session/:sessionId/click
Click any mouse button (at the coordinates set by the last moveto command).
click(button, cb) -> cb(err)
buttons: {left: 0, middle: 1 , right: 2}
POST /session/:sessionId/buttondown
Click and hold the left mouse button (at the coordinates set by the last moveto command).
buttonDown(cb) -> cb(err)
POST /session/:sessionId/buttonup
Releases the mouse button previously held (where the mouse is currently at).
buttonUp(cb) -> cb(err)
POST /session/:sessionId/doubleclick
Double-clicks at the current mouse coordinates (set by moveto).
doubleclick(cb) -> cb(err)
POST /session/:sessionId/touch/click
Single tap on the touch enabled device.
NA
POST /session/:sessionId/touch/down
Finger down on the screen.
NA
POST /session/:sessionId/touch/up
Finger up on the screen.
NA
POST session/:sessionId/touch/move
Finger move on the screen.
NA
POST session/:sessionId/touch/scroll
Scroll on the touch screen using finger based motion events.
NA
POST session/:sessionId/touch/scroll
Scroll on the touch screen using finger based motion events.
NA
POST session/:sessionId/touch/doubleclick
Double tap on the touch screen using finger motion events.
NA
POST session/:sessionId/touch/longclick
Long press on the touch screen using finger motion events.
NA
POST session/:sessionId/touch/flick
Flick on the touch screen using finger motion events.
NA
POST session/:sessionId/touch/flick
Flick on the touch screen using finger motion events.
NA
GET /session/:sessionId/location
Get the current geo location.
NA
POST /session/:sessionId/location
Set the current geo location.
NA
GET /session/:sessionId/local_storage
Get all keys of the storage.
NA
POST /session/:sessionId/local_storage
Set the storage item for the given key.
NA
DELETE /session/:sessionId/local_storage
Clear the storage.
NA
GET /session/:sessionId/local_storage/key/:key
Get the storage item for the given key.
NA
DELETE /session/:sessionId/local_storage/key/:key
Remove the storage item for the given key.
NA
GET /session/:sessionId/local_storage/size
Get the number of items in the storage.
NA
GET /session/:sessionId/session_storage
Get all keys of the storage.
NA
POST /session/:sessionId/session_storage
Set the storage item for the given key.
NA
DELETE /session/:sessionId/session_storage
Clear the storage.
NA
GET /session/:sessionId/session_storage/key/:key
Get the storage item for the given key.
NA
DELETE /session/:sessionId/session_storage/key/:key
Remove the storage item for the given key.
NA
GET /session/:sessionId/session_storage/size
Get the number of items in the storage.
NA
EXTRA: waitForCondition
Waits for JavaScript condition to be true (polling within wd client).
waitForCondition(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
  • conditionExpr should return a boolean
  • timeout and pollFreq are optional (default: 1000, 100).
  • return true if condition satisfied, error otherwise.
EXTRA: waitForConditionInBrowser
Waits for JavaScript condition to be true. (async script polling within browser)
waitForConditionInBrowser(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
  • setAsyncScriptTimeout must be set to value higher than timeout
  • conditionExpr should return a boolean
  • timeout and pollFreq are optional (default: 1000, 100).
  • return true if condition satisfied, error otherwise.