Members
(constant, non-null) Atom :function
- function
Name | Type | Description |
---|---|---|
GET_ATTRIBUTE | function | |
IS_DISPLAYED | function | |
FIND_ELEMENTS | function |
- Source
(constant) Browser :string
Recognized browser names.
- string
Name | Type | Description |
---|---|---|
CHROME | string | |
EDGE | string | |
FIREFOX | string | |
INTERNET_EXPLORER | string | |
SAFARI | string |
- Source
(constant) Button :number
Enumeration of the buttons used in the advanced interactions API.
- number
Name | Type | Description |
---|---|---|
LEFT | number | |
MIDDLE | number | |
RIGHT | number | |
BACK | number | |
FORWARD | number |
- Source
(constant) Capability :string
The standard WebDriver capability keys.
- string
Name | Type | Description |
---|---|---|
ACCEPT_INSECURE_TLS_CERTS | string | Indicates whether a WebDriver session implicitly trusts otherwise untrusted and self-signed TLS certificates during navigation. |
BROWSER_NAME | string | The browser name. Common browser names are defined in the Browser enum. |
BROWSER_VERSION | string | Identifies the browser version. |
LOGGING_PREFS | string | Key for the logging driver logging preferences. The browser name. Common browser names are defined in the Browser enum. |
PAGE_LOAD_STRATEGY | string | Defines the session's page loading strategy. |
PLATFORM_NAME | string | Identifies the operating system of the endpoint node. Common values recognized by the most WebDriver server implementations are predefined in the Platform enum. |
PROXY | string | Describes the proxy configuration to use for a new WebDriver session. |
SET_WINDOW_RECT | string | Indicates whether the remote end supports all of the window resizing and positioning commands:
|
TIMEOUTS | string | Describes the timeouts imposed on certain session operations. |
UNHANDLED_PROMPT_BEHAVIOR | string | Defines how a WebDriver session should respond to unhandled user prompts. |
STRICT_FILE_INTERACTABILITY | string | Defines the current session’s strict file interactability. Used to upload a file when strict file interactability is on |
ENABLE_DOWNLOADS | string |
- Source
(constant) Config
- Source
(constant) ErrorCode :number
Enum of legacy error codes. TODO: remove this when all code paths have been switched to the new error types.
- number
Name | Type | Description |
---|---|---|
SUCCESS | number | |
NO_SUCH_SESSION | number | |
NO_SUCH_ELEMENT | number | |
NO_SUCH_FRAME | number | |
UNKNOWN_COMMAND | number | |
UNSUPPORTED_OPERATION | number | |
STALE_ELEMENT_REFERENCE | number | |
ELEMENT_NOT_VISIBLE | number | |
INVALID_ELEMENT_STATE | number | |
UNKNOWN_ERROR | number | |
ELEMENT_NOT_SELECTABLE | number | |
JAVASCRIPT_ERROR | number | |
XPATH_LOOKUP_ERROR | number | |
TIMEOUT | number | |
NO_SUCH_WINDOW | number | |
INVALID_COOKIE_DOMAIN | number | |
UNABLE_TO_SET_COOKIE | number | |
UNEXPECTED_ALERT_OPEN | number | |
NO_SUCH_ALERT | number | |
SCRIPT_TIMEOUT | number | |
INVALID_ELEMENT_COORDINATES | number | |
IME_NOT_AVAILABLE | number | |
IME_ENGINE_ACTIVATION_FAILED | number | |
INVALID_SELECTOR_ERROR | number | |
SESSION_NOT_CREATED | number | |
MOVE_TARGET_OUT_OF_BOUNDS | number | |
SQL_DATABASE_ERROR | number | |
INVALID_XPATH_SELECTOR | number | |
INVALID_XPATH_SELECTOR_RETURN_TYPE | number | |
ELEMENT_NOT_INTERACTABLE | number | |
INVALID_ARGUMENT | number | |
NO_SUCH_COOKIE | number | |
UNABLE_TO_CAPTURE_SCREEN | number | |
ELEMENT_CLICK_INTERCEPTED | number | |
METHOD_NOT_ALLOWED | number |
- Deprecated
- Yes
- Source
(constant) EvaluateResultType :string
Represents the type of script evaluation result. Described in https://w3c.github.io/webdriver-bidi/#type-script-EvaluateResult.
- string
Name | Type | Description |
---|---|---|
SUCCESS | string | |
EXCEPTION | string |
- Source
(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.
- Source
(constant) InterceptPhase :string
Represents the different phases of intercepting network requests and responses.
- string
Name | Type | Description |
---|---|---|
BEFORE_REQUEST_SENT | string | |
RESPONSE_STARTED | string | |
AUTH_REQUIRED | string |
- Source
(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
- string
Name | Type | Description |
---|---|---|
NULL | string | |
CANCEL | string | |
HELP | string | |
BACK_SPACE | string | |
TAB | string | |
CLEAR | string | |
RETURN | string | |
ENTER | string | |
SHIFT | string | |
CONTROL | string | |
ALT | string | |
PAUSE | string | |
ESCAPE | string | |
SPACE | string | |
PAGE_UP | string | |
PAGE_DOWN | string | |
END | string | |
HOME | string | |
ARROW_LEFT | string | |
LEFT | string | |
ARROW_UP | string | |
UP | string | |
ARROW_RIGHT | string | |
RIGHT | string | |
ARROW_DOWN | string | |
DOWN | string | |
INSERT | string | |
DELETE | string | |
SEMICOLON | string | |
EQUALS | string | |
NUMPAD0 | string | |
NUMPAD1 | string | |
NUMPAD2 | string | |
NUMPAD3 | string | |
NUMPAD4 | string | |
NUMPAD5 | string | |
NUMPAD6 | string | |
NUMPAD7 | string | |
NUMPAD8 | string | |
NUMPAD9 | string | |
MULTIPLY | string | |
ADD | string | |
SEPARATOR | string | |
SUBTRACT | string | |
DECIMAL | string | |
DIVIDE | string | |
F1 | string | |
F2 | string | |
F3 | string | |
F4 | string | |
F5 | string | |
F6 | string | |
F7 | string | |
F8 | string | |
F9 | string | |
F10 | string | |
F11 | string | |
F12 | string | |
COMMAND | string | |
META | string | |
ZENKAKU_HANKAKU | string | Japanese modifier key for switching between full- and half-width characters. |
- Source
(constant) ManualConfig
- Source
(constant) Name :string
Enumeration of predefined names command names that all command processors will support.
- string
Name | Type | Description |
---|---|---|
GET_SERVER_STATUS | string | |
NEW_SESSION | string | |
GET_SESSIONS | string | |
CLOSE | string | |
QUIT | string | |
GET_CURRENT_URL | string | |
GET | string | |
GO_BACK | string | |
GO_FORWARD | string | |
REFRESH | string | |
ADD_COOKIE | string | |
GET_COOKIE | string | |
GET_ALL_COOKIES | string | |
DELETE_COOKIE | string | |
DELETE_ALL_COOKIES | string | |
GET_ACTIVE_ELEMENT | string | |
FIND_ELEMENT | string | |
FIND_ELEMENTS | string | |
FIND_ELEMENTS_RELATIVE | string | |
FIND_CHILD_ELEMENT | string | |
FIND_CHILD_ELEMENTS | string | |
CLEAR_ELEMENT | string | |
CLICK_ELEMENT | string | |
SEND_KEYS_TO_ELEMENT | string | |
GET_CURRENT_WINDOW_HANDLE | string | |
GET_WINDOW_HANDLES | string | |
GET_WINDOW_RECT | string | |
SET_WINDOW_RECT | string | |
MAXIMIZE_WINDOW | string | |
MINIMIZE_WINDOW | string | |
FULLSCREEN_WINDOW | string | |
SWITCH_TO_WINDOW | string | |
SWITCH_TO_NEW_WINDOW | string | |
SWITCH_TO_FRAME | string | |
SWITCH_TO_FRAME_PARENT | string | |
GET_PAGE_SOURCE | string | |
GET_TITLE | string | |
EXECUTE_SCRIPT | string | |
EXECUTE_ASYNC_SCRIPT | string | |
GET_ELEMENT_TEXT | string | |
GET_COMPUTED_ROLE | string | |
GET_COMPUTED_LABEL | string | |
GET_ELEMENT_TAG_NAME | string | |
IS_ELEMENT_SELECTED | string | |
IS_ELEMENT_ENABLED | string | |
IS_ELEMENT_DISPLAYED | string | |
GET_ELEMENT_RECT | string | |
GET_ELEMENT_ATTRIBUTE | string | |
GET_DOM_ATTRIBUTE | string | |
GET_ELEMENT_VALUE_OF_CSS_PROPERTY | string | |
GET_ELEMENT_PROPERTY | string | |
SCREENSHOT | string | |
TAKE_ELEMENT_SCREENSHOT | string | |
PRINT_PAGE | string | |
GET_TIMEOUT | string | |
SET_TIMEOUT | string | |
ACCEPT_ALERT | string | |
DISMISS_ALERT | string | |
GET_ALERT_TEXT | string | |
SET_ALERT_TEXT | string | |
GET_SHADOW_ROOT | string | |
FIND_ELEMENT_FROM_SHADOWROOT | string | |
FIND_ELEMENTS_FROM_SHADOWROOT | string | |
ADD_VIRTUAL_AUTHENTICATOR | string | |
REMOVE_VIRTUAL_AUTHENTICATOR | string | |
ADD_CREDENTIAL | string | |
GET_CREDENTIALS | string | |
REMOVE_CREDENTIAL | string | |
REMOVE_ALL_CREDENTIALS | string | |
SET_USER_VERIFIED | string | |
GET_AVAILABLE_LOG_TYPES | string | |
GET_LOG | string | |
UPLOAD_FILE | string | |
ACTIONS | string | |
CLEAR_ACTIONS | string | |
GET_DOWNLOADABLE_FILES | string | |
DOWNLOAD_FILE | string | |
DELETE_DOWNLOADABLE_FILES | string |
- Source
(constant) NonPrimitiveType
Represents a non-primitive type.
Name | Type | Description |
---|---|---|
ARRAY | ||
DATE | ||
MAP | ||
OBJECT | ||
REGULAR_EXPRESSION | ||
SET | ||
CHANNEL | ||
findByName |
- Source
(constant) Origin :string
Defines the reference point from which to compute offsets for capturing screenshot.
- string
Name | Type | Description |
---|---|---|
VIEWPORT | string | |
DOCUMENT | string |
(constant) Origin :string
Defines the reference point from which to compute offsets for pointer move actions.
- string
Name | Type | Description |
---|---|---|
POINTER | string | Compute offsets relative to the pointer's current position. |
VIEWPORT | string | Compute offsets relative to the viewport. |
- Source
(constant) PacConfig
- Source
(constant) PageLoadStrategy :string
Strategies for waiting for document readiness after a navigation event.
- string
Name | Type | Description |
---|---|---|
NONE | string | Indicates WebDriver should not wait on the document readiness state after a navigation event. |
EAGER | string | Indicates WebDriver should wait for the document readiness state to become "interactive" after navigation. |
NORMAL | string | Indicates WebDriver should wait for the document readiness state to be "complete" after navigation. This is the default page loading strategy. |
- Source
(constant) Platform :string
Common platform names. These platforms are not explicitly defined by the WebDriver spec, however, their use is encouraged for interoperability.
- string
Name | Type | Description |
---|---|---|
LINUX | string | |
MAC | string | |
WINDOWS | string |
- Source
(constant) PrimitiveType
Represents a primitive type.
Name | Type | Description |
---|---|---|
UNDEFINED | ||
NULL | ||
STRING | ||
NUMBER | ||
SPECIAL_NUMBER | ||
BOOLEAN | ||
BIGINT | ||
findByName |
- Source
(constant) Protocol :string
Protocol for virtual authenticators
- string
Name | Type | Description |
---|---|---|
CTAP2 | string | |
U2F | string |
(constant) RealmType
Represents the types of realms. Described in https://w3c.github.io/webdriver-bidi/#type-script-RealmType.
Name | Type | Description |
---|---|---|
AUDIO_WORKLET | ||
DEDICATED_WORKER | ||
PAINT_WORKLET | ||
SERVICE_WORKED | ||
SHARED_WORKED | ||
WINDOW | ||
WORKER | ||
WORKLET | ||
findByName |
- Source
(constant) RemoteReferenceType :string
Represents the types of remote reference.
- string
Name | Type | Description |
---|---|---|
HANDLE | string | |
SHARED_ID | string |
- Source
(constant) RemoteType
Represents a remote value type.
Name | Type | Description |
---|---|---|
SYMBOL | ||
FUNCTION | ||
WEAK_MAP | ||
WEAK_SET | ||
ITERATOR | ||
GENERATOR | ||
ERROR | ||
PROXY | ||
PROMISE | ||
TYPED_ARRAY | ||
ARRAY_BUFFER | ||
NODE_LIST | ||
HTML_COLLECTION | ||
NODE | ||
WINDOW | ||
findByName |
- Source
(constant) ResultOwnership :string
Enum representing the ownership types.
- string
Name | Type | Description |
---|---|---|
ROOT | string | |
NONE | string |
- Source
(constant) SameSite :string
Represents the possible values for the SameSite attribute of a cookie.
- string
Name | Type | Description |
---|---|---|
STRICT | string | |
LAX | string | |
NONE | string | |
findByName | string |
- Source
(constant) SpecialNumberType
Represents a speacial number type.
Name | Type | Description |
---|---|---|
NAN | ||
MINUS_ZERO | ||
INFINITY | ||
MINUS_INFINITY |
- Source
(constant, non-null) THENABLE_DRIVERS :Map.<function(new:WebDriver, !IThenable.<!Session>, ...?), function(new:ThenableWebDriver, !IThenable.<!Session>, ...?)>
- Map.<function(new:WebDriver, !IThenable.<!Session>, ...?), function(new:ThenableWebDriver, !IThenable.<!Session>, ...?)>
(constant) Transport :string
AuthenticatorTransport values
- string
Name | Type | Description |
---|---|---|
BLE | string | |
USB | string | |
NFC | string | |
INTERNAL | string |
(constant) Type :string
Represents the types of partition descriptors.
- string
Name | Type | Description |
---|---|---|
CONTEXT | string | |
STORAGE_KEY | string |
(constant) Type :string
Common log types.
- string
Name | Type | Description |
---|---|---|
BROWSER | string | Logs originating from the browser. |
CLIENT | string | Logs from a WebDriver client. |
DRIVER | string | Logs from a WebDriver implementation. |
PERFORMANCE | string | Logs related to performance. |
SERVER | string | Logs from the remote server. |
- Source
(constant) Type :string
Supported proxy configuration types.
- string
Name | Type | Description |
---|---|---|
AUTODETECT | string | |
DIRECT | string | |
MANUAL | string | |
PAC | string | |
SYSTEM | string |
- Source
(constant) Type
- Source
(constant) USER_AGENT :string
- string
- Source
(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()
).
- string
Name | Type | Description |
---|---|---|
ACCEPT | string | All prompts should be silently accepted. |
DISMISS | string | All prompts should be silently dismissed. |
ACCEPT_AND_NOTIFY | string | All prompts should be automatically accepted, but an error should be returned to the next (or currently executing) WebDriver command. |
DISMISS_AND_NOTIFY | string | All prompts should be automatically dismissed, but an error should be returned to the next (or currently executing) WebDriver command. |
IGNORE | string | All prompts should be left unhandled. |
- Source
(constant, non-null) W3C_COMMAND_MAP :Map.<string, (CommandSpec|CommandTransformer)>
- Map.<string, (CommandSpec|CommandTransformer)>
- Source
(non-null) builtTargets :Object
Targets that have been previously built.
- Object
- Source
(constant) path
This implementation is still in beta, and may change.
Utility to find if a given file is present and executable.
- Source
start
Starts the server on the specified port.
- Source
stop
Stops the server.
- Source
url
Formats a URL for this server.
- Source
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
- a numeric index into window.frames for the currently selected frame.
- a ./webdriver.WebElement, which must reference a FRAME or IFRAME element on the current page.
- 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.
Name | Type | Description |
---|---|---|
frame |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
opt_logger | Logger | <optional> | The logger to add the handler to; defaults to the root logger. |
- Source
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.
- Source
arraysEqual(array1, array2)
Checks if the two arrays are equal or not. Conditions to check are:
- If the length of both arrays is equal
- If all elements of array1 are present in array2
- If all elements of array2 are present in array1
Name | Type | Description |
---|---|---|
array1 | First array to be checked for equality | |
array2 | Second array to be checked for equality |
true if equal, otherwise false.
binaryPaths(args) → {Object}
Determines the path of the correct driver
Name | Type | Description |
---|---|---|
args | Array.<string> | arguments to invoke Selenium Manager |
- Source
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.
Name | Type | Description |
---|---|---|
path | string | The original resource path. |
parameters | Object.<*> | The parameters object to splice into the path. |
- Source
The modified path.
- Type:
- string
buildRequest(customCommands, commandnon-null) → (non-null) {Request}
Name | Type | Description |
---|---|---|
customCommands | Map.<string, CommandSpec> | A map of custom command definitions. |
command | cmd. | The command to resolve. |
- Source
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.
If the given value does not define a valid locator strategy.
- Type
- TypeError
The valid locator.
- Type:
- By |
function
checkCodePoint(key) → {string}
Name | Type | Description |
---|---|---|
key | string | |
- Source
- Type:
- string
checkLegacyResponse(responseObj) → {*}
Checks a legacy response from the Selenium 2.0 wire protocol for an error.
Name | Type | Description |
---|---|---|
responseObj | * | the response object to check. |
- Source
if the response object defines an error.
- Type
- WebDriverError
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();
Name | Type | Description |
---|---|---|
caps | Capabilities | |
key | string | |
optionType | function | |
setMethod | string |
checkedCall(fnnon-null) → (non-null) {Promise.<T>}
Name | Type | Description |
---|---|---|
fn | function | . |
- Source
.
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
fn | function | The function to wrap. | |
args | ? | <repeatable> | The arguments to apply to the function, excluding the final callback. |
- Source
A promise that will be resolved with the result of the provided function's callback.
- Type:
- Thenable
color()
- Source
consoleHandler(entrynon-null)
Logs all messages to the Console API.
Name | Type | Description |
---|---|---|
entry | Entry | the entry to log. |
- Source
copy(src, dst) → (non-null) {Promise.<string>}
Copies one file to another.
Name | Type | Description |
---|---|---|
src | string | The source file. |
dst | string | The destination file. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
src | string | The source directory to copy. | |
dst | string | The directory to copy into. | |
opt_exclude | RegExp | | <optional> | An exclusion filter as either a regex or predicate function. All files matching this filter will not be copied. |
- Source
A promise for the destination directory's path once all files have been copied.
- Type:
- Promise.<string>
createDriver(ctor, …args) → (non-null) {ThenableWebDriver}
Name | Type | Attributes | Description |
---|---|---|---|
ctor | function | ||
args | ? | <repeatable> |
- Type:
- ThenableWebDriver
delayed(ms) → (non-null) {Promise.<void>}
Creates a promise that will be resolved at a set time in the future.
Name | Type | Description |
---|---|---|
ms | number | The amount of time, in milliseconds, to wait before resolving the promise. |
- Source
The promise.
- Type:
- Promise.<void>
direct() → (non-null) {Config}
Configures WebDriver to bypass all browser proxies.
- Source
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.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- webdriver.WebDriver#isEnabled
The new condition.
- Type:
- WebElementCondition
elementIsEnabled(element) → (non-null) {WebElementCondition}
Creates a condition that will wait for the given element to be enabled.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- webdriver.WebDriver#isEnabled
The new condition.
- Type:
- WebElementCondition
elementIsNotSelected(element) → (non-null) {WebElementCondition}
Creates a condition that will wait for the given element to be deselected.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- webdriver.WebDriver#isSelected
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.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- ./webdriver.WebDriver#isDisplayed
The new condition.
- Type:
- WebElementCondition
elementIsSelected(element) → (non-null) {WebElementCondition}
Creates a condition that will wait for the given element to be selected.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- webdriver.WebDriver#isSelected
The new condition.
- Type:
- WebElementCondition
elementIsVisible(element) → (non-null) {WebElementCondition}
Creates a condition that will wait for the given element to become visible.
Name | Type | Description |
---|---|---|
element |
- Source
- See
- ./webdriver.WebDriver#isDisplayed
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.
Name | Type | Description |
---|---|---|
locator | By | | The locator to use. |
- Source
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.
Name | Type | Description |
---|---|---|
element | ||
substr | string | The substring to search for. |
- Source
- See
- webdriver.WebDriver#getText
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.
Name | Type | Description |
---|---|---|
element | ||
text | string | The expected text. |
- Source
- See
- webdriver.WebDriver#getText
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.
Name | Type | Description |
---|---|---|
element | ||
regex | RegExp | The regular expression to test against. |
- Source
- See
- webdriver.WebDriver#getText
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.
Name | Type | Description |
---|---|---|
locator | By | | The locator to use. |
- Source
encodeError(err) → {Object}
Name | Type | Description |
---|---|---|
err | * | The error to encode. |
- Source
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).
Name | Type | Description |
---|---|---|
ctor | function |
- Type:
- function
escapeCss(css) → {string}
Escapes a CSS string.
Name | Type | Description |
---|---|---|
css | string | the string to escape. |
if the input value is not a string.
- Type
- TypeError
if the string contains an invalid character.
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.
Name | Type | Attributes | Description |
---|---|---|---|
command | string | The executable to spawn. | |
opt_options | Options | <optional> | The command options. |
- Source
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.
Name | Type | Description |
---|---|---|
executor | command. | The executor to use. |
command | command. | The command to execute. |
- Source
A promise that will resolve with the command response.
- Type:
- Promise
exists(aPath) → (non-null) {Promise.<boolean>}
Tests if a file path exists.
Name | Type | Description |
---|---|---|
aPath | string | The path to test. |
- Source
A promise for whether the file exists.
- Type:
- Promise.<boolean>
extractId(obj) → {string}
Extracts the encoded WebElement ID from the object.
Name | Type | Description |
---|---|---|
obj | ? | The object to extract the ID from. |
- Source
if the object is not a valid encoded ID.
- Type
- TypeError
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.
Name | Type | Attributes | Description |
---|---|---|---|
array | Array.<TYPE> | | The array to iterate over, or a promise that will resolve to said array. | |
fn | function | The function to call for each element in the array. | |
self | SELF | <optional> | The object to be used as the value of 'this' within |
- Source
filterNonW3CCaps(capabilitiesnon-null) → (non-null) {Capabilities}
Name | Type | Description |
---|---|---|
capabilities | Capabilities | A capabilities object. |
- Source
A copy of the parameter capabilities, omitting capability names that are not valid W3C names.
- Type:
- Capabilities
findFreePort(opt_hostopt) → (non-null) {Promise.<number>}
Name | Type | Attributes | Description |
---|---|---|---|
opt_host | string | <optional> | The bound host to test the {@code port} against. Defaults to {@code INADDR_ANY}. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
file | string | The file to locate on the PATH. | |
opt_checkCwd | boolean | <optional> | Whether to always start with the search with the current working directory, regardless of whether it is explicitly listed on the PATH. |
- Source
Path to the located file, or {@code null} if it could not be found.
- Type:
- string
formatSpawnArgs(seleniumStandalonePath, args) → {Array.<string>}
Name | Type | Description |
---|---|---|
seleniumStandalonePath | string | path to standalone server |
args | Array.<string> | spawn arguments array returns formatted args based on selenium standalone server version |
- Source
- 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.
Name | Type | Description |
---|---|---|
driver | WebDriver | The driver to use as the parent of any unwrapped WebElement values. |
value | * | The value to convert. |
- Source
The converted value.
- Type:
- *
(async) fullyResolveKeys(objnon-null) → (non-null) {Thenable}
Name | Type | Description |
---|---|---|
obj | Array | | the object to resolve. |
- Source
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.
Name | Type | Description |
---|---|---|
value | * | The value to fully resolve. |
- Source
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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
family | string | <optional> | IPv4 | The IP family to retrieve. Defaults to "IPv4". |
- Source
The IP address or undefined if not available.
- Type:
- string |
undefined
getAvailableBrowsers() → (non-null) {Array.<!TargetBrowser>}
- Source
the browsers available for testing on this system.
- Type:
- Array.<!TargetBrowser>
getBinary() → {string}
Determines the path of the correct Selenium Manager binary
- Source
- Type:
- string
getBinaryPaths(capabilities) → {Object}
Determines the path of the correct Selenium Manager binary
Name | Type | Description |
---|---|---|
capabilities | Capabilities | browser options to fetch the driver |
- Source
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.
- Source
[] the browsers to target.
- Type:
- Object
(async) getBrowsingContextInstance(driver, browsingContextId, type, createParameters) → {Promise.<BrowsingContext>}
initiate browsing context instance and return
Name | Type | Description |
---|---|---|
driver | ||
browsingContextId | The browsing context of current window/tab | |
type | "window" or "tab" | |
createParameters | The parameters for creating a new browsing context |
- Source
- Type:
- Promise.<BrowsingContext>
getIPAddress(loopback, family) → {string|undefined}
Queries the system network interfaces for an IP address.
Name | Type | Description |
---|---|---|
loopback | boolean | Whether to find a loopback address. |
family | string | The IP family (IPv4 or IPv6). Defaults to IPv4. |
- Source
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
- Source
- 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.
Name | Type | Description |
---|---|---|
nameOrValue | number | | The log level name, or value, to convert. |
- Source
The converted level.
- Type:
- Level
(async) getLogInspectorInstance(driver, browsingContextIds) → {Promise.<LogInspector>}
initiate inspector instance and return
Name | Type | Description |
---|---|---|
driver | ||
browsingContextIds |
- Source
- 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.
Name | Type | Description |
---|---|---|
name | string | the logger's name. |
- Source
the requested logger.
- Type:
- Logger
getLoopbackAddress(familyopt) → {string|undefined}
Retrieves a loopback address for this machine.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
family | string | <optional> | IPv4 | The IP family to retrieve. Defaults to "IPv4". |
- Source
The IP address or undefined if not available.
- Type:
- string |
undefined
getRequestOptions(aUrl) → {RequestOptions}
Name | Type | Description |
---|---|---|
aUrl | string | The request URL to parse. |
- Source
if the URL does not include a hostname.
- Type
- Error
The request options.
- Type:
- RequestOptions
getStatus(url) → (non-null) {Promise.<!Object>}
Queries a WebDriver server for its current status.
Name | Type | Description |
---|---|---|
url | string | Base URL of the server to query. |
- Source
A promise that resolves with a hash of the server status.
- Type:
- Promise.<!Object>
getTestHook(name) → (non-null) {function}
Name | Type | Description |
---|---|---|
name | string |
- Source
- Type:
- function
headersToString(headersnon-null) → {string}
Converts a headers map to a HTTP header block string.
Name | Type | Description |
---|---|---|
headers | Map.<string, string> | The map to convert. |
- Source
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.
});
});
Name | Type | Description |
---|---|---|
predicateFn | function | A predicate to call to determine if the test should be suppressed. This function MUST be synchronous. |
- Source
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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
force | boolean | <optional> | false | whether to force this module to re-initialize and scan |
- Source
installConsoleHandler()
Installs the console log handler on the root logger.
- Source
isErrorResponse(data) → {boolean}
Tests if the given value is a valid error response object according to the W3C WebDriver spec.
Name | Type | Description |
---|---|---|
data | ? | The value to test. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
port | number | The port to test. | |
opt_host | string | <optional> | The bound host to test the {@code port} against. Defaults to {@code INADDR_ANY}. |
- Source
A promise that will resolve with whether the port is free.
- Type:
- Promise.<boolean>
isId(obj) → {boolean}
Name | Type | Description |
---|---|---|
obj | ? | the object to test. |
- Source
whether the object is a valid encoded WebElement ID.
- Type:
- boolean
isIdle(actionsnon-null) → {boolean}
Name | Type | Description |
---|---|---|
actions | Array.<!Action> |
- Source
- Type:
- boolean
isObject(value) → {boolean}
Determines whether a {@code value} should be treated as an object.
Name | Type | Description |
---|---|---|
value | ? | The value to test. |
- Source
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.
Name | Type | Description |
---|---|---|
value | ? | The value to test. |
- Source
Whether the value is a promise.
- Type:
- boolean
isRetryableNetworkError(errnon-null) → {boolean}
Name | Type | Description |
---|---|---|
err | Error |
- Source
- Type:
- boolean
isSelenium3x(seleniumStandalonePath) → {boolean}
Name | Type | Description |
---|---|---|
seleniumStandalonePath | string | path to standalone server |
- Source
- Type:
- boolean
legacyTimeout(drivernon-null, type, ms) → (non-null) {Promise.<void>}
Name | Type | Description |
---|---|---|
driver | WebDriver | |
type | string | |
ms | number |
- Source
- Type:
- Promise.<void>
load(path) → (non-null) {Promise.<!Zip>}
Asynchronously opens a zip archive.
Name | Type | Description |
---|---|---|
path | string | to the zip archive to load. |
a promise that will resolve with the opened archive.
- Type:
- Promise.<!Zip>
locate(filePath) → {string}
Locates a test resource.
Name | Type | Description |
---|---|---|
filePath | string | The file to locate from the root of the project. |
- Source
If the file does not exist.
- Type
- Error
The full path for the file, if it exists.
- Type:
- string
locateWith(A) → {RelativeBy}
Start searching for relative objects using search criteria with By.
Name | Type | Description |
---|---|---|
A | string | By map that shows how to find the initial element |
- Type:
- RelativeBy
manual(options) → (non-null) {ManualConfig}
Manually configures the browser proxy. The following options are supported:
ftp
: Proxy host to use for FTP requestshttp
: Proxy host to use for HTTP requestshttps
: Proxy host to use for HTTPS requestsbypass
: 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.
Name | Type | Description |
---|---|---|
options | Object | Proxy configuration options. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
array | Array.<TYPE> | | The array to iterate over, or a promise that will resolve to said array. | |
fn | function | The function to call for each element in the array. This function should expect three arguments (the element, the index, and the array itself. | |
self | SELF | <optional> | The object to be used as the value of 'this' within |
- Source
mkdir(aPath) → (non-null) {Promise.<string>}
Creates a directory.
Name | Type | Description |
---|---|---|
aPath | string | The directory path. |
- Source
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.
Name | Type | Description |
---|---|---|
dir | string | The directory path to create. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
var_args | string | <repeatable> | The targets to build. |
- Source
If not running in dev mode.
- Type
- Error
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.
Name | Type | Description |
---|---|---|
proxyAutoconfigUrl | string | URL for the PAC proxy to use. |
- Source
A new proxy configuration object.
- Type:
- PacConfig
pad(n) → {string}
Pads a number to ensure it has a minimum of two digits.
Name | Type | Description |
---|---|---|
n | number | the number to be padded. |
- Source
the padded number.
- Type:
- string
parseHttpResponse(commandnon-null, httpResponsenon-null) → {Object}
Callback used to parse Response objects from a HttpClient.
Name | Type | Description |
---|---|---|
command | cmd. | The command the response is for. |
httpResponse | Response | The HTTP response to parse. |
- Source
If the HTTP response is an error.
- Type
- WebDriverError
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}
- Source
If not running in dev mode.
- Type
- Error
Absolute path of the project's root directory.
- Type:
- string
read(aPath) → (non-null) {Promise.<!Buffer>}
Reads the contents of the given file.
Name | Type | Description |
---|---|---|
aPath | string | Path to the file to read. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
opt_logger | Logger | <optional> | The logger to remove the handler from; defaults to the root logger. |
- Source
- See
- exports.addConsoleHandler
requireAtom(module, bazelTarget) → (non-null) {function}
Name | Type | Description |
---|---|---|
module | string | |
bazelTarget | string |
- Source
- Type:
- function
resolveCommandLineFlags(argsnon-null) → (non-null) {Promise.<!Array.<string>>}
Name | Type | Description |
---|---|---|
args | Array.<CommandLineFlag> | |
- Source
- Type:
- Promise.<!Array.<string>>
resolveWaitMessage(messageopt) → {string}
Resolves a wait message from either a function or a string.
Name | Type | Attributes | Description |
---|---|---|---|
message | string | | <optional> | An optional message to use if the wait times out. |
- Source
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.
Name | Type | Description |
---|---|---|
dirPath | string | Path to the directory to remove. |
- Source
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.
Name | Type | Description |
---|---|---|
request | http. | The request object. |
response | http. | The response object. |
- Source
sendRequest(optionsnon-null, onOk, onError, opt_dataopt, nullable, opt_proxyopt, nullable, opt_retriesopt)
Sends a single HTTP request.
Name | Type | Attributes | Description |
---|---|---|---|
options | Object | The request options. | |
onOk | function | The function to call if the request succeeds. | |
onError | function | The function to call if the request fails. | |
opt_data | string | <optional> <nullable> | The data to send with the request. |
opt_proxy | RequestOptions | <optional> <nullable> | The proxy server to use for the request. |
opt_retries | number | <optional> | The current number of retries. |
- Source
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).
Name | Type | Description |
---|---|---|
caps | Capabilities | The capabilities to serialize. |
- Source
The JSON representation of this instance. Note, the returned object may contain nested promised values.
- Type:
- Object.<string, ?>
setFileDetector(detector)
Name | Type | Description |
---|---|---|
detector | input. |
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
Name | Type | Description |
---|---|---|
retries | number | |
err | Error |
- Source
- 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'));
Name | Type | Attributes | Description |
---|---|---|---|
socksProxy | string | The proxy host, in the form | |
socksVersion | number | <optional> | The SOCKS proxy version. |
- Source
A new proxy configuration object.
- Type:
- ManualConfig
splitHostAndPort(hostport) → {Object}
Splits a hostport string, e.g. "www.example.com:80", into its component parts.
Name | Type | Description |
---|---|---|
hostport | string | The string to split. |
- Source
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.
Name | Type | Description |
---|---|---|
element |
- Source
The new condition.
- Type:
- Condition.<boolean>
startSeleniumServer(jar) → (non-null) {Promise.<string>}
Starts an instance of the Selenium server if not yet running.
Name | Type | Description |
---|---|---|
jar | string | Path to the server jar to use. |
A promise for the server's address once started.
- Type:
- Promise.<string>
stat(aPath) → (non-null) {Promise.<!fs.Stats>}
Calls stat(2)
.
Name | Type | Description |
---|---|---|
aPath | string | The path to stat. |
- Source
A promise for the file stats.
- Type:
- Promise.<!fs.Stats>
suite(fn, optionsopt)
Name | Type | Attributes | Description |
---|---|---|---|
fn | function | The top level suite function. | |
options | testing. | <optional> | Suite specific options. |
- Source
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
Name | Type | Attributes | Description |
---|---|---|---|
fn | function | the function to call to build the test suite. | |
options | SuiteOptions | <optional> | configuration options. |
- Source
system() → (non-null) {Config}
Configures WebDriver to use the current system's proxy.
- Source
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
});
Name | Type | Description |
---|---|---|
promise | IThenable.<?> | The promise to add the listener to. |
callback | function | The function to call when the promise is resolved. |
- Source
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.
Name | Type | Description |
---|---|---|
data | Object | The error data to decode. |
- Source
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.
Name | Type | Description |
---|---|---|
substr | string | The substring that should be present in the page title. |
- Source
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.
Name | Type | Description |
---|---|---|
title | string | The expected page title. |
- Source
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.
Name | Type | Description |
---|---|---|
regex | RegExp | The regular expression to test against. |
- Source
The new condition.
- Type:
- Condition.<boolean>
tmpDir() → (non-null) {Promise.<string>}
- Source
A promise for the path to a temporary directory.
- Type:
- Promise.<string>
tmpFile(opt_optionsopt) → (non-null) {Promise.<string>}
Name | Type | Attributes | Description |
---|---|---|---|
opt_options | Object | <optional> | Temporary file options. |
- Source
A promise for the path to a temporary file.
- Type:
- Promise.<string>
toExecuteAtomCommand(commandnon-null, atom, …params) → (non-null) {Command}
Name | Type | Attributes | Description |
---|---|---|---|
command | cmd. | The initial command. | |
atom | Atom | The name of the atom to execute. | |
params | <repeatable> |
- Source
The transformed command to execute.
- Type:
- Command
toMap(hashnon-null) → (non-null) {Map.<string, ?>}
Converts a generic hash object to a map.
Name | Type | Description |
---|---|---|
hash | Object.<string, ?> | The hash object. |
- Source
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:
- if the object is a WebElement, the return value will be the element's server ID
- if the object defines a Symbols.serialize method, this algorithm will be recursively applied to the object's serialized representation
- if the object provides a "toJSON" function, this algorithm will recursively be applied to the result of that function
- otherwise, the value of each key will be recursively converted according to the rules above.
Name | Type | Description |
---|---|---|
obj | * | The object to convert. |
- Source
A promise that will resolve to the input value's JSON representation.
- Type:
- Promise.<?>
tryParse(str) → {?}
Name | Type | Description |
---|---|---|
str | string | . |
- Source
.
- Type:
- ?
unlink(aPath) → (non-null) {Promise}
Deletes a name from the filesystem and possibly the file it refers to. Has no effect if the file does not exist.
Name | Type | Description |
---|---|---|
aPath | string | The path to remove. |
- Source
A promise for when the file has been removed.
- Type:
- Promise
unzip(src, dst) → (non-null) {Promise.<string>}
Asynchronously unzips an archive file.
Name | Type | Description |
---|---|---|
src | string | path to the source file to unzip. |
dst | string | path to the destination directory. |
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.
Name | Type | Description |
---|---|---|
substrUrl | string | The substring that should be present in the current URL. |
- Source
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.
Name | Type | Description |
---|---|---|
url | string | The expected page url. |
- Source
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.
Name | Type | Description |
---|---|---|
regex | RegExp | The regular expression to test against. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | Base URL of the server to query. | |
timeout | number | How long to wait for the server. | |
opt_cancelToken | Promise | <optional> | A promise used as a cancellation signal: if resolved before the server is ready, the wait will be terminated early with a CancellationError. |
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | The URL to poll. | |
timeout | number | How long to wait, in milliseconds. | |
opt_cancelToken | Promise | <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. |
- Source
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.
Name | Type | Description |
---|---|---|
rootPath | string | the directory to walk. |
- Source
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.
Name | Type | Description |
---|---|---|
filePath | string | A path relative to //common/src/web to compute a URL for. |
- Source
If the server is not running.
- Type
- Error
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
.
Name | Type | Description |
---|---|---|
The | By | value returned from calling By.tagName() |
write(aPath, data) → (non-null) {Promise}
Writes to a file.
Name | Type | Description |
---|---|---|
aPath | string | Path to the file to write to. |
data | string | | The data to write. |
- Source
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.
- Object |
Object | Object | Object | Object | Object | Object | Object | Object
CommandLineFlag
- string |
!IThenable.<string>
- Source
CommandSpec
- Object
- Source
CommandTransformer()
- Source
RequestOptions
- Object
- Source
StdIoOptions
- string |
!Array.<(string|number|!stream.Stream|null|undefined)>
- Source