Members

(constant, non-null) Atom :function

Type:
  • function
Properties
NameTypeDescription
GET_ATTRIBUTEfunction
IS_DISPLAYEDfunction
FIND_ELEMENTSfunction

(constant) Browser :string

Recognized browser names.

Type:
  • string
Properties
NameTypeDescription
CHROMEstring
EDGEstring
FIREFOXstring
INTERNET_EXPLORERstring
SAFARIstring

(constant) Button :number

Enumeration of the buttons used in the advanced interactions API.

Type:
  • number
Properties
NameTypeDescription
LEFTnumber
MIDDLEnumber
RIGHTnumber
BACKnumber
FORWARDnumber

(constant) Capability :string

The standard WebDriver capability keys.

Type:
  • string
Properties
NameTypeDescription
ACCEPT_INSECURE_TLS_CERTSstring

Indicates whether a WebDriver session implicitly trusts otherwise untrusted and self-signed TLS certificates during navigation.

BROWSER_NAMEstring

The browser name. Common browser names are defined in the Browser enum.

BROWSER_VERSIONstring

Identifies the browser version.

LOGGING_PREFSstring

Key for the logging driver logging preferences. The browser name. Common browser names are defined in the Browser enum.

PAGE_LOAD_STRATEGYstring

Defines the session's page loading strategy.

PLATFORM_NAMEstring

Identifies the operating system of the endpoint node. Common values recognized by the most WebDriver server implementations are predefined in the Platform enum.

PROXYstring

Describes the proxy configuration to use for a new WebDriver session.

SET_WINDOW_RECTstring

Indicates whether the remote end supports all of the window resizing and positioning commands:

  • Window.getRect()
  • Window.setRect()
  • Window.maximize()
  • Window.minimize()
  • Window.fullscreen()
TIMEOUTSstring

Describes the timeouts imposed on certain session operations.

UNHANDLED_PROMPT_BEHAVIORstring

Defines how a WebDriver session should respond to unhandled user prompts.

STRICT_FILE_INTERACTABILITYstring

Defines the current session’s strict file interactability. Used to upload a file when strict file interactability is on

ENABLE_DOWNLOADSstring

(constant) Config

(constant) ErrorCode :number

Enum of legacy error codes. TODO: remove this when all code paths have been switched to the new error types.

Type:
  • number
Properties
NameTypeDescription
SUCCESSnumber
NO_SUCH_SESSIONnumber
NO_SUCH_ELEMENTnumber
NO_SUCH_FRAMEnumber
UNKNOWN_COMMANDnumber
UNSUPPORTED_OPERATIONnumber
STALE_ELEMENT_REFERENCEnumber
ELEMENT_NOT_VISIBLEnumber
INVALID_ELEMENT_STATEnumber
UNKNOWN_ERRORnumber
ELEMENT_NOT_SELECTABLEnumber
JAVASCRIPT_ERRORnumber
XPATH_LOOKUP_ERRORnumber
TIMEOUTnumber
NO_SUCH_WINDOWnumber
INVALID_COOKIE_DOMAINnumber
UNABLE_TO_SET_COOKIEnumber
UNEXPECTED_ALERT_OPENnumber
NO_SUCH_ALERTnumber
SCRIPT_TIMEOUTnumber
INVALID_ELEMENT_COORDINATESnumber
IME_NOT_AVAILABLEnumber
IME_ENGINE_ACTIVATION_FAILEDnumber
INVALID_SELECTOR_ERRORnumber
SESSION_NOT_CREATEDnumber
MOVE_TARGET_OUT_OF_BOUNDSnumber
SQL_DATABASE_ERRORnumber
INVALID_XPATH_SELECTORnumber
INVALID_XPATH_SELECTOR_RETURN_TYPEnumber
ELEMENT_NOT_INTERACTABLEnumber
INVALID_ARGUMENTnumber
NO_SUCH_COOKIEnumber
UNABLE_TO_CAPTURE_SCREENnumber
ELEMENT_CLICK_INTERCEPTEDnumber
METHOD_NOT_ALLOWEDnumber
Deprecated
  • Yes

(constant) EvaluateResultType :string

Represents the type of script evaluation result. Described in https://w3c.github.io/webdriver-bidi/#type-script-EvaluateResult.

Type:
  • string
Properties
NameTypeDescription
SUCCESSstring
EXCEPTIONstring

(package, constant) INTERNAL_COMPUTE_OFFSET_SCRIPT

Script used to compute the offset from the center of a DOM element's first client rect from the top-left corner of the element's bounding client rect. The element's center point is computed using the algorithm defined here: https://w3c.github.io/webdriver/webdriver-spec.html#dfn-center-point.

This is only exported for use in internal unit tests. DO NOT USE.

(constant) InterceptPhase :string

Represents the different phases of intercepting network requests and responses.

Type:
  • string
Properties
NameTypeDescription
BEFORE_REQUEST_SENTstring
RESPONSE_STARTEDstring
AUTH_REQUIREDstring

(constant) Key :string

Representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to http://www.google.com.au/search?&q=unicode+pua&btnK=Search

Type:
  • string
Properties
NameTypeDescription
NULLstring
CANCELstring
HELPstring
BACK_SPACEstring
TABstring
CLEARstring
RETURNstring
ENTERstring
SHIFTstring
CONTROLstring
ALTstring
PAUSEstring
ESCAPEstring
SPACEstring
PAGE_UPstring
PAGE_DOWNstring
ENDstring
HOMEstring
ARROW_LEFTstring
LEFTstring
ARROW_UPstring
UPstring
ARROW_RIGHTstring
RIGHTstring
ARROW_DOWNstring
DOWNstring
INSERTstring
DELETEstring
SEMICOLONstring
EQUALSstring
NUMPAD0string
NUMPAD1string
NUMPAD2string
NUMPAD3string
NUMPAD4string
NUMPAD5string
NUMPAD6string
NUMPAD7string
NUMPAD8string
NUMPAD9string
MULTIPLYstring
ADDstring
SEPARATORstring
SUBTRACTstring
DECIMALstring
DIVIDEstring
F1string
F2string
F3string
F4string
F5string
F6string
F7string
F8string
F9string
F10string
F11string
F12string
COMMANDstring
METAstring
ZENKAKU_HANKAKUstring

Japanese modifier key for switching between full- and half-width characters.

(constant) ManualConfig

(constant) Name :string

Enumeration of predefined names command names that all command processors will support.

Type:
  • string
Properties
NameTypeDescription
GET_SERVER_STATUSstring
NEW_SESSIONstring
GET_SESSIONSstring
CLOSEstring
QUITstring
GET_CURRENT_URLstring
GETstring
GO_BACKstring
GO_FORWARDstring
REFRESHstring
ADD_COOKIEstring
GET_COOKIEstring
GET_ALL_COOKIESstring
DELETE_COOKIEstring
DELETE_ALL_COOKIESstring
GET_ACTIVE_ELEMENTstring
FIND_ELEMENTstring
FIND_ELEMENTSstring
FIND_ELEMENTS_RELATIVEstring
FIND_CHILD_ELEMENTstring
FIND_CHILD_ELEMENTSstring
CLEAR_ELEMENTstring
CLICK_ELEMENTstring
SEND_KEYS_TO_ELEMENTstring
GET_CURRENT_WINDOW_HANDLEstring
GET_WINDOW_HANDLESstring
GET_WINDOW_RECTstring
SET_WINDOW_RECTstring
MAXIMIZE_WINDOWstring
MINIMIZE_WINDOWstring
FULLSCREEN_WINDOWstring
SWITCH_TO_WINDOWstring
SWITCH_TO_NEW_WINDOWstring
SWITCH_TO_FRAMEstring
SWITCH_TO_FRAME_PARENTstring
GET_PAGE_SOURCEstring
GET_TITLEstring
EXECUTE_SCRIPTstring
EXECUTE_ASYNC_SCRIPTstring
GET_ELEMENT_TEXTstring
GET_COMPUTED_ROLEstring
GET_COMPUTED_LABELstring
GET_ELEMENT_TAG_NAMEstring
IS_ELEMENT_SELECTEDstring
IS_ELEMENT_ENABLEDstring
IS_ELEMENT_DISPLAYEDstring
GET_ELEMENT_RECTstring
GET_ELEMENT_ATTRIBUTEstring
GET_DOM_ATTRIBUTEstring
GET_ELEMENT_VALUE_OF_CSS_PROPERTYstring
GET_ELEMENT_PROPERTYstring
SCREENSHOTstring
TAKE_ELEMENT_SCREENSHOTstring
PRINT_PAGEstring
GET_TIMEOUTstring
SET_TIMEOUTstring
ACCEPT_ALERTstring
DISMISS_ALERTstring
GET_ALERT_TEXTstring
SET_ALERT_TEXTstring
GET_SHADOW_ROOTstring
FIND_ELEMENT_FROM_SHADOWROOTstring
FIND_ELEMENTS_FROM_SHADOWROOTstring
ADD_VIRTUAL_AUTHENTICATORstring
REMOVE_VIRTUAL_AUTHENTICATORstring
ADD_CREDENTIALstring
GET_CREDENTIALSstring
REMOVE_CREDENTIALstring
REMOVE_ALL_CREDENTIALSstring
SET_USER_VERIFIEDstring
GET_AVAILABLE_LOG_TYPESstring
GET_LOGstring
UPLOAD_FILEstring
ACTIONSstring
CLEAR_ACTIONSstring
GET_DOWNLOADABLE_FILESstring
DOWNLOAD_FILEstring
DELETE_DOWNLOADABLE_FILESstring

(constant) NonPrimitiveType

Represents a non-primitive type.

Properties
NameTypeDescription
ARRAY
DATE
MAP
OBJECT
REGULAR_EXPRESSION
SET
CHANNEL
findByName

(constant) Origin :string

Defines the reference point from which to compute offsets for capturing screenshot.

Type:
  • string
Properties
NameTypeDescription
VIEWPORTstring
DOCUMENTstring

(constant) Origin :string

Defines the reference point from which to compute offsets for pointer move actions.

Type:
  • string
Properties
NameTypeDescription
POINTERstring

Compute offsets relative to the pointer's current position.

VIEWPORTstring

Compute offsets relative to the viewport.

(constant) PacConfig

(constant) PageLoadStrategy :string

Strategies for waiting for document readiness after a navigation event.

Type:
  • string
Properties
NameTypeDescription
NONEstring

Indicates WebDriver should not wait on the document readiness state after a navigation event.

EAGERstring

Indicates WebDriver should wait for the document readiness state to become "interactive" after navigation.

NORMALstring

Indicates WebDriver should wait for the document readiness state to be "complete" after navigation. This is the default page loading strategy.

(constant) Platform :string

Common platform names. These platforms are not explicitly defined by the WebDriver spec, however, their use is encouraged for interoperability.

Type:
  • string
Properties
NameTypeDescription
LINUXstring
MACstring
WINDOWSstring

(constant) PrimitiveType

Represents a primitive type.

Properties
NameTypeDescription
UNDEFINED
NULL
STRING
NUMBER
SPECIAL_NUMBER
BOOLEAN
BIGINT
findByName

(constant) Protocol :string

Protocol for virtual authenticators

Type:
  • string
Properties
NameTypeDescription
CTAP2string
U2Fstring

(constant) RealmType

Represents the types of realms. Described in https://w3c.github.io/webdriver-bidi/#type-script-RealmType.

Properties
NameTypeDescription
AUDIO_WORKLET
DEDICATED_WORKER
PAINT_WORKLET
SERVICE_WORKED
SHARED_WORKED
WINDOW
WORKER
WORKLET
findByName

(constant) RemoteReferenceType :string

Represents the types of remote reference.

Type:
  • string
Properties
NameTypeDescription
HANDLEstring
SHARED_IDstring

(constant) RemoteType

Represents a remote value type.

Properties
NameTypeDescription
SYMBOL
FUNCTION
WEAK_MAP
WEAK_SET
ITERATOR
GENERATOR
ERROR
PROXY
PROMISE
TYPED_ARRAY
ARRAY_BUFFER
NODE_LIST
HTML_COLLECTION
NODE
WINDOW
findByName

(constant) ResultOwnership :string

Enum representing the ownership types.

Type:
  • string
Properties
NameTypeDescription
ROOTstring
NONEstring

(constant) SameSite :string

Represents the possible values for the SameSite attribute of a cookie.

Type:
  • string
Properties
NameTypeDescription
STRICTstring
LAXstring
NONEstring
findByNamestring

(constant) SpecialNumberType

Represents a speacial number type.

Properties
NameTypeDescription
NAN
MINUS_ZERO
INFINITY
MINUS_INFINITY

(constant, non-null) THENABLE_DRIVERS :Map.<function(new:WebDriver, !IThenable.<!Session>, ...?), function(new:ThenableWebDriver, !IThenable.<!Session>, ...?)>

Type:

(constant) Transport :string

AuthenticatorTransport values

Type:
  • string
Properties
NameTypeDescription
BLEstring
USBstring
NFCstring
INTERNALstring

(constant) Type :string

Represents the types of partition descriptors.

Type:
  • string
Properties
NameTypeDescription
CONTEXTstring
STORAGE_KEYstring

(constant) Type :string

Common log types.

Type:
  • string
Properties
NameTypeDescription
BROWSERstring

Logs originating from the browser.

CLIENTstring

Logs from a WebDriver client.

DRIVERstring

Logs from a WebDriver implementation.

PERFORMANCEstring

Logs related to performance.

SERVERstring

Logs from the remote server.

(constant) Type :string

Supported proxy configuration types.

Type:
  • string
Properties
NameTypeDescription
AUTODETECTstring
DIRECTstring
MANUALstring
PACstring
SYSTEMstring

(constant) Type

(constant) USER_AGENT :string

Type:
  • string

(constant) UserPromptHandler :string

The possible default actions a WebDriver session can take to respond to unhandled user prompts (window.alert(), window.confirm(), and window.prompt()).

Type:
  • string
Properties
NameTypeDescription
ACCEPTstring

All prompts should be silently accepted.

DISMISSstring

All prompts should be silently dismissed.

ACCEPT_AND_NOTIFYstring

All prompts should be automatically accepted, but an error should be returned to the next (or currently executing) WebDriver command.

DISMISS_AND_NOTIFYstring

All prompts should be automatically dismissed, but an error should be returned to the next (or currently executing) WebDriver command.

IGNOREstring

All prompts should be left unhandled.

(constant, non-null) W3C_COMMAND_MAP :Map.<string, (CommandSpec|CommandTransformer)>

Type:

(non-null) builtTargets :Object

Targets that have been previously built.

Type:
  • Object

(constant) path

This implementation is still in beta, and may change.

Utility to find if a given file is present and executable.

start

Starts the server on the specified port.

stop

Stops the server.

url

Formats a URL for this server.

Methods

ableToSwitchToFrame(frame) → (non-null) {Condition.<boolean>}

Creates a condition that will wait until the input driver is able to switch to the designated frame. The target frame may be specified as

  1. a numeric index into window.frames for the currently selected frame.
  2. a ./webdriver.WebElement, which must reference a FRAME or IFRAME element on the current page.
  3. a locator which may be used to first locate a FRAME or IFRAME on the current page before attempting to switch to it.

Upon successful resolution of this condition, the driver will be left focused on the new frame.

Parameters:
NameTypeDescription
frame
Returns:

A new condition.

Type: 
Condition.<boolean>

addConsoleHandler(opt_loggeropt)

Adds the console handler to the given logger. The console handler will log all messages using the JavaScript Console API.

Parameters:
NameTypeAttributesDescription
opt_loggerLogger<optional>

The logger to add the handler to; defaults to the root logger.

alertIsPresent()

Creates a condition that waits for an alert to be opened. Upon success, the returned promise will be fulfilled with the handle for the opened alert.

Returns:

arraysEqual(array1, array2)

Checks if the two arrays are equal or not. Conditions to check are:

  1. If the length of both arrays is equal
  2. If all elements of array1 are present in array2
  3. If all elements of array2 are present in array1
Parameters:
NameTypeDescription
array1

First array to be checked for equality

array2

Second array to be checked for equality

Returns:

true if equal, otherwise false.

binaryPaths(args) → {Object}

Determines the path of the correct driver

Parameters:
NameTypeDescription
argsArray.<string>

arguments to invoke Selenium Manager

Returns:

path of the driver and browser location

Type: 
Object

buildPath(path, parametersnon-null) → {string}

Builds a fully qualified path using the given set of command parameters. Each path segment prefixed with ':' will be replaced by the value of the corresponding parameter. All parameters spliced into the path will be removed from the parameter map.

Parameters:
NameTypeDescription
pathstring

The original resource path.

parametersObject.<*>

The parameters object to splice into the path.

Returns:

The modified path.

Type: 
string

buildRequest(customCommands, commandnon-null) → (non-null) {Request}

Parameters:
NameTypeDescription
customCommandsMap.<string, CommandSpec>

A map of custom command definitions.

commandcmd.Command

The command to resolve.

Returns:

A promise that will resolve with the command to execute.

Type: 
Request

check(locatornon-null) → (non-null) {By|function}

Checks if a value is a valid locator.

Parameters:
NameTypeDescription
locatorBy | function | ByHash

The value to check.

Throws:

If the given value does not define a valid locator strategy.

Type
TypeError
Returns:

The valid locator.

Type: 
By | function

checkCodePoint(key) → {string}

Parameters:
NameTypeDescription
keystring | Key | number
Throws:
Returns:
Type: 
string

checkLegacyResponse(responseObj) → {*}

Checks a legacy response from the Selenium 2.0 wire protocol for an error.

Parameters:
NameTypeDescription
responseObj*

the response object to check.

Throws:

if the response object defines an error.

Type
WebDriverError
Returns:

responseObj the original response if it does not define an error.

Type: 
*

checkOptions(capsnon-null, key, optionType, setMethod)

In the 3.x releases, the various browser option classes (e.g. firefox.Options) had to be manually set as an option using the Capabilities class:

let ffo = new firefox.Options();
// Configure firefox options...

let caps = new Capabilities();
caps.set('moz:firefoxOptions', ffo);

let driver = new Builder()
    .withCapabilities(caps)
    .build();

The options are now subclasses of Capabilities and can be used directly. A direct translation of the above is:

let ffo = new firefox.Options();
// Configure firefox options...

let driver = new Builder()
    .withCapabilities(ffo)
    .build();

You can also set the options for various browsers at once and let the builder choose the correct set at runtime (see Builder docs above):

let ffo = new firefox.Options();
// Configure ...

let co = new chrome.Options();
// Configure ...

let driver = new Builder()
    .setChromeOptions(co)
    .setFirefoxOptions(ffo)
    .build();
Parameters:
NameTypeDescription
capsCapabilities
keystring
optionTypefunction
setMethodstring
Throws:
error.InvalidArgumentError

checkedCall(fnnon-null) → (non-null) {Promise.<T>}

Parameters:
NameTypeDescription
fnfunction

.

Returns:

.

Type: 
Promise.<T>

checkedNodeCall(fnnon-null, …args) → (non-null) {Thenable}

Wraps a function that expects a node-style callback as its final argument. This callback expects two arguments: an error value (which will be null if the call succeeded), and the success value as the second argument. The callback will the resolve or reject the returned promise, based on its arguments.

Parameters:
NameTypeAttributesDescription
fnfunction

The function to wrap.

args?<repeatable>

The arguments to apply to the function, excluding the final callback.

Returns:

A promise that will be resolved with the result of the provided function's callback.

Type: 
Thenable

color()

consoleHandler(entrynon-null)

Logs all messages to the Console API.

Parameters:
NameTypeDescription
entryEntry

the entry to log.

copy(src, dst) → (non-null) {Promise.<string>}

Copies one file to another.

Parameters:
NameTypeDescription
srcstring

The source file.

dststring

The destination file.

Returns:

A promise for the copied file's path.

Type: 
Promise.<string>

copyDir(src, dst, opt_excludeopt) → (non-null) {Promise.<string>}

Recursively copies the contents of one directory to another.

Parameters:
NameTypeAttributesDescription
srcstring

The source directory to copy.

dststring

The directory to copy into.

opt_excludeRegExp | function<optional>

An exclusion filter as either a regex or predicate function. All files matching this filter will not be copied.

Returns:

A promise for the destination directory's path once all files have been copied.

Type: 
Promise.<string>

createDriver(ctor, …args) → (non-null) {ThenableWebDriver}

Parameters:
NameTypeAttributesDescription
ctorfunction
args?<repeatable>
Returns:
Type: 
ThenableWebDriver

delayed(ms) → (non-null) {Promise.<void>}

Creates a promise that will be resolved at a set time in the future.

Parameters:
NameTypeDescription
msnumber

The amount of time, in milliseconds, to wait before resolving the promise.

Returns:

The promise.

Type: 
Promise.<void>

direct() → (non-null) {Config}

Configures WebDriver to bypass all browser proxies.

Returns:

A new proxy configuration object.

Type: 
Config

elementIsDisabled(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to be disabled.

Parameters:
NameTypeDescription
element
See
  • webdriver.WebDriver#isEnabled
Returns:

The new condition.

Type: 
WebElementCondition

elementIsEnabled(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to be enabled.

Parameters:
NameTypeDescription
element
See
  • webdriver.WebDriver#isEnabled
Returns:

The new condition.

Type: 
WebElementCondition

elementIsNotSelected(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to be deselected.

Parameters:
NameTypeDescription
element
See
  • webdriver.WebDriver#isSelected
Returns:

The new condition.

Type: 
WebElementCondition

elementIsNotVisible(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to be in the DOM, yet not visible to the user.

Parameters:
NameTypeDescription
element
See
  • ./webdriver.WebDriver#isDisplayed
Returns:

The new condition.

Type: 
WebElementCondition

elementIsSelected(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to be selected.

Parameters:
NameTypeDescription
element
See
  • webdriver.WebDriver#isSelected
Returns:

The new condition.

Type: 
WebElementCondition

elementIsVisible(element) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element to become visible.

Parameters:
NameTypeDescription
element
See
  • ./webdriver.WebDriver#isDisplayed
Returns:

The new condition.

Type: 
WebElementCondition

elementLocated(locatornon-null) → (non-null) {WebElementCondition}

Creates a condition that will loop until an element is found with the given locator.

Parameters:
NameTypeDescription
locatorBy | function

The locator to use.

Returns:

The new condition.

Type: 
WebElementCondition

elementTextContains(element, substr) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element's visible text to contain the given substring.

Parameters:
NameTypeDescription
element
substrstring

The substring to search for.

See
  • webdriver.WebDriver#getText
Returns:

The new condition.

Type: 
WebElementCondition

elementTextIs(element, text) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element's visible text to match the given {@code text} exactly.

Parameters:
NameTypeDescription
element
textstring

The expected text.

See
  • webdriver.WebDriver#getText
Returns:

The new condition.

Type: 
WebElementCondition

elementTextMatches(element, regexnon-null) → (non-null) {WebElementCondition}

Creates a condition that will wait for the given element's visible text to match a regular expression.

Parameters:
NameTypeDescription
element
regexRegExp

The regular expression to test against.

See
  • webdriver.WebDriver#getText
Returns:

The new condition.

Type: 
WebElementCondition

elementsLocated(locatornon-null)

Creates a condition that will loop until at least one element is found with the given locator.

Parameters:
NameTypeDescription
locatorBy | function

The locator to use.

Returns:

encodeError(err) → {Object}

Parameters:
NameTypeDescription
err*

The error to encode.

Returns:

the encoded error.

Type: 
Object

ensureFileDetectorsAreEnabled(ctor) → {function}

WebDriver's setFileDetector method uses a non-standard command to transfer files from the local client to the remote end hosting the browser. Many of the WebDriver sub-types, like the chrome.Driver and firefox.Driver, do not support this command. Thus, these classes override the setFileDetector to no-op.

This function uses a mixin to re-enable setFileDetector by calling the original method on the WebDriver prototype directly. This is used only when the builder creates a Chrome or Firefox instance that communicates with a remote end (and thus, support for remote file detectors is unknown).

Parameters:
NameTypeDescription
ctorfunction
Returns:
Type: 
function

escapeCss(css) → {string}

Escapes a CSS string.

Parameters:
NameTypeDescription
cssstring

the string to escape.

Throws:
  • if the input value is not a string.

    Type
    TypeError
  • if the string contains an invalid character.

    Type
    InvalidCharacterError
Returns:

the escaped string.

Type: 
string

exec(command, opt_optionsopt) → (non-null) {Command}

Spawns a child process. The returned Command may be used to wait for the process result or to send signals to the process.

Parameters:
NameTypeAttributesDescription
commandstring

The executable to spawn.

opt_optionsOptions<optional>

The command options.

Returns:

The launched command.

Type: 
Command

executeCommand(executornon-null, commandnon-null) → (non-null) {Promise}

Translates a command to its wire-protocol representation before passing it to the given executor for execution.

Parameters:
NameTypeDescription
executorcommand.Executor

The executor to use.

commandcommand.Command

The command to execute.

Returns:

A promise that will resolve with the command response.

Type: 
Promise

exists(aPath) → (non-null) {Promise.<boolean>}

Tests if a file path exists.

Parameters:
NameTypeDescription
aPathstring

The path to test.

Returns:

A promise for whether the file exists.

Type: 
Promise.<boolean>

extractId(obj) → {string}

Extracts the encoded WebElement ID from the object.

Parameters:
NameTypeDescription
obj?

The object to extract the ID from.

Throws:

if the object is not a valid encoded ID.

Type
TypeError
Returns:

the extracted ID.

Type: 
string

(async) filter(arraynon-null, fn, selfopt)

Calls a function for each element in an array, and if the function returns true adds the element to a new array.

If the return value of the filter function is a promise, this function will wait for it to be fulfilled before determining whether to insert the element into the new array.

If the filter function throws or returns a rejected promise, the promise returned by this function will be rejected with the same reason. Only the first failure will be reported; all subsequent errors will be silently ignored.

Parameters:
NameTypeAttributesDescription
arrayArray.<TYPE> | IThenable.<!Array.<TYPE>>

The array to iterate over, or a promise that will resolve to said array.

fnfunction

The function to call for each element in the array.

selfSELF<optional>

The object to be used as the value of 'this' within fn.

filterNonW3CCaps(capabilitiesnon-null) → (non-null) {Capabilities}

Parameters:
NameTypeDescription
capabilitiesCapabilities

A capabilities object.

Returns:

A copy of the parameter capabilities, omitting capability names that are not valid W3C names.

Type: 
Capabilities

findFreePort(opt_hostopt) → (non-null) {Promise.<number>}

Parameters:
NameTypeAttributesDescription
opt_hoststring<optional>

The bound host to test the {@code port} against. Defaults to {@code INADDR_ANY}.

Returns:

A promise that will resolve to a free port. If a port cannot be found, the promise will be rejected.

Type: 
Promise.<number>

findInPath(file, opt_checkCwdopt) → (nullable) {string}

Searches the {@code PATH} environment variable for the given file.

Parameters:
NameTypeAttributesDescription
filestring

The file to locate on the PATH.

opt_checkCwdboolean<optional>

Whether to always start with the search with the current working directory, regardless of whether it is explicitly listed on the PATH.

Returns:

Path to the located file, or {@code null} if it could not be found.

Type: 
string

formatSpawnArgs(seleniumStandalonePath, args) → {Array.<string>}

Parameters:
NameTypeDescription
seleniumStandalonePathstring

path to standalone server

argsArray.<string>

spawn arguments array returns formatted args based on selenium standalone server version

Returns:
Type: 
Array.<string>

fromWireValue(drivernon-null, value) → {*}

Converts a value from its JSON representation according to the WebDriver wire protocol. Any JSON object that defines a WebElement ID will be decoded to a WebElement object. All other values will be passed through as is.

Parameters:
NameTypeDescription
driverWebDriver

The driver to use as the parent of any unwrapped WebElement values.

value*

The value to convert.

Returns:

The converted value.

Type: 
*

(async) fullyResolveKeys(objnon-null) → (non-null) {Thenable}

Parameters:
NameTypeDescription
objArray | Object

the object to resolve.

Returns:

A promise that will be resolved with the input object once all of its values have been fully resolved.

Type: 
Thenable

(async) fullyResolved(value) → (non-null) {Thenable}

Returns a promise that will be resolved with the input value in a fully-resolved state. If the value is an array, each element will be fully resolved. Likewise, if the value is an object, all keys will be fully resolved. In both cases, all nested arrays and objects will also be fully resolved. All fields are resolved in place; the returned promise will resolve on {@code value} and not a copy.

Warning: This function makes no checks against objects that contain cyclical references:

var value = {};
value['self'] = value;
promise.fullyResolved(value);  // Stack overflow.
Parameters:
NameTypeDescription
value*

The value to fully resolve.

Returns:

A promise for a fully resolved version of the input value.

Type: 
Thenable

getAddress(familyopt) → {string|undefined}

Retrieves the external IP address for this host.

Parameters:
NameTypeAttributesDefaultDescription
familystring<optional>
IPv4

The IP family to retrieve. Defaults to "IPv4".

Returns:

The IP address or undefined if not available.

Type: 
string | undefined

getAvailableBrowsers() → (non-null) {Array.<!TargetBrowser>}

Returns:

the browsers available for testing on this system.

Type: 
Array.<!TargetBrowser>

getBinary() → {string}

Determines the path of the correct Selenium Manager binary

Returns:
Type: 
string

getBinaryPaths(capabilities) → {Object}

Determines the path of the correct Selenium Manager binary

Parameters:
NameTypeDescription
capabilitiesCapabilities

browser options to fetch the driver

Returns:

path of the driver and browser location

Type: 
Object

getBrowsersToTestFromEnv() → {Object}

Extracts the browsers for a test suite to target from the SELENIUM_BROWSER environment variable.

Returns:

[] the browsers to target.

Type: 
Object

(async) getBrowsingContextInstance(driver, browsingContextId, type, createParameters) → {Promise.<BrowsingContext>}

initiate browsing context instance and return

Parameters:
NameTypeDescription
driver
browsingContextId

The browsing context of current window/tab

type

"window" or "tab"

createParameters

The parameters for creating a new browsing context

Returns:
Type: 
Promise.<BrowsingContext>

getIPAddress(loopback, family) → {string|undefined}

Queries the system network interfaces for an IP address.

Parameters:
NameTypeDescription
loopbackboolean

Whether to find a loopback address.

familystring

The IP family (IPv4 or IPv6). Defaults to IPv4.

Returns:

The located IP address or undefined.

Type: 
string | undefined

getJavaPath() → {string}

returns path to java or 'java' string if JAVA_HOME does not exist in env obj

Returns:
Type: 
string

getLevel(nameOrValue) → (non-null) {Level}

Converts a level name or value to a Level value. If the name/value is not recognized, Level.ALL will be returned.

Parameters:
NameTypeDescription
nameOrValuenumber | string

The log level name, or value, to convert.

Returns:

The converted level.

Type: 
Level

(async) getLogInspectorInstance(driver, browsingContextIds) → {Promise.<LogInspector>}

initiate inspector instance and return

Parameters:
NameTypeDescription
driver
browsingContextIds
Returns:
Type: 
Promise.<LogInspector>

getLogger(name) → (non-null) {Logger}

Retrieves a named logger, creating it in the process. This function will implicitly create the requested logger, and any of its parents, if they do not yet exist.

The log level will be unspecified for newly created loggers. Use Logger#setLevel(level) to explicitly set a level.

Parameters:
NameTypeDescription
namestring

the logger's name.

Returns:

the requested logger.

Type: 
Logger

getLoopbackAddress(familyopt) → {string|undefined}

Retrieves a loopback address for this machine.

Parameters:
NameTypeAttributesDefaultDescription
familystring<optional>
IPv4

The IP family to retrieve. Defaults to "IPv4".

Returns:

The IP address or undefined if not available.

Type: 
string | undefined

getRequestOptions(aUrl) → {RequestOptions}

Parameters:
NameTypeDescription
aUrlstring

The request URL to parse.

Throws:

if the URL does not include a hostname.

Type
Error
Returns:

The request options.

Type: 
RequestOptions

getStatus(url) → (non-null) {Promise.<!Object>}

Queries a WebDriver server for its current status.

Parameters:
NameTypeDescription
urlstring

Base URL of the server to query.

Returns:

A promise that resolves with a hash of the server status.

Type: 
Promise.<!Object>

getTestHook(name) → (non-null) {function}

Parameters:
NameTypeDescription
namestring
Throws:
TypeError
Returns:
Type: 
function

headersToString(headersnon-null) → {string}

Converts a headers map to a HTTP header block string.

Parameters:
NameTypeDescription
headersMap.<string, string>

The map to convert.

Returns:

The headers as a string.

Type: 
string

ignore(predicateFn) → {Object}

Returns an object with wrappers for the standard mocha/jasmine test functions: describe and it, which will redirect to xdescribe and xit, respectively, if provided predicate function returns false.

Sample usage:

const {Browser} = require('selenium-webdriver');
const {suite, ignore} = require('selenium-webdriver/testing');

suite(function(env) {

    // Skip tests the current environment targets Chrome.
    ignore(env.browsers(Browser.CHROME)).
    describe('something', async function() {
      let driver = await env.builder().build();
      // etc.
    });
});
Parameters:
NameTypeDescription
predicateFnfunction

A predicate to call to determine if the test should be suppressed. This function MUST be synchronous.

Returns:

an object with wrapped versions of the describe and it test functions.

Type: 
Object

init(forceopt)

Initializes this module by determining which browsers a test suite should run against. The default behavior is to run tests against every browser with a WebDriver executables (chromedriver, firefoxdriver, etc.) are installed on the system by PATH.

Specific browsers can be selected at runtime by setting the SELENIUM_BROWSER environment variable. This environment variable has the same semantics as with the WebDriver Builder, except you may use a comma-delimited list to run against multiple browsers:

SELENIUM_BROWSER=chrome,firefox mocha --recursive tests/

The SELENIUM_REMOTE_URL environment variable may be set to configure tests to run against an externally managed (usually remote) Selenium server. When set, the WebDriver builder provided by each TestEnvironment will automatically be configured to use this server instead of starting a browser driver locally.

The SELENIUM_SERVER_JAR environment variable may be set to the path of a standalone Selenium server on the local machine that should be used for WebDriver sessions. When set, the WebDriver builder provided by each TestEnvironment will automatically be configured to use the started server instead of using a browser driver directly. It should only be necessary to set the SELENIUM_SERVER_JAR when testing locally against browsers not natively supported by the WebDriver Builder.

When either of the SELENIUM_REMOTE_URL or SELENIUM_SERVER_JAR environment variables are set, the SELENIUM_BROWSER variable must also be set.

Parameters:
NameTypeAttributesDefaultDescription
forceboolean<optional>
false

whether to force this module to re-initialize and scan process.env again to determine which browsers to run tests against.

installConsoleHandler()

Installs the console log handler on the root logger.

isErrorResponse(data) → {boolean}

Tests if the given value is a valid error response object according to the W3C WebDriver spec.

Parameters:
NameTypeDescription
data?

The value to test.

Returns:

Whether the given value data object is a valid error response.

Type: 
boolean

isFree(port, opt_hostopt) → (non-null) {Promise.<boolean>}

Tests if a port is free.

Parameters:
NameTypeAttributesDescription
portnumber

The port to test.

opt_hoststring<optional>

The bound host to test the {@code port} against. Defaults to {@code INADDR_ANY}.

Returns:

A promise that will resolve with whether the port is free.

Type: 
Promise.<boolean>

isId(obj) → {boolean}

Parameters:
NameTypeDescription
obj?

the object to test.

Returns:

whether the object is a valid encoded WebElement ID.

Type: 
boolean

isIdle(actionsnon-null) → {boolean}

Parameters:
NameTypeDescription
actionsArray.<!Action>
Returns:
Type: 
boolean

isObject(value) → {boolean}

Determines whether a {@code value} should be treated as an object.

Parameters:
NameTypeDescription
value?

The value to test.

Returns:

Whether the value is an object.

Type: 
boolean

isPromise(value) → {boolean}

Determines whether a {@code value} should be treated as a promise. Any object whose "then" property is a function will be considered a promise.

Parameters:
NameTypeDescription
value?

The value to test.

Returns:

Whether the value is a promise.

Type: 
boolean

isRetryableNetworkError(errnon-null) → {boolean}

Parameters:
NameTypeDescription
errError
Returns:
Type: 
boolean

isSelenium3x(seleniumStandalonePath) → {boolean}

Parameters:
NameTypeDescription
seleniumStandalonePathstring

path to standalone server

Returns:
Type: 
boolean

legacyTimeout(drivernon-null, type, ms) → (non-null) {Promise.<void>}

Parameters:
NameTypeDescription
driverWebDriver
typestring
msnumber
Returns:
Type: 
Promise.<void>

load(path) → (non-null) {Promise.<!Zip>}

Asynchronously opens a zip archive.

Parameters:
NameTypeDescription
pathstring

to the zip archive to load.

Returns:

a promise that will resolve with the opened archive.

Type: 
Promise.<!Zip>

locate(filePath) → {string}

Locates a test resource.

Parameters:
NameTypeDescription
filePathstring

The file to locate from the root of the project.

Throws:

If the file does not exist.

Type
Error
Returns:

The full path for the file, if it exists.

Type: 
string

locateWith(A) → {RelativeBy}

Start searching for relative objects using search criteria with By.

Parameters:
NameTypeDescription
Astring

By map that shows how to find the initial element

Returns:
Type: 
RelativeBy

manual(options) → (non-null) {ManualConfig}

Manually configures the browser proxy. The following options are supported:

  • ftp: Proxy host to use for FTP requests
  • http: Proxy host to use for HTTP requests
  • https: Proxy host to use for HTTPS requests
  • bypass: A list of hosts requests should directly connect to, bypassing any other proxies for that request. May be specified as a comma separated string, or a list of strings.

Behavior is undefined for FTP, HTTP, and HTTPS requests if the corresponding key is omitted from the configuration options.

Parameters:
NameTypeDescription
optionsObject

Proxy configuration options.

Returns:

A new proxy configuration object.

Type: 
ManualConfig

(async) map(arraynon-null, fn, selfopt)

Calls a function for each element in an array and inserts the result into a new array, which is used as the fulfillment value of the promise returned by this function.

If the return value of the mapping function is a promise, this function will wait for it to be fulfilled before inserting it into the new array.

If the mapping function throws or returns a rejected promise, the promise returned by this function will be rejected with the same reason. Only the first failure will be reported; all subsequent errors will be silently ignored.

Parameters:
NameTypeAttributesDescription
arrayArray.<TYPE> | IThenable.<!Array.<TYPE>>

The array to iterate over, or a promise that will resolve to said array.

fnfunction

The function to call for each element in the array. This function should expect three arguments (the element, the index, and the array itself.

selfSELF<optional>

The object to be used as the value of 'this' within fn.

mkdir(aPath) → (non-null) {Promise.<string>}

Creates a directory.

Parameters:
NameTypeDescription
aPathstring

The directory path.

Returns:

A promise that will resolve with the path of the created directory.

Type: 
Promise.<string>

mkdirp(dir) → (non-null) {Promise.<string>}

Recursively creates a directory and any ancestors that do not yet exist.

Parameters:
NameTypeDescription
dirstring

The directory path to create.

Returns:

A promise that will resolve with the path of the created directory.

Type: 
Promise.<string>

of(…var_args) → (non-null) {Build}

Creates a build of the listed targets.

Parameters:
NameTypeAttributesDescription
var_argsstring<repeatable>

The targets to build.

Throws:

If not running in dev mode.

Type
Error
Returns:

The new build.

Type: 
Build

pac(proxyAutoconfigUrl) → (non-null) {PacConfig}

Configures WebDriver to configure the browser proxy using the PAC file at the given URL.

Parameters:
NameTypeDescription
proxyAutoconfigUrlstring

URL for the PAC proxy to use.

Returns:

A new proxy configuration object.

Type: 
PacConfig

pad(n) → {string}

Pads a number to ensure it has a minimum of two digits.

Parameters:
NameTypeDescription
nnumber

the number to be padded.

Returns:

the padded number.

Type: 
string

parseHttpResponse(commandnon-null, httpResponsenon-null) → {Object}

Callback used to parse Response objects from a HttpClient.

Parameters:
NameTypeDescription
commandcmd.Command

The command the response is for.

httpResponseResponse

The HTTP response to parse.

Throws:

If the HTTP response is an error.

Type
WebDriverError
Returns:

An object describing the parsed response. This object will have two fields: isW3C indicates whether the response looks like it came from a remote end that conforms with the W3C WebDriver spec, and value, the actual response value.

Type: 
Object

projectRoot() → {string}

Throws:

If not running in dev mode.

Type
Error
Returns:

Absolute path of the project's root directory.

Type: 
string

read(aPath) → (non-null) {Promise.<!Buffer>}

Reads the contents of the given file.

Parameters:
NameTypeDescription
aPathstring

Path to the file to read.

Returns:

A promise that will resolve with a buffer of the file contents.

Type: 
Promise.<!Buffer>

removeConsoleHandler(opt_loggeropt)

Removes the console log handler from the given logger.

Parameters:
NameTypeAttributesDescription
opt_loggerLogger<optional>

The logger to remove the handler from; defaults to the root logger.

See
  • exports.addConsoleHandler

requireAtom(module, bazelTarget) → (non-null) {function}

Parameters:
NameTypeDescription
modulestring
bazelTargetstring
Returns:
Type: 
function

resolveCommandLineFlags(argsnon-null) → (non-null) {Promise.<!Array.<string>>}

Parameters:
NameTypeDescription
argsArray.<CommandLineFlag> | IThenable.<!Array.<CommandLineFlag>>
Returns:
Type: 
Promise.<!Array.<string>>

resolveWaitMessage(messageopt) → {string}

Resolves a wait message from either a function or a string.

Parameters:
NameTypeAttributesDescription
messagestring | function<optional>

An optional message to use if the wait times out.

Returns:

The resolved message

Type: 
string

rmDir(dirPath) → (non-null) {Promise}

Recursively removes a directory and all of its contents. This is equivalent to {@code rm -rf} on a POSIX system.

Parameters:
NameTypeDescription
dirPathstring

Path to the directory to remove.

Returns:

A promise to be resolved when the operation has completed.

Type: 
Promise

sendIndex(requestnon-null, responsenon-null)

Responds to a request for the file server's main index.

Parameters:
NameTypeDescription
requesthttp.ServerRequest

The request object.

responsehttp.ServerResponse

The response object.

sendRequest(optionsnon-null, onOk, onError, opt_dataopt, nullable, opt_proxyopt, nullable, opt_retriesopt)

Sends a single HTTP request.

Parameters:
NameTypeAttributesDescription
optionsObject

The request options.

onOkfunction

The function to call if the request succeeds.

onErrorfunction

The function to call if the request fails.

opt_datastring<optional>
<nullable>

The data to send with the request.

opt_proxyRequestOptions<optional>
<nullable>

The proxy server to use for the request.

opt_retriesnumber<optional>

The current number of retries.

serialize(capsnon-null) → (non-null) {Object.<string, ?>}

Serializes a capabilities object. This is defined as a standalone function so it may be type checked (where Capabilities[Symbols.serialize] has type checking disabled since it is defined with [] access on a struct).

Parameters:
NameTypeDescription
capsCapabilities

The capabilities to serialize.

Returns:

The JSON representation of this instance. Note, the returned object may contain nested promised values.

Type: 
Object.<string, ?>

setFileDetector(detector)

Parameters:
NameTypeDescription
detectorinput.FileDetector

shouldRetryRequest(retriesnon-null, errnon-null) → {boolean}

A retry is sometimes needed on Windows where we may quickly run out of ephemeral ports. A more robust solution is bumping the MaxUserPort setting as described here: http://msdn.microsoft.com/en-us/library/aa560610%28v=bts.20%29.aspx

Parameters:
NameTypeDescription
retriesnumber
errError
Returns:
Type: 
boolean

socks(socksProxy, socksVersionopt) → (non-null) {ManualConfig}

Creates a proxy configuration for a socks proxy.

Example:

const {Capabilities} = require('selenium-webdriver');
const proxy = require('selenium-webdriver/lib/proxy');

let capabilities = new Capabilities();
capabilities.setProxy(proxy.socks('localhost:1234'));

// Or, to include authentication.
capabilities.setProxy(proxy.socks('bob:password@localhost:1234'));
Parameters:
NameTypeAttributesDescription
socksProxystring

The proxy host, in the form hostname:port.

socksVersionnumber<optional>

The SOCKS proxy version.

Returns:

A new proxy configuration object.

Type: 
ManualConfig

splitHostAndPort(hostport) → {Object}

Splits a hostport string, e.g. "www.example.com:80", into its component parts.

Parameters:
NameTypeDescription
hostportstring

The string to split.

Returns:

A host and port. If no port is present in the argument hostport, port is null.

Type: 
Object

stalenessOf(element) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the given element to become stale. An element is considered stale once it is removed from the DOM, or a new page has loaded.

Parameters:
NameTypeDescription
element
Returns:

The new condition.

Type: 
Condition.<boolean>

startSeleniumServer(jar) → (non-null) {Promise.<string>}

Starts an instance of the Selenium server if not yet running.

Parameters:
NameTypeDescription
jarstring

Path to the server jar to use.

Returns:

A promise for the server's address once started.

Type: 
Promise.<string>

stat(aPath) → (non-null) {Promise.<!fs.Stats>}

Calls stat(2).

Parameters:
NameTypeDescription
aPathstring

The path to stat.

Returns:

A promise for the file stats.

Type: 
Promise.<!fs.Stats>

suite(fn, optionsopt)

Parameters:
NameTypeAttributesDescription
fnfunction

The top level suite function.

optionstesting.SuiteOptions<optional>

Suite specific options.

suite(fn, optionsopt)

Defines a test suite by calling the provided function once for each of the target browsers. If a suite is not limited to a specific set of browsers in the provided suite options, the suite will be configured to run against each of the runtime target browsers.

Sample usage:

const {By, Key, until} = require('selenium-webdriver');
const {suite} = require('selenium-webdriver/testing');

suite(function(env) {
  describe('Google Search', function() {
    let driver;

    before(async function() {
      driver = await env.builder().build();
    });

    after(() => driver.quit());

    it('demo', async function() {
      await driver.get('http://www.google.com/ncr');

      let q = await driver.findElement(By.name('q'));
      await q.sendKeys('webdriver', Key.RETURN);
      await driver.wait(
          until.titleIs('webdriver - Google Search'), 1000);
    });
  });
});

By default, this example suite will run against every WebDriver-enabled browser on the current system. Alternatively, the SELENIUM_BROWSER environment variable may be used to run against a specific browser:

SELENIUM_BROWSER=firefox mocha -t 120000 example_test.js
Parameters:
NameTypeAttributesDescription
fnfunction

the function to call to build the test suite.

optionsSuiteOptions<optional>

configuration options.

system() → (non-null) {Config}

Configures WebDriver to use the current system's proxy.

Returns:

A new proxy configuration object.

Type: 
Config

(async) thenFinally(promisenon-null, callback) → (non-null) {Promise.<R>}

Registers a listener to invoke when a promise is resolved, regardless of whether the promise's value was successfully computed. This function is synonymous with the {@code finally} clause in a synchronous API:

// Synchronous API:
try {
  doSynchronousWork();
} finally {
  cleanUp();
}

// Asynchronous promise API:
doAsynchronousWork().finally(cleanUp);

Note: similar to the {@code finally} clause, if the registered callback returns a rejected promise or throws an error, it will silently replace the rejection error (if any) from this promise:

try {
  throw Error('one');
} finally {
  throw Error('two');  // Hides Error: one
}

let p = Promise.reject(Error('one'));
promise.finally(p, function() {
  throw Error('two');  // Hides Error: one
});
Parameters:
NameTypeDescription
promiseIThenable.<?>

The promise to add the listener to.

callbackfunction

The function to call when the promise is resolved.

Returns:

A promise that will be resolved with the callback result.

Type: 
Promise.<R>

throwDecodedError(data)

Throws an error coded from the W3C protocol. A generic error will be thrown if the provided data is not a valid encoded error.

Parameters:
NameTypeDescription
dataObject

The error data to decode.

Throws:

the decoded error.

Type
WebDriverError

titleContains(substr) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's title to contain the given substring.

Parameters:
NameTypeDescription
substrstring

The substring that should be present in the page title.

Returns:

The new condition.

Type: 
Condition.<boolean>

titleIs(title) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's title to match the given value.

Parameters:
NameTypeDescription
titlestring

The expected page title.

Returns:

The new condition.

Type: 
Condition.<boolean>

titleMatches(regexnon-null) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's title to match the given regular expression.

Parameters:
NameTypeDescription
regexRegExp

The regular expression to test against.

Returns:

The new condition.

Type: 
Condition.<boolean>

tmpDir() → (non-null) {Promise.<string>}

Returns:

A promise for the path to a temporary directory.

Type: 
Promise.<string>

tmpFile(opt_optionsopt) → (non-null) {Promise.<string>}

Parameters:
NameTypeAttributesDescription
opt_optionsObject<optional>

Temporary file options.

Returns:

A promise for the path to a temporary file.

Type: 
Promise.<string>

toExecuteAtomCommand(commandnon-null, atom, …params) → (non-null) {Command}

Parameters:
NameTypeAttributesDescription
commandcmd.Command

The initial command.

atomAtom

The name of the atom to execute.

params<repeatable>
Returns:

The transformed command to execute.

Type: 
Command

toMap(hashnon-null) → (non-null) {Map.<string, ?>}

Converts a generic hash object to a map.

Parameters:
NameTypeDescription
hashObject.<string, ?>

The hash object.

Returns:

The converted map.

Type: 
Map.<string, ?>

(async) toWireValue(obj) → (non-null) {Promise.<?>}

Converts an object to its JSON representation in the WebDriver wire protocol. When converting values of type object, the following steps will be taken:

  1. if the object is a WebElement, the return value will be the element's server ID
  2. if the object defines a Symbols.serialize method, this algorithm will be recursively applied to the object's serialized representation
  3. if the object provides a "toJSON" function, this algorithm will recursively be applied to the result of that function
  4. otherwise, the value of each key will be recursively converted according to the rules above.
Parameters:
NameTypeDescription
obj*

The object to convert.

Returns:

A promise that will resolve to the input value's JSON representation.

Type: 
Promise.<?>

tryParse(str) → {?}

Parameters:
NameTypeDescription
strstring

.

Returns:

.

Type: 
?

Deletes a name from the filesystem and possibly the file it refers to. Has no effect if the file does not exist.

Parameters:
NameTypeDescription
aPathstring

The path to remove.

Returns:

A promise for when the file has been removed.

Type: 
Promise

unzip(src, dst) → (non-null) {Promise.<string>}

Asynchronously unzips an archive file.

Parameters:
NameTypeDescription
srcstring

path to the source file to unzip.

dststring

path to the destination directory.

Returns:

a promise that will resolve with dst once the archive has been unzipped.

Type: 
Promise.<string>

urlContains(substrUrl) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's url to contain the given substring.

Parameters:
NameTypeDescription
substrUrlstring

The substring that should be present in the current URL.

Returns:

The new condition.

Type: 
Condition.<boolean>

urlIs(url) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's url to match the given value.

Parameters:
NameTypeDescription
urlstring

The expected page url.

Returns:

The new condition.

Type: 
Condition.<boolean>

urlMatches(regexnon-null) → (non-null) {Condition.<boolean>}

Creates a condition that will wait for the current page's url to match the given regular expression.

Parameters:
NameTypeDescription
regexRegExp

The regular expression to test against.

Returns:

The new condition.

Type: 
Condition.<boolean>

waitForServer(url, timeout, opt_cancelTokenopt) → (non-null) {Promise}

Waits for a WebDriver server to be healthy and accepting requests.

Parameters:
NameTypeAttributesDescription
urlstring

Base URL of the server to query.

timeoutnumber

How long to wait for the server.

opt_cancelTokenPromise<optional>

A promise used as a cancellation signal: if resolved before the server is ready, the wait will be terminated early with a CancellationError.

Returns:

A promise that will resolve when the server is ready, or if the wait is cancelled.

Type: 
Promise

waitForUrl(url, timeout, opt_cancelTokenopt) → (non-null) {Promise}

Polls a URL with GET requests until it returns a 2xx response or the timeout expires.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to poll.

timeoutnumber

How long to wait, in milliseconds.

opt_cancelTokenPromise<optional>

A promise used as a cancellation signal: if resolved before the a 2xx response is received, the wait will be terminated early with a CancellationError.

Returns:

A promise that will resolve when a 2xx is received from the given URL, or if the wait is cancelled.

Type: 
Promise

walkDir(rootPath) → (non-null) {Promise.<!Array.<{path: string, dir: boolean}>>}

Recursively walks a directory, returning a promise that will resolve with a list of all files/directories seen.

Parameters:
NameTypeDescription
rootPathstring

the directory to walk.

Returns:

a promise that will resolve with a list of entries seen. For each entry, the recorded path will be relative to rootPath.

Type: 
Promise.<!Array.<{path: string, dir: boolean}>>

whereIs(filePath) → {string}

Builds the URL for a file in the //common/src/web directory of the Selenium client.

Parameters:
NameTypeDescription
filePathstring

A path relative to //common/src/web to compute a URL for.

Throws:

If the server is not running.

Type
Error
Returns:

The formatted URL.

Type: 
string

withTagName(The)

Start Searching for relative objects using the value returned from By.tagName().

Note: this method will likely be removed in the future please use locateWith.

Parameters:
NameTypeDescription
TheBy

value returned from calling By.tagName()

Returns:

write(aPath, data) → (non-null) {Promise}

Writes to a file.

Parameters:
NameTypeDescription
aPathstring

Path to the file to write to.

datastring | Buffer

The data to write.

Returns:

A promise that will resolve when the operation has completed.

Type: 
Promise

Type Definitions

ByHash

Short-hand expressions for the primary element locator strategies. For example the following two statements are equivalent:

var e1 = driver.findElement(By.id('foo'));
var e2 = driver.findElement({id: 'foo'});

Care should be taken when using JavaScript minifiers (such as the Closure compiler), as locator hashes will always be parsed using the un-obfuscated properties listed.

Type:
  • Object | Object | Object | Object | Object | Object | Object | Object | Object

CommandLineFlag

Type:
  • string | !IThenable.<string>

CommandSpec

Type:
  • Object

CommandTransformer()

RequestOptions

Type:
  • Object

StdIoOptions

Type:
  • string | !Array.<(string|number|!stream.Stream|null|undefined)>