Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

selenium-webdriver

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selenium-webdriver - npm Package Compare versions

Comparing version 2.39.0 to 2.40.0

docs/class_bot_Error.html

78

_base.js

@@ -20,7 +20,7 @@ // Copyright 2012 Selenium committers

*
* Each script loaded by this module will be granted access to this module's
* <p>Each script loaded by this module will be granted access to this module's
* {@code require} function; all required non-native modules must be specified
* relative to <em>this</em> module.
*
* This module will load all scripts from the "lib" subdirectory, unless the
* <p>This module will load all scripts from the "lib" subdirectory, unless the
* SELENIUM_DEV_MODE environment variable has been set to 1, in which case all

@@ -48,2 +48,8 @@ * scripts will be loaded from the Selenium client containing this script.

/** @return {boolean} Whether this script was loaded in dev mode. */
function isDevMode() {
return devMode;
}
/**

@@ -53,3 +59,8 @@ * @type {string} Path to Closure's base file, relative to this module.

*/
var CLOSURE_BASE_FILE_PATH = computeClosureBasePath();
var CLOSURE_BASE_FILE_PATH = (function() {
var relativePath = isDevMode() ?
'../../../third_party/closure/goog/base.js' :
'./lib/goog/base.js';
return path.join(__dirname, relativePath);
})();

@@ -61,6 +72,23 @@

*/
var DEPS_FILE_PATH = computeDepsPath();
var DEPS_FILE_PATH = (function() {
var relativePath = isDevMode() ?
'../../../javascript/deps.js' :
'./lib/goog/deps.js';
return path.join(__dirname, relativePath);
})();
/**
* Synchronously loads a script into the protected Closure context.
* @param {string} src Path to the file to load.
*/
function loadScript(src) {
src = path.normalize(src);
var contents = fs.readFileSync(src, 'utf8');
vm.runInContext(contents, closure, src);
}
/**
* The protected context to host the Closure library.

@@ -85,6 +113,8 @@ * @type {!Object}

},
CLOSURE_NO_DEPS: !isDevMode()
CLOSURE_NO_DEPS: !isDevMode(),
goog: {}
});
closure.window = closure;
loadScript(CLOSURE_BASE_FILE_PATH);

@@ -97,3 +127,3 @@ loadScript(DEPS_FILE_PATH);

* @param {string} symbol The symbol to load.
* @return {*} The loaded symbol.
* @return {?} The loaded symbol, or {@code null} if not found.
* @throws {Error} If the symbol has not been defined.

@@ -107,38 +137,2 @@ */

/** @return {string} Path to the closure library's base script. */
function computeClosureBasePath() {
var relativePath = isDevMode() ?
'../../../third_party/closure/goog/base.js' :
'./lib/goog/base.js';
return path.join(__dirname, relativePath);
}
/** @return {string} Path to the deps file used to locate closure resources. */
function computeDepsPath() {
var relativePath = isDevMode() ?
'../../../javascript/deps.js' :
'./lib/deps.js';
return path.join(__dirname, relativePath);
}
/** @return {boolean} Whether this script was loaded in dev mode. */
function isDevMode() {
return devMode;
}
exports.isDevMode = isDevMode;
/**
* Synchronously loads a script into the protected Closure context.
* @param {string} src Path to the file to load.
*/
function loadScript(src) {
src = path.normalize(src);
var contents = fs.readFileSync(src, 'utf8');
vm.runInContext(contents, closure, src);
}
// PUBLIC API

@@ -145,0 +139,0 @@

@@ -53,2 +53,3 @@ // Copyright 2011 Software Freedom Conservancy. All Rights Reserved.

/**
* Creates new {@link webdriver.WebDriver WebDriver} instances.
* @constructor

@@ -67,3 +68,3 @@ * @extends {webdriver.AbstractBuilder}

* overwrite these settings.
* @param {!ProxyConfig} config The configuration to use.
* @param {!proxy.ProxyConfig} config The configuration to use.
* @return {!Builder} A self reference.

@@ -70,0 +71,0 @@ */

@@ -0,1 +1,12 @@

## v2.40.0
* API documentation is now included in the docs directory.
* Added utility functions for working with an array of promises:
`promise.all`, `promise.map`, and `promise.filter`
* Introduced `Promise#thenCatch()` and `Promise#thenFinally()`.
* Deprecated `Promise#addCallback()`, `Promise#addCallbacks()`,
`Promise#addErrback()`, and `Promise#addBoth()`.
* Removed deprecated function `webdriver.WebDriver#getCapability`.
* FIXED: 6826: Added support for custom locators.
## v2.39.0

@@ -2,0 +13,0 @@

@@ -48,2 +48,3 @@ // Copyright 2013 Selenium committers

var ServiceBuilder = function(opt_exe) {
/** @private {string} */
this.exe_ = opt_exe || io.findInPath(CHROMEDRIVER_EXE, true);

@@ -62,2 +63,3 @@ if (!this.exe_) {

/** @private {!Array.<string>} */
this.args_ = [];

@@ -64,0 +66,0 @@ this.stdio_ = 'ignore';

@@ -20,5 +20,5 @@ // Copyright 2013 Software Freedom Conservancy. All Rights Reserved.

var webdriver = require('./index'),
HttpClient = require('./http').HttpClient,
HttpExecutor = require('./http').Executor;
var HttpClient = require('./http').HttpClient,
HttpExecutor = require('./http').Executor,
promise = require('./_base').require('webdriver.promise');

@@ -56,3 +56,3 @@

exports.createExecutor = function(url) {
return new DeferredExecutor(webdriver.promise.when(url, function(url) {
return new DeferredExecutor(promise.when(url, function(url) {
var client = new HttpClient(url);

@@ -59,0 +59,0 @@ return new HttpExecutor(client);

@@ -28,3 +28,4 @@ // Copyright 2011 Software Freedom Conservancy. All Rights Reserved.

/**
* HTTP client for use with NodeJS.
* A {@link webdriver.http.Client} implementation using Node's built-in http
* module.
* @param {string} serverUrl URL for the WebDriver server to send commands to.

@@ -142,7 +143,11 @@ * @constructor

/** @type {webdriver.http.Executor.} */
exports.Executor = base.require('webdriver.http.Executor');
exports.Executor = base.require('webdriver.http.Executor');
/** @type {webdriver.http.Request.} */
exports.Request = base.require('webdriver.http.Request');
/** @type {webdriver.http.Response.} */
exports.Response = base.require('webdriver.http.Response');
exports.HttpClient = HttpClient;
exports.util = require('./util');

@@ -22,40 +22,102 @@ // Copyright 2012 Selenium committers

var base = require('./_base');
var builder = require('./builder');
var error = require('./error');
// NOTE: the remainder of this file is nasty and verbose, but the annotations
// are necessary to guide the Closure Compiler's type analysis. Without them,
// we would not be able to extract any meaningful API documentation.
/** @type {function(new: webdriver.ActionSequence)} */
exports.ActionSequence = base.require('webdriver.ActionSequence');
exports.Builder = require('./builder').Builder;
exports.Button = base.require('webdriver.Button');
exports.By = base.require('webdriver.Locator.Strategy');
/** @type {function(new: builder.Builder)} */
exports.Builder = builder.Builder;
/** @type {webdriver.By.} */
exports.By = base.require('webdriver.By');
/** @type {function(new: webdriver.Capabilities)} */
exports.Capabilities = base.require('webdriver.Capabilities');
/** @type {function(new: webdriver.Command)} */
exports.Command = base.require('webdriver.Command');
/** @type {function(new: webdriver.EventEmitter)} */
exports.EventEmitter = base.require('webdriver.EventEmitter');
/** @type {function(new: webdriver.Session)} */
exports.Session = base.require('webdriver.Session');
/** @type {function(new: webdriver.WebDriver)} */
exports.WebDriver = base.require('webdriver.WebDriver');
/** @type {function(new: webdriver.WebElement)} */
exports.WebElement = base.require('webdriver.WebElement');
var closureModules = {
Browser: base.require('webdriver.Browser'),
Capability: base.require('webdriver.Capability'),
CommandName: base.require('webdriver.CommandName'),
Key: base.require('webdriver.Key'),
command: {
Command: base.require('webdriver.Command'),
CommandName: base.require('webdriver.CommandName')
},
error: {
Error: base.require('bot.Error'),
ErrorCode: base.require('bot.ErrorCode')
},
events: {
EventEmitter: base.require('webdriver.EventEmitter')
},
logging: base.exportPublicApi('webdriver.logging'),
promise: base.exportPublicApi('webdriver.promise'),
stacktrace: base.exportPublicApi('webdriver.stacktrace')
};
// Export the remainder of our API through getters to keep things cleaner
// when this module is used in a REPL environment.
Object.keys(closureModules).forEach(function(key) {
exports.__defineGetter__(key, function() {
return closureModules[key];
});
});
/** @type {webdriver.Browser.} */
(exports.__defineGetter__('Browser', function() {
return base.require('webdriver.Browser');
}));
/** @type {webdriver.Button.} */
(exports.__defineGetter__('Button', function() {
return base.require('webdriver.Button');
}));
/** @type {webdriver.Capability.} */
(exports.__defineGetter__('Capability', function() {
return base.require('webdriver.Capability');
}));
/** @type {webdriver.CommandName.} */
(exports.__defineGetter__('CommandName', function() {
return base.require('webdriver.CommandName');
}));
/** @type {webdriver.Key.} */
(exports.__defineGetter__('Key', function() {
return base.require('webdriver.Key');
}));
/** @type {error.} */
(exports.__defineGetter__('error', function() {
return error;
}));
/** @type {error.} */
(exports.__defineGetter__('error', function() {
return error;
}));
/** @type {webdriver.promise.} */
(exports.__defineGetter__('promise', function() {
return base.exportPublicApi('webdriver.promise');
}));
/** @type {webdriver.stacktrace.} */
(exports.__defineGetter__('stacktrace', function() {
return base.exportPublicApi('webdriver.stacktrace');
}));

@@ -27,3 +27,3 @@ // Copyright 2013 Selenium committers

/**
* Searches the PATH environment variable for the given file.
* Searches the {@code PATH} environment variable for the given file.
* @param {string} file The file to locate on the PATH.

@@ -30,0 +30,0 @@ * @param {boolean=} opt_checkCwd Whether to always start with the search with

@@ -19,7 +19,9 @@ // Copyright 2011 Software Freedom Conservancy. All Rights Reserved.

goog.provide('webdriver.By');
goog.provide('webdriver.Locator');
goog.provide('webdriver.Locator.Strategy');
goog.require('bot.json');
goog.require('goog.array');
goog.require('goog.object');
goog.require('goog.string');

@@ -42,3 +44,3 @@

/**u
/**
* The search target for this locator.

@@ -52,5 +54,5 @@ * @type {string}

/**
* Creates a factory function for a {@code webdriver.Locator}.
* Creates a factory function for a {@link webdriver.Locator}.
* @param {string} type The type of locator for the factory.
* @return {function(string):!webdriver.Locator} The new factory function.
* @return {function(string): !webdriver.Locator} The new factory function.
* @private

@@ -66,37 +68,159 @@ */

/**
* Factory methods for the supported locator strategies.
* @type {Object.<function(string):!webdriver.Locator>}
* A collection of factory functions for creating {@link webdriver.Locator}
* instances.
*/
webdriver.Locator.Strategy = {
'className': webdriver.Locator.factory_('class name'),
'class name': webdriver.Locator.factory_('class name'),
'css': webdriver.Locator.factory_('css selector'),
'id': webdriver.Locator.factory_('id'),
'js': webdriver.Locator.factory_('js'),
'linkText': webdriver.Locator.factory_('link text'),
'link text': webdriver.Locator.factory_('link text'),
'name': webdriver.Locator.factory_('name'),
'partialLinkText': webdriver.Locator.factory_('partial link text'),
'partial link text': webdriver.Locator.factory_('partial link text'),
'tagName': webdriver.Locator.factory_('tag name'),
'tag name': webdriver.Locator.factory_('tag name'),
'xpath': webdriver.Locator.factory_('xpath')
webdriver.By = {};
// Exported to the global scope for legacy reasons.
goog.exportSymbol('By', webdriver.By);
/**
* Short-hand expressions for the primary element locator strategies.
* For example the following two statements are equivalent:
* <code><pre>
* var e1 = driver.findElement(webdriver.By.id('foo'));
* var e2 = driver.findElement({id: 'foo'});
* </pre></code>
*
* <p>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 below.
*
* @typedef {(
* {className: string}|
* {css: string}|
* {id: string}|
* {js: string}|
* {linkText: string}|
* {name: string}|
* {partialLinkText: string}|
* {tagName: string}|
* {xpath: string})}
*/
webdriver.By.Hash;
/**
* Locates elements that have a specific class name. The returned locator
* is equivalent to searching for elements with the CSS selector ".clazz".
*
* @param {string} className The class name to search for.
* @return {!webdriver.Locator} The new locator.
* @see http://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes
* @see http://www.w3.org/TR/CSS2/selector.html#class-html
*/
webdriver.By.className = webdriver.Locator.factory_('class name');
/**
* Locates elements using a CSS selector. For browsers that do not support
* CSS selectors, WebDriver implementations may return an
* {@link bot.Error.State.INVALID_SELECTOR invalid selector} error. An
* implementation may, however, emulate the CSS selector API.
*
* @param {string} selector The CSS selector to use.
* @return {!webdriver.Locator} The new locator.
* @see http://www.w3.org/TR/CSS2/selector.html
*/
webdriver.By.css = webdriver.Locator.factory_('css selector');
/**
* Locates an element by its ID.
*
* @param {string} id The ID to search for.
* @return {!webdriver.Locator} The new locator.
*/
webdriver.By.id = webdriver.Locator.factory_('id');
/**
* Locates link elements whose {@link webdriver.WebElement#getText visible
* text} matches the given string.
*
* @param {string} text The link text to search for.
* @return {!webdriver.Locator} The new locator.
*/
webdriver.By.linkText = webdriver.Locator.factory_('link text');
/**
* Locates an elements by evaluating a
* {@link webdriver.WebDriver#executeScript JavaScript expression}.
* The result of this expression must be an element or list of elements.
*
* @param {!(string|Function)} script The script to execute.
* @param {...*} var_args The arguments to pass to the script.
* @return {function(!webdriver.WebDriver): !webdriver.promise.Promise} A new,
* JavaScript-based locator function.
*/
webdriver.By.js = function(script, var_args) {
var args = goog.array.slice(arguments, 0);
return function(driver) {
return driver.executeScript.apply(driver, args);
};
};
goog.exportSymbol('By', webdriver.Locator.Strategy);
/**
* Creates a new Locator from an object whose only property is also a key in
* the {@code webdriver.Locator.Strategy} map.
* @param {Object.<string>} obj The object to convert into a locator.
* @return {webdriver.Locator} The new locator object.
* Locates elements whose {@code name} attribute has the given value.
*
* @param {string} name The name attribute to search for.
* @return {!webdriver.Locator} The new locator.
*/
webdriver.Locator.createFromObj = function(obj) {
var key = goog.object.getAnyKey(obj);
if (!key) {
throw Error('No keys found in locator hash object');
} else if (key in webdriver.Locator.Strategy) {
return webdriver.Locator.Strategy[key](obj[key]);
}
throw Error('Unsupported locator strategy: ' + key);
webdriver.By.name = webdriver.Locator.factory_('name');
/**
* Locates link elements whose {@link webdriver.WebElement#getText visible
* text} contains the given substring.
*
* @param {string} text The substring to check for in a link's visible text.
* @return {!webdriver.Locator} The new locator.
*/
webdriver.By.partialLinkText = webdriver.Locator.factory_(
'partial link text');
/**
* Locates elements with a given tag name. The returned locator is
* equivalent to using the {@code getElementsByTagName} DOM function.
*
* @param {string} text The substring to check for in a link's visible text.
* @return {!webdriver.Locator} The new locator.
* @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html
*/
webdriver.By.tagName = webdriver.Locator.factory_('tag name');
/**
* Locates elements matching a XPath selector. Care should be taken when
* using an XPath selector with a {@link webdriver.WebElement} as WebDriver
* will respect the context in the specified in the selector. For example,
* given the selector {@code "//div"}, WebDriver will search from the
* document root regardless of whether the locator was used with a
* WebElement.
*
* @param {string} xpath The XPath selector to use.
* @return {!webdriver.Locator} The new locator.
* @see http://www.w3.org/TR/xpath/
*/
webdriver.By.xpath = webdriver.Locator.factory_('xpath');
/**
* Maps {@link webdriver.By.Hash} keys to the appropriate factory function.
* @type {!Object.<string, function(string): !(Function|webdriver.Locator)>}
* @const
*/
webdriver.Locator.Strategy = {
'className': webdriver.By.className,
'css': webdriver.By.css,
'id': webdriver.By.id,
'js': webdriver.By.js,
'linkText': webdriver.By.linkText,
'name': webdriver.By.name,
'partialLinkText': webdriver.By.partialLinkText,
'tagName': webdriver.By.tagName,
'xpath': webdriver.By.xpath
};

@@ -106,22 +230,29 @@

/**
* Verifies that a {@code locator} is a valid locator to use for searching for
* Verifies that a {@code value} is a valid locator to use for searching for
* elements on the page.
* @param {webdriver.Locator|Object.<string>} locator The locator
* to verify, or a short-hand object that can be converted into a locator
* to verify.
* @return {!webdriver.Locator} The validated locator.
*
* @param {*} value The value to check is a valid locator.
* @return {!(webdriver.Locator|Function)} A valid locator object or function.
* @throws {TypeError} If the given value is an invalid locator.
*/
webdriver.Locator.checkLocator = function(locator) {
if (!locator.using || !locator.value) {
locator = webdriver.Locator.createFromObj(locator);
webdriver.Locator.checkLocator = function(value) {
if (goog.isFunction(value) || value instanceof webdriver.Locator) {
return value;
}
return /**@type {!webdriver.Locator} */ (locator);
for (var key in value) {
if (value.hasOwnProperty(key) &&
webdriver.Locator.Strategy.hasOwnProperty(key)) {
return webdriver.Locator.Strategy[key](value[key]);
}
}
throw new TypeError('Invalid locator');
};
/** @return {string} String representation of this locator. */
/** @override */
webdriver.Locator.prototype.toString = function() {
return 'By.' + this.using.replace(/ ([a-z])/g, function(all, match) {
return match.toUpperCase();
}) + '(' + bot.json.stringify(this.value) + ')';
}) + '(' + goog.string.quote(this.value) + ')';
};

@@ -54,3 +54,3 @@ // Copyright 2013 Selenium committers

findWindowsPortRange() : findUnixPortRange();
return systemRange = range.addErrback(function() {
return systemRange = range.thenCatch(function() {
return DEFAULT_IANA_RANGE;

@@ -148,2 +148,4 @@ });

* @param {number} port The port to test.
* @param {string=} opt_host The bound host to test the {@code port} against.
* Defaults to {@code INADDR_ANY}.
* @return {!webdriver.promise.Promise.<boolean>} A promise that will resolve

@@ -176,2 +178,4 @@ * with whether the port is free.

/**
* @param {string=} opt_host The bound host to test the {@code port} against.
* Defaults to {@code INADDR_ANY}.
* @return {!webdriver.promise.Promise.<number>} A promise that will resolve

@@ -178,0 +182,0 @@ * to a free port. If a port cannot be found, the promise will be

{
"name": "selenium-webdriver",
"version": "2.39.0",
"version": "2.40.0",
"description": "The official WebDriver JavaScript bindings from the Selenium project",

@@ -5,0 +5,0 @@ "keywords": [

@@ -155,3 +155,3 @@ // Copyright 2013 Selenium committers

driver.quit = function() {
return boundQuit().addBoth(service.kill.bind(service));
return boundQuit().thenFinally(service.kill.bind(service));
};

@@ -158,0 +158,0 @@ return driver;

@@ -15,2 +15,15 @@ // Copyright 2013 Selenium committers

/**
* @fileoverview Defines functions for configuring a webdriver proxy:
* <pre><code>
* var webdriver = require('selenium-webdriver'),
* proxy = require('selenium-webdriver/proxy');
*
* var driver = new webdriver.Builder()
* .withCapabilities(webdriver.Capabilities.chrome())
* .setProxy(proxy.manual({http: 'host:1234'}))
* .build();
* </code></pre>
*/
'use strict';

@@ -23,10 +36,11 @@

* Proxy configuration object, as defined by the WebDriver wire protocol.
* @typedef {{
* proxyType: string,
* ftpProxy: (string|undefined),
* httpProxy: (string|undefined),
* sslProxy: (string|undefined),
* noProxy: (string|undefined),
* proxyAutoconfigUrl: (string|undefined)
* }}
* @typedef {(
* {proxyType: string}|
* {proxyType: string,
* proxyAutoconfigUrl: string}|
* {proxyType: string,
* ftpProxy: string,
* httpProxy: string,
* sslProxy: string,
* noProxy: string})}
*/

@@ -52,8 +66,10 @@ var ProxyConfig;

* 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.
* <ul>
* <li>{@code ftp}: Proxy host to use for FTP requests
* <li>{@code http}: Proxy host to use for HTTP requests
* <li>{@code https}: Proxy host to use for HTTPS requests
* <li>{@code 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.
* </ul>
*

@@ -60,0 +76,0 @@ * Behavior is undefined for FTP, HTTP, and HTTPS requests if the

@@ -18,3 +18,3 @@ # selenium-webdriver

_(New in 2.34.0)_ To run the tests, you will need to download a copy of the
To run the tests, you will need to download a copy of the
[ChromeDriver](http://chromedriver.storage.googleapis.com/index.html) and make

@@ -64,2 +64,14 @@ sure it can be found on your `PATH`.

[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0 "Apache 2")
Copyright 2009-2014 Software Freedom Conservancy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@@ -32,14 +32,17 @@ // Copyright 2013 Software Freedom Conservancy

* Configuration options for a DriverService instance.
* - port: The port to start the server on (must be > 0). If the port is
* provided as a promise, the service will wait for the promise to
* <ul>
* <li>{@code port} - The port to start the server on (must be > 0). If the
* port is provided as a promise, the service will wait for the promise to
* resolve before starting.
* - args: The arguments to pass to the service. If a promise is provided,
* the service will wait for it to resolve before starting.
* - path: The base path on the server for the WebDriver wire protocol
* (e.g. '/wd/hub'). Defaults to '/'.
* - env: The environment variables that should be visible to the server
* process. Defaults to inheriting the current process's environment.
* - stdio: IO configuration for the spawned server process. For more
* information, refer to the documentation of
* <li>{@code args} - The arguments to pass to the service. If a promise is
* provided, the service will wait for it to resolve before starting.
* <li>{@code path} - The base path on the server for the WebDriver wire
* protocol (e.g. '/wd/hub'). Defaults to '/'.
* <li>{@code env} - The environment variables that should be visible to the
* server process. Defaults to inheriting the current process's
* environment.
* <li>{@code stdio} - IO configuration for the spawned server process. For
* more information, refer to the documentation of
* {@code child_process.spawn}.
* </ul>
*

@@ -191,9 +194,7 @@ * @typedef {{

function onServerExit(code, signal) {
if (self.address_.isPending()) {
self.address_.reject(code == null ?
Error('Server was killed with ' + signal) :
Error('Server exited with ' + code));
}
self.address_.reject(code == null ?
Error('Server was killed with ' + signal) :
Error('Server exited with ' + code));
if (self.shutdownHook_ && self.shutdownHook_.isPending()) {
if (self.shutdownHook_) {
self.shutdownHook_.fulfill();

@@ -235,5 +236,6 @@ }

} else {
this.shutdownHook_ = this.address_.addBoth(function() {
this.process_ && this.process_.kill('SIGTERM');
}, this);
var self = this;
this.shutdownHook_ = this.address_.thenFinally(function() {
self.process_ && self.process_.kill('SIGTERM');
});
}

@@ -294,21 +296,17 @@ }

* Options for the Selenium server:
* <dl>
* <dt>port
* <dd>The port to start the server on (must be > 0). If the port is
* provided as a promise, the service will wait for the promise to
* <ul>
* <li>{@code port} - The port to start the server on (must be > 0). If the
* port is provided as a promise, the service will wait for the promise to
* resolve before starting.
* <dt>args
* <dd>The arguments to pass to the service. If a promise is provided,
* the service will wait for it to resolve before starting.
* <dt>jvmArgs
* <dd>The arguments to pass to the JVM. If a promise is provided, the service
* will wait for it to resolve before starting.
* <dt>env
* <dd>The environment variables that should be visible to the server
* process. Defaults to inheriting the current process's environment.
* <dt>stdio
* <dd>IO configuration for the spawned server process. For more
* information, refer to the documentation of
* <li>{@code args} - The arguments to pass to the service. If a promise is
* provided, the service will wait for it to resolve before starting.
* <li>{@code jvmArgs} - The arguments to pass to the JVM. If a promise is
* provided, the service will wait for it to resolve before starting.
* <li>{@code env} - The environment variables that should be visible to the
* server process. Defaults to inheriting the current process's
* environment.
* <li>{@code stdio} - IO configuration for the spawned server process. For
* more information, refer to the documentation of
* {@code child_process.spawn}.
* </dl>
* </ul>
*

@@ -320,3 +318,3 @@ * @typedef {{

* !webdriver.promise.Promise.<!Array.<string>>|
* undefined)
* undefined),
* env: (!Object.<string, string>|undefined),

@@ -331,8 +329,3 @@ * stdio: (string|!Array.<string|number|!Stream|null|undefined>|undefined)

/** @constructor */
exports.DriverService = DriverService;
/** @constructor */
exports.SeleniumServer = SeleniumServer;

@@ -69,3 +69,3 @@ // Copyright 2013 Selenium committers

assert.equal('abc123', response);
}).addBoth(done);
}).thenFinally(done);
});

@@ -80,3 +80,3 @@

assert.equal(value, err.message);
}).addBoth(done);
}).thenFinally(done);
});

@@ -92,3 +92,3 @@

// Expected.
}).addBoth(done);
}).thenFinally(done);
});

@@ -105,3 +105,3 @@ });

assert.equal(value, err.message);
}).addBoth(done);
}).thenFinally(done);
});

@@ -116,3 +116,3 @@ });

then(function() {}). // done needs no argument to pass.
addBoth(done);
thenFinally(done);
});

@@ -150,3 +150,3 @@

then(function() {}). // done needs no argument to pass.
addBoth(done);
thenFinally(done);
});

@@ -153,0 +153,0 @@

@@ -143,3 +143,3 @@ // Copyright 2013 Selenium committers

}).then(resetPageLoad, function(err) {
resetPageLoad().addBoth(function() {
resetPageLoad().thenFinally(function() {
throw err;

@@ -146,0 +146,0 @@ });

@@ -16,12 +16,14 @@ // Copyright 2013 Software Freedom Conservancy

/**
* @fileoverview Defines an assertion library that simplifies writing
* assertions against promised values.
* @fileoverview Defines a library that simplifies writing assertions against
* promised values.
*
* ---------------------------------------------------------------------------
* NOTE: This module is considered experimental and is subject to change,
* or removal, at any time!
* ---------------------------------------------------------------------------
* <blockquote>
* <hr>
* <b>NOTE:</b> This module is considered experimental and is subject to
* change, or removal, at any time!
* <hr>
* </blockquote>
*
* Sample usage:
*
* <pre><code>
* var driver = new webdriver.Builder().build();

@@ -31,2 +33,3 @@ * driver.get('http://www.google.com');

* assert(driver.getTitle()).equalTo('Google');
* </code></pre>
*/

@@ -41,2 +44,3 @@

/** @type {webdriver.testing.assert.} */
module.exports = assert;

@@ -18,15 +18,17 @@ // Copyright 2013 Selenium committers

* @fileoverview Provides wrappers around the following global functions from
* Mocha's BDD interface:
* after
* afterEach
* before
* beforeEach
* it
* it.only
* it.skip
* xit
* <a href="http://visionmedia.github.io/mocha/">Mocha's BDD interface</a>:
* <ul>
* <li>after
* <li>afterEach
* <li>before
* <li>beforeEach
* <li>it
* <li>it.only
* <li>it.skip
* <li>xit
* </ul>
*
* The provided wrappers leverage the webdriver.promise.ControlFlow to simplify
* writing asynchronous tests:
*
* <p>The provided wrappers leverage the webdriver.promise.ControlFlow to
* simplify writing asynchronous tests:
* <pre><code>
* var webdriver = require('selenium-webdriver'),

@@ -67,7 +69,8 @@ * remote = require('selenium-webdriver/remote'),

* });
* </code></pre>
*
* You may conditionally suppress a test function using the exported
* <p>You may conditionally suppress a test function using the exported
* "ignore" function. If the provided predicate returns true, the attached
* test case will be skipped:
*
* <pre><code>
* test.ignore(maybe()).it('is flaky', function() {

@@ -78,2 +81,3 @@ * if (Math.random() < 0.5) throw Error();

* function maybe() { return Math.random() < 0.5; }
* </code></pre>
*/

@@ -133,4 +137,4 @@

* if the test should be suppressed. This function MUST be synchronous.
* @return {!Object} An object with wrapped versions of exports.it and
* exports.describe that ignore tests as indicated by the predicate.
* @return {!Object} An object with wrapped versions of {@link #it()} and
* {@link #describe()} that ignore tests as indicated by the predicate.
*/

@@ -163,16 +167,68 @@ function ignore(predicateFn) {

/**
* Registers a new test suite.
* @param {string} name The suite name.
* @param {function()=} fn The suite function, or {@code undefined} to define
* a pending test suite.
*/
exports.describe = global.describe;
exports.describe = global.describe;
/**
* Defines a suppressed test suite.
* @param {string} name The suite name.
* @param {function()=} fn The suite function, or {@code undefined} to define
* a pending test suite.
*/
exports.xdescribe = global.xdescribe;
exports.describe.skip = global.describe.skip;
/**
* Register a function to call after the current suite finishes.
* @param {function()} fn .
*/
exports.after = wrapped(global.after);
/**
* Register a function to call after each test in a suite.
* @param {function()} fn .
*/
exports.afterEach = wrapped(global.afterEach);
/**
* Register a function to call before the current suite starts.
* @param {function()} fn .
*/
exports.before = wrapped(global.before);
/**
* Register a function to call before each test in a suite.
* @param {function()} fn .
*/
exports.beforeEach = wrapped(global.beforeEach);
/**
* Add a test to the current suite.
* @param {string} name The test name.
* @param {function()=} fn The test function, or {@code undefined} to define
* a pending test case.
*/
exports.it = wrapped(global.it);
exports.it.only = exports.iit = wrapped(global.it.only);
exports.it.skip = exports.xit = wrapped(global.xit);
/**
* An alias for {@link #it()} that flags the test as the only one that should
* be run within the current suite.
* @param {string} name The test name.
* @param {function()=} fn The test function, or {@code undefined} to define
* a pending test case.
*/
exports.iit = exports.it.only = wrapped(global.it.only);
/**
* Adds a test to the current suite while suppressing it so it is not run.
* @param {string} name The test name.
* @param {function()=} fn The test function, or {@code undefined} to define
* a pending test case.
*/
exports.xit = exports.it.skip = wrapped(global.xit);
exports.ignore = ignore;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc