category / JsonWireProtocol method | wd methods |
GET /status Query the server's current status. |
status() -> status |
POST /session Create a new session. |
init(desired) -> sessionID, capabilities Initialize the browser. capabilities return may be absent, depending on driver. |
GET /sessions Returns a list of the currently active sessions. |
sessions() -> sessions
Alternate strategy to get session capabilities from server session list: |
GET /session/:sessionId Retrieve the capabilities of the specified session. |
sessionCapabilities() -> capabilities |
DELETE /session/:sessionId Delete the session. |
quit() Destroy the browser. |
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. |
setPageLoadTimeout(ms) (use setImplicitWaitTimeout and setAsyncScriptTimeout to set the other timeouts) |
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) |
POST /session/:sessionId/timeouts/implicit_wait Set the amount of time the driver should wait when searching for elements. |
setImplicitWaitTimeout(ms) |
GET /session/:sessionId/window_handle Retrieve the current window handle. |
windowHandle() -> handle |
GET /session/:sessionId/window_handles Retrieve the list of all window handles available to the session. |
windowHandles() -> arrayOfHandles |
GET /session/:sessionId/url Retrieve the URL of the current page. |
url() -> url |
POST /session/:sessionId/url Navigate to a new URL. |
get(url) Get a new url. |
POST /session/:sessionId/forward Navigate forwards in the browser history, if possible. |
forward() |
POST /session/:sessionId/back Navigate backwards in the browser history, if possible. |
back() |
POST /session/:sessionId/refresh Refresh the current page. |
refresh() |
POST /session/:sessionId/execute Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. |
execute(code, args) -> result
Safely execute script within an eval block, always returning:
Evaluate expression (using execute):
Safely evaluate expression, always returning (using safeExecute): |
POST /session/:sessionId/execute_async Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. |
executeAsync(code, args) -> result
Safely execute async script within an eval block, always returning: |
GET /session/:sessionId/screenshot Take a screenshot of the current page. |
takeScreenshot() -> screenshot |
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. |
frame(frameRef) |
POST /session/:sessionId/window Change focus to another window. |
window(name) |
DELETE /session/:sessionId/window Close the current window. |
close() |
POST /session/:sessionId/window/:windowHandle/size Change the size of the specified window. |
windowSize(handle, width, height)
setWindowSize(width, height, handle) |
GET /session/:sessionId/window/:windowHandle/size Get the size of the specified window. |
getWindowSize(handle) -> size getWindowSize() -> size handle: window handle to get size (optional, default: 'current') |
POST /session/:sessionId/window/:windowHandle/position Change the position of the specified window. |
setWindowPosition(x, y, handle) setWindowPosition(x, y) x: the x-coordinate in pixels to set the window position y: the y-coordinate in pixels to set the window position handle: window handle to set position for (optional, default: 'current') |
GET /session/:sessionId/window/:windowHandle/position Get the position of the specified window. |
getWindowPosition(handle) -> position getWindowPosition() -> position handle: window handle to get position (optional, default: 'current') |
POST /session/:sessionId/window/:windowHandle/maximize Maximize the specified window if not already maximized. |
maximize(handle) |
GET /session/:sessionId/cookie Retrieve all cookies visible to the current page. |
allCookies() -> cookies |
POST /session/:sessionId/cookie Set a cookie. |
setCookie(cookie) cookie example: {name:'fruit', value:'apple'} Optional cookie fields: path, domain, secure, expiry |
DELETE /session/:sessionId/cookie Delete all cookies visible to the current page. |
deleteAllCookies() |
DELETE /session/:sessionId/cookie/:name Delete the cookie with the given name. |
deleteCookie(name) |
GET /session/:sessionId/source Get the current page source. |
source() -> source |
GET /session/:sessionId/title Get the current page title. |
title() -> title |
POST /session/:sessionId/element Search for an element on the page, starting from the document root. |
element(using, value) -> element
elementByClassName(value) -> element |
POST /session/:sessionId/elements Search for multiple elements on the page, starting from the document root. |
elements(using, value) -> elements
elementsByClassName(value) -> elements
Retrieve an element avoiding not found exception and returning null instead:
elementByClassNameOrNull(value) -> element
Retrieve an element avoiding not found exception and returning undefined instead:
elementByClassNameIfExists(value) -> element
Check if element exists:
hasElementByClassName(value) -> boolean |
POST /session/:sessionId/element/active Get the element on the page that currently has focus. |
active() -> 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. |
element.element(using, value) -> element
element.elementByClassName(value) -> element |
POST /session/:sessionId/element/:id/elements Search for multiple elements on the page, starting from the identified element. |
element.elements(using, value) -> elements
element.elementsByClassName(value) -> elements |
POST /session/:sessionId/element/:id/click Click on an element. |
clickElement(element)
element.click() |
POST /session/:sessionId/element/:id/submit Submit a FORM element. |
submit(element)
element.submit() |
GET /session/:sessionId/element/:id/text Returns the visible text for the element. |
text(element) -> text
element.text() -> text
Check if text is present:
element.textPresent(searchText) -> boolean |
POST /session/:sessionId/element/:id/value Send a sequence of key strokes to an element. |
type(element, keys)
element.type(keys)
element.keys(keys) |
POST /session/:sessionId/keys Send a sequence of key strokes to the active element. |
keys(keys) Press keys (keys may still be down at the end of command). special key map: wd.SPECIAL_KEYS (see lib/special-keys.js) |
GET /session/:sessionId/element/:id/name Query for an element's tag name. |
getTagName(element) -> name
element.getTagName() -> name |
POST /session/:sessionId/element/:id/clear Clear a TEXTAREA or text INPUT element's value. |
clear(element)
element.clear() |
GET /session/:sessionId/element/:id/selected Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected. |
isSelected(element) -> selected
element.isSelected() -> selected |
GET /session/:sessionId/element/:id/enabled Determine if an element is currently enabled. |
isEnabled(element) -> enabled
element.isEnabled() -> enabled |
GET /session/:sessionId/element/:id/attribute/:name Get the value of an element's attribute. |
getAttribute(element, attrName) -> value
element.getAttribute(attrName) -> value
Get element value (in value attribute):
element.getValue() -> value |
GET /session/:sessionId/element/:id/equals/:other Test if two element IDs refer to the same DOM element. |
element.equals(other) -> value
equalsElement(element, other ) -> value |
GET /session/:sessionId/element/:id/displayed Determine if an element is currently displayed. |
isDisplayed(element) -> displayed
element.isDisplayed() -> displayed |
GET /session/:sessionId/element/:id/location Determine an element's location on the page. |
getLocation(element) -> location
element.getLocation() -> location
element.getLocationInView() -> location |
GET /session/:sessionId/element/:id/location_in_view Determine an element's location on the screen once it has been scrolled into view. |
getLocationInView(element) -> location |
GET /session/:sessionId/element/:id/size Determine an element's size in pixels. |
getSize(element) -> size
element.getSize() -> size |
GET /session/:sessionId/element/:id/css/:propertyName Query the value of an element's computed CSS property. |
getComputedCss(element, cssProperty ) -> value
element.getComputedCss(cssProperty ) -> value
element.getComputedCss(cssProperty ) -> value |
GET /session/:sessionId/orientation Get the current browser orientation. |
getOrientation() -> orientation |
POST /session/:sessionId/orientation Set the browser orientation. |
setOrientation() -> orientation |
GET /session/:sessionId/alert_text Gets the text of the currently displayed JavaScript alert(), confirm(), or prompt() dialog. |
alertText() -> text |
POST /session/:sessionId/alert_text Sends keystrokes to a JavaScript prompt() dialog. |
alertKeys(keys) |
POST /session/:sessionId/accept_alert Accepts the currently displayed alert dialog. |
acceptAlert() |
POST /session/:sessionId/dismiss_alert Dismisses the currently displayed alert dialog. |
dismissAlert() |
POST /session/:sessionId/moveto Move the mouse by an offset of the specificed element. |
moveTo(element, xoffset, yoffset)
element.moveTo(xoffset, yoffset) |
POST /session/:sessionId/click Click any mouse button (at the coordinates set by the last moveto command). |
click(button) Click on current element. 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(button ) button is optional. {LEFT = 0, MIDDLE = 1 , RIGHT = 2}. LEFT if not specified. |
POST /session/:sessionId/buttonup Releases the mouse button previously held (where the mouse is currently at). |
buttonUp(button) button is optional. {LEFT = 0, MIDDLE = 1 , RIGHT = 2}. LEFT if not specified. |
POST /session/:sessionId/doubleclick Double-clicks at the current mouse coordinates (set by moveto). |
doubleclick()
element.doubleClick() |
POST /session/:sessionId/touch/click Single tap on the touch enabled device. |
tap()
element.tap() |
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/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. |
flick(xSpeed, ySpeed, swipe)
element.flick(xoffset, yoffset, speed) |
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. |
setLocalStorageKey(key, value) # uses safeExecute() due to localStorage bug in Selenium |
DELETE /session/:sessionId/local_storage Clear the storage. |
clearLocalStorage() # uses safeExecute() due to localStorage bug in Selenium |
GET /session/:sessionId/local_storage/key/:key Get the storage item for the given key. |
getLocalStorageKey(key) # uses safeEval() due to localStorage bug in Selenium |
DELETE /session/:sessionId/local_storage/key/:key Remove the storage item for the given key. |
removeLocalStorageKey(key) # uses safeExecute() due to localStorage bug in Selenium |
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 |
POST /session/:sessionId/log Get the log for a given log type. |
log(logType) -> arrayOfLogs |
GET /session/:sessionId/log/types Get available log types. |
logTypes() -> arrayOfLogTypes |
GET /session/:sessionId/application_cache/status Get the status of the html5 application cache. |
NA |
extra |
Retrieves the current session id. getSessionId() -> sessionId getSessionId() |
extra |
Opens a new window (using Javascript window.open): newWindow(url, name) newWindow(url) name: optional window name Window can later be accessed by name with the window method, or by getting the last handle returned by the windowHandles method. |
extra |
windowName() -> name |
extra |
configureHttp(opts) opts example: {timeout:60000, retries: 3, 'retryDelay': 15, baseUrl='http://example.com/'} more info in README. |
extra |
waitFor(asserter, timeout, pollFreq) -> return_value timeout and pollFreq are optional (default 1000ms/200ms) waitFor(opts) opts with the following fields: timeout, pollFreq, asserter. asserter like: function(browser ) -> satisfied, return_value |
extra |
waitForElement(using, value, asserter, timeout, pollFreq) waitForElement(using, value, timeout, pollFreq) timeout and pollFreq are optional (default 1000ms/200ms) waitForElement(using, value, opts) opts with the following fields: timeout, pollFreq, asserter. asserter like: function(element ) -> satisfied |
extra |
saveScreenshot(path) -> filePath path maybe a full file path, a directory path (finishing with /), the screenshot name, or left blank (will create a file in the system temp dir). |
extra |
waitForElementByClassName(value, asserter, timeout, pollFreq) waitForElementByCssSelector(value, asserter, timeout, pollFreq) waitForElementById(value, asserter, timeout, pollFreq) waitForElementByName(value, asserter, timeout, pollFreq) waitForElementByLinkText(value, asserter, timeout, pollFreq) waitForElementByPartialLinkText(value, asserter, timeout, pollFreq) waitForElementByTagName(value, asserter, timeout, pollFreq) waitForElementByXPath(value, asserter, timeout, pollFreq) waitForElementByCss(value, asserter, timeout, pollFreq) asserter, timeout, pollFreq are optional, opts may be passed instead, as in waitForElement. |
extra |
waitForVisibleByClassName(value, timeout) waitForVisibleByCssSelector(value, timeout) waitForVisibleById(value, timeout) waitForVisibleByName(value, timeout) waitForVisibleByLinkText(value, timeout) waitForVisibleByPartialLinkText(value, timeout) waitForVisibleByTagName(value, timeout) waitForVisibleByXPath(value, timeout) waitForVisibleByCss(value, timeout) |
extra |
isVisible(element ) -> boolean isVisible(queryType, querySelector) -> boolean |
extra |
Retrieves the pageIndex element (added for Appium): getPageIndex(element) -> pageIndex |
extra |
Uploads a local file using undocumented POST /session/:sessionId/file uploadFile(filepath) -> filepath |
extra |
Waits for JavaScript condition to be true (polling within wd client): waitForJsCondition(jsConditionExpr, timeout, pollFreq) -> boolean timeout and pollFreq optional, default are 1000/200 jsConditionExpr: condition expression, should return a boolean return true if condition satisfied, error otherwise. |
extra |
Waits for JavaScript condition to be true (async script polling within browser): waitForConditionInBrowser(conditionExpr, timeout, pollFreq) -> boolean conditionExpr: condition expression, should return a boolean timeout and pollFreq are optional, default: 1000/100. return true if condition satisfied, error otherwise. |
extra |
sauceJobUpdate(jsonData) |
extra |
sauceJobStatus(hasPassed) |
extra |
sleep(ms) |
extra |
noop() |
extra |
Equivalent to the python sendKeys binding. Upload file if a local file is detected, otherwise behaves like type. element.sendKeys(keys) |
extra |
isVisible() -> boolean |
extra |
element.sleep(ms) |
extra |
element.noop() |