Updates v2 folder with latest changes from master

This commit is contained in:
Simon Gellis 2017-03-07 22:24:10 -05:00
parent 7742000fb0
commit fcce73b891
16 changed files with 6463 additions and 6467 deletions

View File

@ -2,418 +2,414 @@
import * as webdriver from './index';
import * as remote from './remote';
declare namespace chrome {
/**
* Creates a new WebDriver client for Chrome.
*
* @extends {webdriver.WebDriver}
*/
export class Driver extends webdriver.WebDriver {
/**
* Creates a new WebDriver client for Chrome.
*
* @extends {webdriver.WebDriver}
* @param {(webdriver.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@link getDefaultService default service} by default.
* @param {webdriver.promise.ControlFlow=} opt_flow The control flow to use, or
* {@code null} to use the currently active flow.
* @constructor
*/
class Driver extends webdriver.WebDriver {
/**
* @param {(webdriver.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@link getDefaultService default service} by default.
* @param {webdriver.promise.ControlFlow=} opt_flow The control flow to use, or
* {@code null} to use the currently active flow.
* @constructor
*/
constructor(opt_config?: Options | webdriver.Capabilities, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
}
interface IOptionsValues {
args: string[];
binary?: string;
detach: boolean;
extensions: string[];
localState?: any;
logFile?: string;
prefs?: any;
}
interface IPerfLoggingPrefs {
enableNetwork: boolean;
enablePage: boolean;
enableTimeline: boolean;
tracingCategories: string;
bufferUsageReportingInterval: number;
}
/**
* Class for managing ChromeDriver specific options.
*/
class Options {
/**
* @constructor
*/
constructor();
/**
* Extracts the ChromeDriver specific options from the given capabilities
* object.
* @param {!webdriver.Capabilities} capabilities The capabilities object.
* @return {!Options} The ChromeDriver options.
*/
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
/**
* Add additional command line arguments to use when launching the Chrome
* browser. Each argument may be specified with or without the '--' prefix
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
* delimited by an '=': 'foo=bar'.
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: string[]): Options;
/**
* List of Chrome command line switches to exclude that ChromeDriver by default
* passes when starting Chrome. Do not prefix switches with '--'.
*
* @param {...(string|!Array<string>)} var_args The switches to exclude.
* @return {!Options} A self reference.
*/
excludeSwitches(...var_args: string[]): Options;
/**
* Add additional extensions to install when launching Chrome. Each extension
* should be specified as the path to the packed CRX file, or a Buffer for an
* extension.
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
* extensions to add.
* @return {!Options} A self reference.
*/
addExtensions(...var_args: any[]): Options;
/**
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
* reference the actual Chrome executable, not just the application binary
* (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').
*
* The binary path be absolute or relative to the chromedriver server
* executable, but it must exist on the machine that will launch Chrome.
*
* @param {string} path The path to the Chrome binary to use.
* @return {!Options} A self reference.
*/
setChromeBinaryPath(path: string): Options;
/**
* Sets whether to leave the started Chrome browser running if the controlling
* ChromeDriver service is killed before {@link webdriver.WebDriver#quit()} is
* called.
* @param {boolean} detach Whether to leave the browser running if the
* chromedriver service is killed before the session.
* @return {!Options} A self reference.
*/
detachDriver(detach: boolean): Options;
/**
* Sets the user preferences for Chrome's user profile. See the 'Preferences'
* file in Chrome's user data directory for examples.
* @param {!Object} prefs Dictionary of user preferences to use.
* @return {!Options} A self reference.
*/
setUserPreferences(prefs: any): Options;
/**
* Sets the logging preferences for the new session.
* @param {!webdriver.logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the performance logging preferences. Options include:
*
* - `enableNetwork`: Whether or not to collect events from Network domain.
* - `enablePage`: Whether or not to collect events from Page domain.
* - `enableTimeline`: Whether or not to collect events from Timeline domain.
* Note: when tracing is enabled, Timeline domain is implicitly disabled,
* unless `enableTimeline` is explicitly set to true.
* - `tracingCategories`: A comma-separated string of Chrome tracing categories
* for which trace events should be collected. An unspecified or empty
* string disables tracing.
* - `bufferUsageReportingInterval`: The requested number of milliseconds
* between DevTools trace buffer usage events. For example, if 1000, then
* once per second, DevTools will report how full the trace buffer is. If a
* report indicates the buffer usage is 100%, a warning will be issued.
*
* @param {{enableNetwork: boolean,
* enablePage: boolean,
* enableTimeline: boolean,
* tracingCategories: string,
* bufferUsageReportingInterval: number}} prefs The performance
* logging preferences.
* @return {!Options} A self reference.
*/
setPerfLoggingPrefs(prefs: IPerfLoggingPrefs): Options;
/**
* Sets preferences for the 'Local State' file in Chrome's user data
* directory.
* @param {!Object} state Dictionary of local state preferences.
* @return {!Options} A self reference.
*/
setLocalState(state: any): Options;
/**
* Sets the name of the activity hosting a Chrome-based Android WebView. This
* option must be set to connect to an [Android WebView](
* https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android)
*
* @param {string} name The activity name.
* @return {!Options} A self reference.
*/
androidActivity(name: string): Options;
/**
* Sets the device serial number to connect to via ADB. If not specified, the
* ChromeDriver will select an unused device at random. An error will be
* returned if all devices already have active sessions.
*
* @param {string} serial The device serial number to connect to.
* @return {!Options} A self reference.
*/
androidDeviceSerial(serial: string): Options;
/**
* Configures the ChromeDriver to launch Chrome on Android via adb. This
* function is shorthand for
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
* @return {!Options} A self reference.
*/
androidChrome(): Options;
/**
* Sets the package name of the Chrome or WebView app.
*
* @param {?string} pkg The package to connect to, or `null` to disable Android
* and switch back to using desktop Chrome.
* @return {!Options} A self reference.
*/
androidPackage(pkg: string): Options;
/**
* Sets the process name of the Activity hosting the WebView (as given by `ps`).
* If not specified, the process name is assumed to be the same as
* {@link #androidPackage}.
*
* @param {string} processName The main activity name.
* @return {!Options} A self reference.
*/
androidProcess(processName: string): Options;
/**
* Sets whether to connect to an already-running instead of the specified
* {@linkplain #androidProcess app} instead of launching the app with a clean
* data directory.
*
* @param {boolean} useRunning Whether to connect to a running instance.
* @return {!Options} A self reference.
*/
androidUseRunningApp(useRunning: boolean): Options;
/**
* Sets the path to Chrome's log file. This path should exist on the machine
* that will launch Chrome.
* @param {string} path Path to the log file to use.
* @return {!Options} A self reference.
*/
setChromeLogFile(path: string): Options;
/**
* Sets the directory to store Chrome minidumps in. This option is only
* supported when ChromeDriver is running on Linux.
* @param {string} path The directory path.
* @return {!Options} A self reference.
*/
setChromeMinidumpPath(path: string): Options;
/**
* Configures Chrome to emulate a mobile device. For more information, refer
* to the ChromeDriver project page on [mobile emulation][em]. Configuration
* options include:
*
* - `deviceName`: The name of a pre-configured [emulated device][devem]
* - `width`: screen width, in pixels
* - `height`: screen height, in pixels
* - `pixelRatio`: screen pixel ratio
*
* __Example 1: Using a Pre-configured Device__
*
* let options = new chrome.Options().setMobileEmulation(
* {deviceName: 'Google Nexus 5'});
*
* let driver = new chrome.Driver(options);
*
* __Example 2: Using Custom Screen Configuration__
*
* let options = new chrome.Options().setMobileEmulation({
* width: 360,
* height: 640,
* pixelRatio: 3.0
* });
*
* let driver = new chrome.Driver(options);
*
*
* [em]: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
* [devem]: https://developer.chrome.com/devtools/docs/device-mode
*
* @param {?({deviceName: string}|
* {width: number, height: number, pixelRatio: number})} config The
* mobile emulation configuration, or `null` to disable emulation.
* @return {!Options} A self reference.
*/
setMobileEmulation(config: any): Options;
/**
* Sets the proxy settings for the new session.
* @param {webdriver.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link webdriver.Capabilities} object.
* @param {webdriver.Capabilities=} opt_capabilities The capabilities to merge
* these options into, if any.
* @return {!webdriver.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* Creates {@link remote.DriverService} instances that manage a ChromeDriver
* server.
*/
class ServiceBuilder {
/**
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the chromedriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the chromedriver
* cannot be found on the PATH.
* @constructor
*/
constructor(opt_exe?: string);
/**
* Sets the port to start the ChromeDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
usingPort(port: number): ServiceBuilder;
/**
* Sets which port adb is listening to. _The ChromeDriver will connect to adb
* if an {@linkplain Options#androidPackage Android session} is requested, but
* adb **must** be started beforehand._
*
* @param {number} port Which port adb is running on.
* @return {!ServiceBuilder} A self reference.
*/
setAdbPort(port: number): ServiceBuilder;
/**
* Sets the path of the log file the driver should log to. If a log file is
* not specified, the driver will log to stderr.
* @param {string} path Path of the log file to use.
* @return {!ServiceBuilder} A self reference.
*/
loggingTo(path: string): ServiceBuilder;
/**
* Enables verbose logging.
* @return {!ServiceBuilder} A self reference.
*/
enableVerboseLogging(): ServiceBuilder;
/**
* Sets the number of threads the driver should use to manage HTTP requests.
* By default, the driver will use 4 threads.
* @param {number} n The number of threads to use.
* @return {!ServiceBuilder} A self reference.
*/
setNumHttpThreads(n: number): ServiceBuilder;
/**
* Sets the base path for WebDriver REST commands (e.g. '/wd/hub').
* By default, the driver will accept commands relative to '/'.
* @param {string} path The base path to use.
* @return {!ServiceBuilder} A self reference.
*/
setUrlBasePath(path: string): ServiceBuilder;
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array.<string|number|!Stream|null|undefined>)} config The
* configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: { [key: string]: string }): ServiceBuilder;
/**
* Creates a new DriverService using this instance's current configuration.
* @return {remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
/**
* Returns the default ChromeDriver service. If such a service has not been
* configured, one will be constructed using the default configuration for
* a ChromeDriver executable found on the system PATH.
* @return {!remote.DriverService} The default ChromeDriver service.
*/
function getDefaultService(): remote.DriverService;
/**
* Sets the default service to use for new ChromeDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
*/
function setDefaultService(service: remote.DriverService): void;
constructor(opt_config?: Options | webdriver.Capabilities, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
}
export = chrome;
interface IOptionsValues {
args: string[];
binary?: string;
detach: boolean;
extensions: string[];
localState?: any;
logFile?: string;
prefs?: any;
}
interface IPerfLoggingPrefs {
enableNetwork: boolean;
enablePage: boolean;
enableTimeline: boolean;
tracingCategories: string;
bufferUsageReportingInterval: number;
}
/**
* Class for managing ChromeDriver specific options.
*/
export class Options {
/**
* @constructor
*/
constructor();
/**
* Extracts the ChromeDriver specific options from the given capabilities
* object.
* @param {!webdriver.Capabilities} capabilities The capabilities object.
* @return {!Options} The ChromeDriver options.
*/
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
/**
* Add additional command line arguments to use when launching the Chrome
* browser. Each argument may be specified with or without the '--' prefix
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
* delimited by an '=': 'foo=bar'.
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: string[]): Options;
/**
* List of Chrome command line switches to exclude that ChromeDriver by default
* passes when starting Chrome. Do not prefix switches with '--'.
*
* @param {...(string|!Array<string>)} var_args The switches to exclude.
* @return {!Options} A self reference.
*/
excludeSwitches(...var_args: string[]): Options;
/**
* Add additional extensions to install when launching Chrome. Each extension
* should be specified as the path to the packed CRX file, or a Buffer for an
* extension.
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
* extensions to add.
* @return {!Options} A self reference.
*/
addExtensions(...var_args: any[]): Options;
/**
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
* reference the actual Chrome executable, not just the application binary
* (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').
*
* The binary path be absolute or relative to the chromedriver server
* executable, but it must exist on the machine that will launch Chrome.
*
* @param {string} path The path to the Chrome binary to use.
* @return {!Options} A self reference.
*/
setChromeBinaryPath(path: string): Options;
/**
* Sets whether to leave the started Chrome browser running if the controlling
* ChromeDriver service is killed before {@link webdriver.WebDriver#quit()} is
* called.
* @param {boolean} detach Whether to leave the browser running if the
* chromedriver service is killed before the session.
* @return {!Options} A self reference.
*/
detachDriver(detach: boolean): Options;
/**
* Sets the user preferences for Chrome's user profile. See the 'Preferences'
* file in Chrome's user data directory for examples.
* @param {!Object} prefs Dictionary of user preferences to use.
* @return {!Options} A self reference.
*/
setUserPreferences(prefs: any): Options;
/**
* Sets the logging preferences for the new session.
* @param {!webdriver.logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the performance logging preferences. Options include:
*
* - `enableNetwork`: Whether or not to collect events from Network domain.
* - `enablePage`: Whether or not to collect events from Page domain.
* - `enableTimeline`: Whether or not to collect events from Timeline domain.
* Note: when tracing is enabled, Timeline domain is implicitly disabled,
* unless `enableTimeline` is explicitly set to true.
* - `tracingCategories`: A comma-separated string of Chrome tracing categories
* for which trace events should be collected. An unspecified or empty
* string disables tracing.
* - `bufferUsageReportingInterval`: The requested number of milliseconds
* between DevTools trace buffer usage events. For example, if 1000, then
* once per second, DevTools will report how full the trace buffer is. If a
* report indicates the buffer usage is 100%, a warning will be issued.
*
* @param {{enableNetwork: boolean,
* enablePage: boolean,
* enableTimeline: boolean,
* tracingCategories: string,
* bufferUsageReportingInterval: number}} prefs The performance
* logging preferences.
* @return {!Options} A self reference.
*/
setPerfLoggingPrefs(prefs: IPerfLoggingPrefs): Options;
/**
* Sets preferences for the 'Local State' file in Chrome's user data
* directory.
* @param {!Object} state Dictionary of local state preferences.
* @return {!Options} A self reference.
*/
setLocalState(state: any): Options;
/**
* Sets the name of the activity hosting a Chrome-based Android WebView. This
* option must be set to connect to an [Android WebView](
* https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android)
*
* @param {string} name The activity name.
* @return {!Options} A self reference.
*/
androidActivity(name: string): Options;
/**
* Sets the device serial number to connect to via ADB. If not specified, the
* ChromeDriver will select an unused device at random. An error will be
* returned if all devices already have active sessions.
*
* @param {string} serial The device serial number to connect to.
* @return {!Options} A self reference.
*/
androidDeviceSerial(serial: string): Options;
/**
* Configures the ChromeDriver to launch Chrome on Android via adb. This
* function is shorthand for
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
* @return {!Options} A self reference.
*/
androidChrome(): Options;
/**
* Sets the package name of the Chrome or WebView app.
*
* @param {?string} pkg The package to connect to, or `null` to disable Android
* and switch back to using desktop Chrome.
* @return {!Options} A self reference.
*/
androidPackage(pkg: string): Options;
/**
* Sets the process name of the Activity hosting the WebView (as given by `ps`).
* If not specified, the process name is assumed to be the same as
* {@link #androidPackage}.
*
* @param {string} processName The main activity name.
* @return {!Options} A self reference.
*/
androidProcess(processName: string): Options;
/**
* Sets whether to connect to an already-running instead of the specified
* {@linkplain #androidProcess app} instead of launching the app with a clean
* data directory.
*
* @param {boolean} useRunning Whether to connect to a running instance.
* @return {!Options} A self reference.
*/
androidUseRunningApp(useRunning: boolean): Options;
/**
* Sets the path to Chrome's log file. This path should exist on the machine
* that will launch Chrome.
* @param {string} path Path to the log file to use.
* @return {!Options} A self reference.
*/
setChromeLogFile(path: string): Options;
/**
* Sets the directory to store Chrome minidumps in. This option is only
* supported when ChromeDriver is running on Linux.
* @param {string} path The directory path.
* @return {!Options} A self reference.
*/
setChromeMinidumpPath(path: string): Options;
/**
* Configures Chrome to emulate a mobile device. For more information, refer
* to the ChromeDriver project page on [mobile emulation][em]. Configuration
* options include:
*
* - `deviceName`: The name of a pre-configured [emulated device][devem]
* - `width`: screen width, in pixels
* - `height`: screen height, in pixels
* - `pixelRatio`: screen pixel ratio
*
* __Example 1: Using a Pre-configured Device__
*
* let options = new chrome.Options().setMobileEmulation(
* {deviceName: 'Google Nexus 5'});
*
* let driver = new chrome.Driver(options);
*
* __Example 2: Using Custom Screen Configuration__
*
* let options = new chrome.Options().setMobileEmulation({
* width: 360,
* height: 640,
* pixelRatio: 3.0
* });
*
* let driver = new chrome.Driver(options);
*
*
* [em]: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
* [devem]: https://developer.chrome.com/devtools/docs/device-mode
*
* @param {?({deviceName: string}|
* {width: number, height: number, pixelRatio: number})} config The
* mobile emulation configuration, or `null` to disable emulation.
* @return {!Options} A self reference.
*/
setMobileEmulation(config: any): Options;
/**
* Sets the proxy settings for the new session.
* @param {webdriver.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link webdriver.Capabilities} object.
* @param {webdriver.Capabilities=} opt_capabilities The capabilities to merge
* these options into, if any.
* @return {!webdriver.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* Creates {@link remote.DriverService} instances that manage a ChromeDriver
* server.
*/
export class ServiceBuilder {
/**
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the chromedriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the chromedriver
* cannot be found on the PATH.
* @constructor
*/
constructor(opt_exe?: string);
/**
* Sets the port to start the ChromeDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
usingPort(port: number): ServiceBuilder;
/**
* Sets which port adb is listening to. _The ChromeDriver will connect to adb
* if an {@linkplain Options#androidPackage Android session} is requested, but
* adb **must** be started beforehand._
*
* @param {number} port Which port adb is running on.
* @return {!ServiceBuilder} A self reference.
*/
setAdbPort(port: number): ServiceBuilder;
/**
* Sets the path of the log file the driver should log to. If a log file is
* not specified, the driver will log to stderr.
* @param {string} path Path of the log file to use.
* @return {!ServiceBuilder} A self reference.
*/
loggingTo(path: string): ServiceBuilder;
/**
* Enables verbose logging.
* @return {!ServiceBuilder} A self reference.
*/
enableVerboseLogging(): ServiceBuilder;
/**
* Sets the number of threads the driver should use to manage HTTP requests.
* By default, the driver will use 4 threads.
* @param {number} n The number of threads to use.
* @return {!ServiceBuilder} A self reference.
*/
setNumHttpThreads(n: number): ServiceBuilder;
/**
* Sets the base path for WebDriver REST commands (e.g. '/wd/hub').
* By default, the driver will accept commands relative to '/'.
* @param {string} path The base path to use.
* @return {!ServiceBuilder} A self reference.
*/
setUrlBasePath(path: string): ServiceBuilder;
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array.<string|number|!Stream|null|undefined>)} config The
* configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: { [key: string]: string }): ServiceBuilder;
/**
* Creates a new DriverService using this instance's current configuration.
* @return {remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
/**
* Returns the default ChromeDriver service. If such a service has not been
* configured, one will be constructed using the default configuration for
* a ChromeDriver executable found on the system PATH.
* @return {!remote.DriverService} The default ChromeDriver service.
*/
export function getDefaultService(): remote.DriverService;
/**
* Sets the default service to use for new ChromeDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
*/
export function setDefaultService(service: remote.DriverService): void;

View File

@ -2,129 +2,124 @@
import * as webdriver from './index';
import * as remote from './remote';
declare namespace edge {
class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@linkplain #getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use, or
* {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}
export class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@linkplain #getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use, or
* {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
/**
* Class for managing MicrosoftEdgeDriver specific options.
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
class Options {
/**
* Extracts the MicrosoftEdgeDriver specific options from the given
* capabilities object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The MicrosoftEdgeDriver options.
*/
static fromCapabilities(cap: webdriver.Capabilities): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Sets the page load strategy for Edge.
* Supported values are 'normal', 'eager', and 'none';
*
* @param {string} pageLoadStrategy The page load strategy to use.
* @return {!Options} A self reference.
*/
setPageLoadStrategy(pageLoadStrategy: string): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* Creates {@link remote.DriverService} instances that manage a
* MicrosoftEdgeDriver server in a child process.
*/
class ServiceBuilder {
/**
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the MicrosoftEdgeDriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the
* MicrosoftEdgeDriver cannot be found on the PATH.
*/
constructor(opt_exe?: string);
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array.<string|number|!stream.Stream|null|undefined>)}
* config The configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Sets the port to start the MicrosoftEdgeDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
usingPort(port: number): ServiceBuilder;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: Object): ServiceBuilder;
/**
* Creates a new DriverService using this instance's current configuration.
* @return {!remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
/**
* Returns the default MicrosoftEdgeDriver service. If such a service has
* not been configured, one will be constructed using the default configuration
* for an MicrosoftEdgeDriver executable found on the system PATH.
* @return {!remote.DriverService} The default MicrosoftEdgeDriver service.
*/
function getDefaultService(): remote.DriverService;
/**
* Sets the default service to use for new MicrosoftEdgeDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
*/
function setDefaultService(service: remote.DriverService): void;
setFileDetector(): void;
}
export = edge;
/**
* Class for managing MicrosoftEdgeDriver specific options.
*/
export class Options {
/**
* Extracts the MicrosoftEdgeDriver specific options from the given
* capabilities object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The MicrosoftEdgeDriver options.
*/
static fromCapabilities(cap: webdriver.Capabilities): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Sets the page load strategy for Edge.
* Supported values are 'normal', 'eager', and 'none';
*
* @param {string} pageLoadStrategy The page load strategy to use.
* @return {!Options} A self reference.
*/
setPageLoadStrategy(pageLoadStrategy: string): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* Creates {@link remote.DriverService} instances that manage a
* MicrosoftEdgeDriver server in a child process.
*/
export class ServiceBuilder {
/**
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the MicrosoftEdgeDriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the
* MicrosoftEdgeDriver cannot be found on the PATH.
*/
constructor(opt_exe?: string);
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array.<string|number|!stream.Stream|null|undefined>)}
* config The configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Sets the port to start the MicrosoftEdgeDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
usingPort(port: number): ServiceBuilder;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: Object): ServiceBuilder;
/**
* Creates a new DriverService using this instance's current configuration.
* @return {!remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
/**
* Returns the default MicrosoftEdgeDriver service. If such a service has
* not been configured, one will be constructed using the default configuration
* for an MicrosoftEdgeDriver executable found on the system PATH.
* @return {!remote.DriverService} The default MicrosoftEdgeDriver service.
*/
export function getDefaultService(): remote.DriverService;
/**
* Sets the default service to use for new MicrosoftEdgeDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
*/
export function setDefaultService(service: remote.DriverService): void;

View File

@ -1,16 +1,12 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace executors {
/**
* Creates a command executor that uses WebDriver's JSON wire protocol.
* @param {(string|!promise.Promise<string>)} url The server's URL,
* or a promise that will resolve to that URL.
* @param {?string=} opt_proxy (optional) The URL of the HTTP proxy for the
* client to use.
* @returns {!./lib/command.Executor} The new command executor.
*/
function createExecutor(url: string | webdriver.promise.Promise<string>, opt_agent?: string, opt_proxy?: string): webdriver.Executor;
}
export = executors;
/**
* Creates a command executor that uses WebDriver's JSON wire protocol.
* @param {(string|!promise.Promise<string>)} url The server's URL,
* or a promise that will resolve to that URL.
* @param {?string=} opt_proxy (optional) The URL of the HTTP proxy for the
* client to use.
* @returns {!./lib/command.Executor} The new command executor.
*/
export function createExecutor(url: string | webdriver.promise.Promise<string>, opt_agent?: string, opt_proxy?: string): webdriver.Executor;

View File

@ -2,257 +2,253 @@
import * as webdriver from './index';
import * as remote from './remote';
declare namespace firefox {
/**
* Manages a Firefox subprocess configured for use with WebDriver.
*/
export class Binary {
/**
* Manages a Firefox subprocess configured for use with WebDriver.
* @param {string=} opt_exe Path to the Firefox binary to use. If not
* specified, will attempt to locate Firefox on the current system.
* @constructor
*/
class Binary {
/**
* @param {string=} opt_exe Path to the Firefox binary to use. If not
* specified, will attempt to locate Firefox on the current system.
* @constructor
*/
constructor(opt_exe?: string);
/**
* Add arguments to the command line used to start Firefox.
* @param {...(string|!Array.<string>)} var_args Either the arguments to add as
* varargs, or the arguments as an array.
*/
addArguments(...var_args: string[]): void;
/**
* Launches Firefox and eturns a promise that will be fulfilled when the process
* terminates.
* @param {string} profile Path to the profile directory to use.
* @return {!promise.Promise.<!exec.Result>} A promise for the process result.
* @throws {Error} If this instance has already been started.
*/
launch(profile: string): webdriver.promise.Promise<any>;
/**
* Kills the managed Firefox process.
* @return {!promise.Promise} A promise for when the process has terminated.
*/
kill(): webdriver.promise.Promise<void>;
}
constructor(opt_exe?: string);
/**
* Models a Firefox proifle directory for use with the FirefoxDriver. The
* {@code Proifle} directory uses an in-memory model until {@link #writeToDisk}
* is called.
* Add arguments to the command line used to start Firefox.
* @param {...(string|!Array.<string>)} var_args Either the arguments to add as
* varargs, or the arguments as an array.
*/
class Profile {
/**
* @param {string=} opt_dir Path to an existing Firefox profile directory to
* use a template for this profile. If not specified, a blank profile will
* be used.
* @constructor
*/
constructor(opt_dir?: string);
addArguments(...var_args: string[]): void;
/**
* Registers an extension to be included with this profile.
* @param {string} extension Path to the extension to include, as either an
* unpacked extension directory or the path to a xpi file.
*/
addExtension(extension: string): void;
/**
* Sets a desired preference for this profile.
* @param {string} key The preference key.
* @param {(string|number|boolean)} value The preference value.
* @throws {Error} If attempting to set a frozen preference.
*/
setPreference(key: string, value: string): void;
setPreference(key: string, value: number): void;
setPreference(key: string, value: boolean): void;
/**
* Returns the currently configured value of a profile preference. This does
* not include any defaults defined in the profile's template directory user.js
* file (if a template were specified on construction).
* @param {string} key The desired preference.
* @return {(string|number|boolean|undefined)} The current value of the
* requested preference.
*/
getPreference(key: string): any;
/**
* @return {number} The port this profile is currently configured to use, or
* 0 if the port will be selected at random when the profile is written
* to disk.
*/
getPort(): number;
/**
* Sets the port to use for the WebDriver extension loaded by this profile.
* @param {number} port The desired port, or 0 to use any free port.
*/
setPort(port: number): void;
/**
* @return {boolean} Whether the FirefoxDriver is configured to automatically
* accept untrusted SSL certificates.
*/
acceptUntrustedCerts(): boolean;
/**
* Sets whether the FirefoxDriver should automatically accept untrusted SSL
* certificates.
* @param {boolean} value .
*/
setAcceptUntrustedCerts(value: boolean): void;
/**
* Sets whether to assume untrusted certificates come from untrusted issuers.
* @param {boolean} value .
*/
setAssumeUntrustedCertIssuer(value: boolean): void;
/**
* @return {boolean} Whether to assume untrusted certs come from untrusted
* issuers.
*/
assumeUntrustedCertIssuer(): boolean;
/**
* Sets whether to use native events with this profile.
* @param {boolean} enabled .
*/
setNativeEventsEnabled(enabled: boolean): void;
/**
* Returns whether native events are enabled in this profile.
* @return {boolean} .
*/
nativeEventsEnabled(): boolean;
/**
* Writes this profile to disk.
* @param {boolean=} opt_excludeWebDriverExt Whether to exclude the WebDriver
* extension from the generated profile. Used to reduce the size of an
* {@link #encode() encoded profile} since the server will always install
* the extension itself.
* @return {!promise.Promise.<string>} A promise for the path to the new
* profile directory.
*/
writeToDisk(opt_excludeWebDriverExt?: boolean): webdriver.promise.Promise<string>;
/**
* Encodes this profile as a zipped, base64 encoded directory.
* @return {!promise.Promise.<string>} A promise for the encoded profile.
*/
encode(): webdriver.promise.Promise<string>;
}
/**
* Configuration options for the FirefoxDriver.
* Launches Firefox and eturns a promise that will be fulfilled when the process
* terminates.
* @param {string} profile Path to the profile directory to use.
* @return {!promise.Promise.<!exec.Result>} A promise for the process result.
* @throws {Error} If this instance has already been started.
*/
class Options {
/**
* Sets the profile to use. The profile may be specified as a
* {@link Profile} object or as the path to an existing Firefox profile to use
* as a template.
*
* @param {(string|!Profile)} profile The profile to use.
* @return {!Options} A self reference.
*/
setProfile(profile: string | any): Options;
launch(profile: string): webdriver.promise.Promise<any>;
/**
* Sets the binary to use. The binary may be specified as the path to a Firefox
* executable, or as a {@link Binary} object.
*
* @param {(string|!Binary)} binary The binary to use.
* @return {!Options} A self reference.
*/
setBinary(binary: string | any): Options;
/**
* Sets the logging preferences for the new session.
* @param {logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPreferences(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the proxy to use.
*
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Sets whether to use Mozilla's Marionette to drive the browser.
*
* @see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
*/
useMarionette(marionette: any): Options;
/**
* Converts these options to a {@link capabilities.Capabilities} instance.
*
* @return {!capabilities.Capabilities} A new capabilities object.
*/
toCapabilities(): webdriver.Capabilities;
}
/**
* @return {string} .
* @throws {Error}
* Kills the managed Firefox process.
* @return {!promise.Promise} A promise for when the process has terminated.
*/
function findWires(): string;
/**
* @param {(string|!Binary)} binary .
* @return {!remote.DriverService} .
*/
function createWiresService(binary: string | any): remote.DriverService;
/**
* @param {(Profile|string)} profile The profile to prepare.
* @param {number} port The port the FirefoxDriver should listen on.
* @return {!Promise<string>} a promise for the path to the profile directory.
*/
function prepareProfile(profile: string | any, port: number): any;
/**
* A WebDriver client for Firefox.
*/
class Driver extends webdriver.WebDriver {
/**
* @param {(Options|capabilities.Capabilities|Object)=} opt_config The
* configuration options for this driver, specified as either an
* {@link Options} or {@link capabilities.Capabilities}, or as a raw hash
* object.
* @param {promise.ControlFlow=} opt_flow The flow to
* schedule commands through. Defaults to the active flow object.
*/
constructor(opt_config?: Options | webdriver.Capabilities | Object, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}
kill(): webdriver.promise.Promise<void>;
}
export = firefox;
/**
* Models a Firefox proifle directory for use with the FirefoxDriver. The
* {@code Proifle} directory uses an in-memory model until {@link #writeToDisk}
* is called.
*/
export class Profile {
/**
* @param {string=} opt_dir Path to an existing Firefox profile directory to
* use a template for this profile. If not specified, a blank profile will
* be used.
* @constructor
*/
constructor(opt_dir?: string);
/**
* Registers an extension to be included with this profile.
* @param {string} extension Path to the extension to include, as either an
* unpacked extension directory or the path to a xpi file.
*/
addExtension(extension: string): void;
/**
* Sets a desired preference for this profile.
* @param {string} key The preference key.
* @param {(string|number|boolean)} value The preference value.
* @throws {Error} If attempting to set a frozen preference.
*/
setPreference(key: string, value: string): void;
setPreference(key: string, value: number): void;
setPreference(key: string, value: boolean): void;
/**
* Returns the currently configured value of a profile preference. This does
* not include any defaults defined in the profile's template directory user.js
* file (if a template were specified on construction).
* @param {string} key The desired preference.
* @return {(string|number|boolean|undefined)} The current value of the
* requested preference.
*/
getPreference(key: string): any;
/**
* @return {number} The port this profile is currently configured to use, or
* 0 if the port will be selected at random when the profile is written
* to disk.
*/
getPort(): number;
/**
* Sets the port to use for the WebDriver extension loaded by this profile.
* @param {number} port The desired port, or 0 to use any free port.
*/
setPort(port: number): void;
/**
* @return {boolean} Whether the FirefoxDriver is configured to automatically
* accept untrusted SSL certificates.
*/
acceptUntrustedCerts(): boolean;
/**
* Sets whether the FirefoxDriver should automatically accept untrusted SSL
* certificates.
* @param {boolean} value .
*/
setAcceptUntrustedCerts(value: boolean): void;
/**
* Sets whether to assume untrusted certificates come from untrusted issuers.
* @param {boolean} value .
*/
setAssumeUntrustedCertIssuer(value: boolean): void;
/**
* @return {boolean} Whether to assume untrusted certs come from untrusted
* issuers.
*/
assumeUntrustedCertIssuer(): boolean;
/**
* Sets whether to use native events with this profile.
* @param {boolean} enabled .
*/
setNativeEventsEnabled(enabled: boolean): void;
/**
* Returns whether native events are enabled in this profile.
* @return {boolean} .
*/
nativeEventsEnabled(): boolean;
/**
* Writes this profile to disk.
* @param {boolean=} opt_excludeWebDriverExt Whether to exclude the WebDriver
* extension from the generated profile. Used to reduce the size of an
* {@link #encode() encoded profile} since the server will always install
* the extension itself.
* @return {!promise.Promise.<string>} A promise for the path to the new
* profile directory.
*/
writeToDisk(opt_excludeWebDriverExt?: boolean): webdriver.promise.Promise<string>;
/**
* Encodes this profile as a zipped, base64 encoded directory.
* @return {!promise.Promise.<string>} A promise for the encoded profile.
*/
encode(): webdriver.promise.Promise<string>;
}
/**
* Configuration options for the FirefoxDriver.
*/
export class Options {
/**
* Sets the profile to use. The profile may be specified as a
* {@link Profile} object or as the path to an existing Firefox profile to use
* as a template.
*
* @param {(string|!Profile)} profile The profile to use.
* @return {!Options} A self reference.
*/
setProfile(profile: string | any): Options;
/**
* Sets the binary to use. The binary may be specified as the path to a Firefox
* executable, or as a {@link Binary} object.
*
* @param {(string|!Binary)} binary The binary to use.
* @return {!Options} A self reference.
*/
setBinary(binary: string | any): Options;
/**
* Sets the logging preferences for the new session.
* @param {logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPreferences(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the proxy to use.
*
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Sets whether to use Mozilla's Marionette to drive the browser.
*
* @see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
*/
useMarionette(marionette: any): Options;
/**
* Converts these options to a {@link capabilities.Capabilities} instance.
*
* @return {!capabilities.Capabilities} A new capabilities object.
*/
toCapabilities(): webdriver.Capabilities;
}
/**
* @return {string} .
* @throws {Error}
*/
export function findWires(): string;
/**
* @param {(string|!Binary)} binary .
* @return {!remote.DriverService} .
*/
export function createWiresService(binary: string | any): remote.DriverService;
/**
* @param {(Profile|string)} profile The profile to prepare.
* @param {number} port The port the FirefoxDriver should listen on.
* @return {!Promise<string>} a promise for the path to the profile directory.
*/
export function prepareProfile(profile: string | any, port: number): any;
/**
* A WebDriver client for Firefox.
*/
export class Driver extends webdriver.WebDriver {
/**
* @param {(Options|capabilities.Capabilities|Object)=} opt_config The
* configuration options for this driver, specified as either an
* {@link Options} or {@link capabilities.Capabilities}, or as a raw hash
* object.
* @param {promise.ControlFlow=} opt_flow The flow to
* schedule commands through. Defaults to the active flow object.
*/
constructor(opt_config?: Options | webdriver.Capabilities | Object, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}

View File

@ -1,157 +1,153 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace http {
/**
* Converts a headers map to a HTTP header block string.
* @param {!Map<string, string>} headers The map to convert.
* @return {string} The headers as a string.
*/
export function headersToString(headers: any): string;
/**
* Represents a HTTP request message. This class is a 'partial' request and only
* defines the path on the server to send a request to. It is each client's
* responsibility to build the full URL for the final request.
* @final
*/
export class HttpRequest {
/**
* Converts a headers map to a HTTP header block string.
* @param {!Map<string, string>} headers The map to convert.
* @return {string} The headers as a string.
* @param {string} method The HTTP method to use for the request.
* @param {string} path The path on the server to send the request to.
* @param {Object=} opt_data This request's non-serialized JSON payload data.
*/
function headersToString(headers: any): string;
constructor(method: string, path: string, opt_data?: Object);
/**
* Represents a HTTP request message. This class is a 'partial' request and only
* defines the path on the server to send a request to. It is each client's
* responsibility to build the full URL for the final request.
* @final
*/
class HttpRequest {
/**
* @param {string} method The HTTP method to use for the request.
* @param {string} path The path on the server to send the request to.
* @param {Object=} opt_data This request's non-serialized JSON payload data.
*/
constructor(method: string, path: string, opt_data?: Object);
/** @override */
toString(): string;
}
/**
* Represents a HTTP response message.
* @final
*/
class HttpResponse {
/**
* @param {number} status The response code.
* @param {!Object<string>} headers The response headers. All header names
* will be converted to lowercase strings for consistent lookups.
* @param {string} body The response body.
*/
constructor(status: number, headers: Object, body: string);
/** @override */
toString(): string;
}
function post(path: string): any;
function del(path: string): any;
function get(path: string): any;
function resource(method: string, path: string): any;
/**
* A basic HTTP client used to send messages to a remote end.
*/
class HttpClient {
/**
* @param {string} serverUrl URL for the WebDriver server to send commands to.
* @param {http.Agent=} opt_agent The agent to use for each request.
* Defaults to `http.globalAgent`.
* @param {?string=} opt_proxy The proxy to use for the connection to the
* server. Default is to use no proxy.
*/
constructor(serverUrl: string, opt_agent?: any, opt_proxy?: string);
/**
* Sends a request to the server. The client will automatically follow any
* redirects returned by the server, fulfilling the returned promise with the
* final response.
*
* @param {!HttpRequest} httpRequest The request to send.
* @return {!promise.Promise<HttpResponse>} A promise that will be fulfilled
* with the server's response.
*/
send(httpRequest: HttpRequest): webdriver.promise.Promise<HttpResponse>;
}
/**
* Sends a single HTTP request.
* @param {!Object} options The request options.
* @param {function(!HttpResponse)} onOk The function to call if the
* request succeeds.
* @param {function(!Error)} onError The function to call if the request fails.
* @param {?string=} opt_data The data to send with the request.
* @param {?string=} opt_proxy The proxy server to use for the request.
*/
function sendRequest(options: Object, onOk: any, onError: any, opt_data?: string, opt_proxy?: string): any;
/**
* A command executor that communicates with the server using HTTP + JSON.
*
* By default, each instance of this class will use the legacy wire protocol
* from [Selenium project][json]. The executor will automatically switch to the
* [W3C wire protocol][w3c] if the remote end returns a compliant response to
* a new session command.
*
* [json]: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
* [w3c]: https://w3c.github.io/webdriver/webdriver-spec.html
*
* @implements {cmd.Executor}
*/
class Executor {
/**
* @param {!HttpClient} client The client to use for sending requests to the
* server.
*/
constructor(client: HttpClient);
/**
* Defines a new command for use with this executor. When a command is sent,
* the {@code path} will be preprocessed using the command's parameters; any
* path segments prefixed with ':' will be replaced by the parameter of the
* same name. For example, given '/person/:name' and the parameters
* '{name: 'Bob'}', the final command path will be '/person/Bob'.
*
* @param {string} name The command name.
* @param {string} method The HTTP method to use when sending this command.
* @param {string} path The path to send the command to, relative to
* the WebDriver server's command root and of the form
* '/path/:variable/segment'.
*/
defineCommand(name: string, method: string, path: string): void;
/** @override */
execute(command: any): any;
}
/**
* @param {string} str .
* @return {?} .
*/
function tryParse(str: string): any;
/**
* Callback used to parse {@link HttpResponse} objects from a
* {@link HttpClient}.
* @param {!HttpResponse} httpResponse The HTTP response to parse.
* @param {boolean} w3c Whether the response should be processed using the
* W3C wire protocol.
* @return {{value: ?}} The parsed response.
* @throws {WebDriverError} If the HTTP response is an error.
*/
function parseHttpResponse(httpResponse: HttpResponse, w3c: boolean): any;
/**
* 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.
* @param {string} path The original resource path.
* @param {!Object<*>} parameters The parameters object to splice into the path.
* @return {string} The modified path.
*/
function buildPath(path: string, parameters: Object): string;
/** @override */
toString(): string;
}
export = http;
/**
* Represents a HTTP response message.
* @final
*/
export class HttpResponse {
/**
* @param {number} status The response code.
* @param {!Object<string>} headers The response headers. All header names
* will be converted to lowercase strings for consistent lookups.
* @param {string} body The response body.
*/
constructor(status: number, headers: Object, body: string);
/** @override */
toString(): string;
}
export function post(path: string): any;
export function del(path: string): any;
export function get(path: string): any;
export function resource(method: string, path: string): any;
/**
* A basic HTTP client used to send messages to a remote end.
*/
export class HttpClient {
/**
* @param {string} serverUrl URL for the WebDriver server to send commands to.
* @param {http.Agent=} opt_agent The agent to use for each request.
* Defaults to `http.globalAgent`.
* @param {?string=} opt_proxy The proxy to use for the connection to the
* server. Default is to use no proxy.
*/
constructor(serverUrl: string, opt_agent?: any, opt_proxy?: string);
/**
* Sends a request to the server. The client will automatically follow any
* redirects returned by the server, fulfilling the returned promise with the
* final response.
*
* @param {!HttpRequest} httpRequest The request to send.
* @return {!promise.Promise<HttpResponse>} A promise that will be fulfilled
* with the server's response.
*/
send(httpRequest: HttpRequest): webdriver.promise.Promise<HttpResponse>;
}
/**
* Sends a single HTTP request.
* @param {!Object} options The request options.
* @param {function(!HttpResponse)} onOk The function to call if the
* request succeeds.
* @param {function(!Error)} onError The function to call if the request fails.
* @param {?string=} opt_data The data to send with the request.
* @param {?string=} opt_proxy The proxy server to use for the request.
*/
export function sendRequest(options: Object, onOk: any, onError: any, opt_data?: string, opt_proxy?: string): any;
/**
* A command executor that communicates with the server using HTTP + JSON.
*
* By default, each instance of this class will use the legacy wire protocol
* from [Selenium project][json]. The executor will automatically switch to the
* [W3C wire protocol][w3c] if the remote end returns a compliant response to
* a new session command.
*
* [json]: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
* [w3c]: https://w3c.github.io/webdriver/webdriver-spec.html
*
* @implements {cmd.Executor}
*/
export class Executor {
/**
* @param {!HttpClient} client The client to use for sending requests to the
* server.
*/
constructor(client: HttpClient);
/**
* Defines a new command for use with this executor. When a command is sent,
* the {@code path} will be preprocessed using the command's parameters; any
* path segments prefixed with ':' will be replaced by the parameter of the
* same name. For example, given '/person/:name' and the parameters
* '{name: 'Bob'}', the final command path will be '/person/Bob'.
*
* @param {string} name The command name.
* @param {string} method The HTTP method to use when sending this command.
* @param {string} path The path to send the command to, relative to
* the WebDriver server's command root and of the form
* '/path/:variable/segment'.
*/
defineCommand(name: string, method: string, path: string): void;
/** @override */
execute(command: any): any;
}
/**
* @param {string} str .
* @return {?} .
*/
export function tryParse(str: string): any;
/**
* Callback used to parse {@link HttpResponse} objects from a
* {@link HttpClient}.
* @param {!HttpResponse} httpResponse The HTTP response to parse.
* @param {boolean} w3c Whether the response should be processed using the
* W3C wire protocol.
* @return {{value: ?}} The parsed response.
* @throws {WebDriverError} If the HTTP response is an error.
*/
export function parseHttpResponse(httpResponse: HttpResponse, w3c: boolean): any;
/**
* 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.
* @param {string} path The original resource path.
* @param {!Object<*>} parameters The parameters object to splice into the path.
* @return {string} The modified path.
*/
export function buildPath(path: string, parameters: Object): string;

View File

@ -1,212 +1,206 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace ie {
/**
* A WebDriver client for Microsoft's Internet Explorer.
*/
export class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_flow?: webdriver.promise.ControlFlow);
/**
* A WebDriver client for Microsoft's Internet Explorer.
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}
/**
* Class for managing IEDriver specific options.
*/
class Options {
constructor();
/**
* Extracts the IEDriver specific options from the given capabilities
* object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The IEDriver options.
*/
static fromCapabilities(caps: webdriver.Capabilities): Options;
/**
* Whether to disable the protected mode settings check when the session is
* created. Disbling this setting may lead to significant instability as the
* browser may become unresponsive/hang. Only 'best effort' support is provided
* when using this capability.
*
* For more information, refer to the IEDriver's
* [required system configuration](http://goo.gl/eH0Yi3).
*
* @param {boolean} ignoreSettings Whether to ignore protected mode settings.
* @return {!Options} A self reference.
*/
introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings: boolean): Options;
/**
* Indicates whether to skip the check that the browser's zoom level is set to
* 100%.
*
* @param {boolean} ignore Whether to ignore the browser's zoom level settings.
* @return {!Options} A self reference.
*/
ignoreZoomSetting(ignore: boolean): Options;
/**
* Sets the initial URL loaded when IE starts. This is intended to be used with
* {@link #ignoreProtectedModeSettings} to allow the user to initialize IE in
* the proper Protected Mode zone. Setting this option may cause browser
* instability or flaky and unresponsive code. Only 'best effort' support is
* provided when using this option.
*
* @param {string} url The initial browser URL.
* @return {!Options} A self reference.
*/
initialBrowserUrl(url: string): Options;
/**
* Configures whether to enable persistent mouse hovering (true by default).
* Persistent hovering is achieved by continuously firing mouse over events at
* the last location the mouse cursor has been moved to.
*
* @param {boolean} enable Whether to enable persistent hovering.
* @return {!Options} A self reference.
*/
enablePersistentHover(enable: boolean): Options;
/**
* Configures whether the driver should attempt to remove obsolete
* {@linkplain webdriver.WebElement WebElements} from its internal cache on
* page navigation (true by default). Disabling this option will cause the
* driver to run with a larger memory footprint.
*
* @param {boolean} enable Whether to enable element reference cleanup.
* @return {!Options} A self reference.
*/
enableElementCacheCleanup(enable: boolean): Options;
/**
* Configures whether to require the IE window to have input focus before
* performing any user interactions (i.e. mouse or keyboard events). This
* option is disabled by default, but delivers much more accurate interaction
* events when enabled.
*
* @param {boolean} require Whether to require window focus.
* @return {!Options} A self reference.
*/
requireWindowFocus(require: boolean): Options;
/**
* Configures the timeout, in milliseconds, that the driver will attempt to
* located and attach to a newly opened instance of Internet Explorer. The
* default is zero, which indicates waiting indefinitely.
*
* @param {number} timeout How long to wait for IE.
* @return {!Options} A self reference.
*/
browserAttachTimeout(timeout: number): Options;
/**
* Configures whether to launch Internet Explorer using the CreateProcess API.
* If this option is not specified, IE is launched using IELaunchURL, if
* available. For IE 8 and above, this option requires the TabProcGrowth
* registry value to be set to 0.
*
* @param {boolean} force Whether to use the CreateProcess API.
* @return {!Options} A self reference.
*/
forceCreateProcessApi(force: boolean): Options;
/**
* Specifies command-line switches to use when launching Internet Explorer.
* This is only valid when used with {@link #forceCreateProcessApi}.
*
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: Array<string>): Options;
/**
* Configures whether proxies should be configured on a per-process basis. If
* not set, setting a {@linkplain #setProxy proxy} will configure the system
* proxy. The default behavior is to use the system proxy.
*
* @param {boolean} enable Whether to enable per-process proxy settings.
* @return {!Options} A self reference.
*/
usePerProcessProxy(enable: boolean): Options;
/**
* Configures whether to clear the cache, cookies, history, and saved form data
* before starting the browser. _Using this capability will clear session data
* for all running instances of Internet Explorer, including those started
* manually._
*
* @param {boolean} cleanSession Whether to clear all session data on startup.
* @return {!Options} A self reference.
*/
ensureCleanSession(cleanSession: boolean): Options;
/**
* Sets the path to the log file the driver should log to.
* @param {string} file The log file path.
* @return {!Options} A self reference.
*/
setLogFile(file: string): Options;
/**
* Sets the IEDriverServer's logging {@linkplain Level level}.
* @param {Level} level The logging level.
* @return {!Options} A self reference.
*/
setLogLevel(level: webdriver.logging.Level): Options;
/**
* Sets the IP address of the driver's host adapter.
* @param {string} host The IP address to use.
* @return {!Options} A self reference.
*/
setHost(host: string): Options;
/**
* Sets the path of the temporary data directory to use.
* @param {string} path The log file path.
* @return {!Options} A self reference.
*/
setExtractPath(path: string): Options;
/**
* Sets whether the driver should start in silent mode.
* @param {boolean} silent Whether to run in silent mode.
* @return {!Options} A self reference.
*/
silent(silent: boolean): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}
setFileDetector(): void;
}
export = ie;
/**
* Class for managing IEDriver specific options.
*/
export class Options {
constructor();
/**
* Extracts the IEDriver specific options from the given capabilities
* object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The IEDriver options.
*/
static fromCapabilities(caps: webdriver.Capabilities): Options;
/**
* Whether to disable the protected mode settings check when the session is
* created. Disbling this setting may lead to significant instability as the
* browser may become unresponsive/hang. Only 'best effort' support is provided
* when using this capability.
*
* For more information, refer to the IEDriver's
* [required system configuration](http://goo.gl/eH0Yi3).
*
* @param {boolean} ignoreSettings Whether to ignore protected mode settings.
* @return {!Options} A self reference.
*/
introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings: boolean): Options;
/**
* Indicates whether to skip the check that the browser's zoom level is set to
* 100%.
*
* @param {boolean} ignore Whether to ignore the browser's zoom level settings.
* @return {!Options} A self reference.
*/
ignoreZoomSetting(ignore: boolean): Options;
/**
* Sets the initial URL loaded when IE starts. This is intended to be used with
* {@link #ignoreProtectedModeSettings} to allow the user to initialize IE in
* the proper Protected Mode zone. Setting this option may cause browser
* instability or flaky and unresponsive code. Only 'best effort' support is
* provided when using this option.
*
* @param {string} url The initial browser URL.
* @return {!Options} A self reference.
*/
initialBrowserUrl(url: string): Options;
/**
* Configures whether to enable persistent mouse hovering (true by default).
* Persistent hovering is achieved by continuously firing mouse over events at
* the last location the mouse cursor has been moved to.
*
* @param {boolean} enable Whether to enable persistent hovering.
* @return {!Options} A self reference.
*/
enablePersistentHover(enable: boolean): Options;
/**
* Configures whether the driver should attempt to remove obsolete
* {@linkplain webdriver.WebElement WebElements} from its internal cache on
* page navigation (true by default). Disabling this option will cause the
* driver to run with a larger memory footprint.
*
* @param {boolean} enable Whether to enable element reference cleanup.
* @return {!Options} A self reference.
*/
enableElementCacheCleanup(enable: boolean): Options;
/**
* Configures whether to require the IE window to have input focus before
* performing any user interactions (i.e. mouse or keyboard events). This
* option is disabled by default, but delivers much more accurate interaction
* events when enabled.
*
* @param {boolean} require Whether to require window focus.
* @return {!Options} A self reference.
*/
requireWindowFocus(require: boolean): Options;
/**
* Configures the timeout, in milliseconds, that the driver will attempt to
* located and attach to a newly opened instance of Internet Explorer. The
* default is zero, which indicates waiting indefinitely.
*
* @param {number} timeout How long to wait for IE.
* @return {!Options} A self reference.
*/
browserAttachTimeout(timeout: number): Options;
/**
* Configures whether to launch Internet Explorer using the CreateProcess API.
* If this option is not specified, IE is launched using IELaunchURL, if
* available. For IE 8 and above, this option requires the TabProcGrowth
* registry value to be set to 0.
*
* @param {boolean} force Whether to use the CreateProcess API.
* @return {!Options} A self reference.
*/
forceCreateProcessApi(force: boolean): Options;
/**
* Specifies command-line switches to use when launching Internet Explorer.
* This is only valid when used with {@link #forceCreateProcessApi}.
*
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: string[]): Options;
/**
* Configures whether proxies should be configured on a per-process basis. If
* not set, setting a {@linkplain #setProxy proxy} will configure the system
* proxy. The default behavior is to use the system proxy.
*
* @param {boolean} enable Whether to enable per-process proxy settings.
* @return {!Options} A self reference.
*/
usePerProcessProxy(enable: boolean): Options;
/**
* Configures whether to clear the cache, cookies, history, and saved form data
* before starting the browser. _Using this capability will clear session data
* for all running instances of Internet Explorer, including those started
* manually._
*
* @param {boolean} cleanSession Whether to clear all session data on startup.
* @return {!Options} A self reference.
*/
ensureCleanSession(cleanSession: boolean): Options;
/**
* Sets the path to the log file the driver should log to.
* @param {string} file The log file path.
* @return {!Options} A self reference.
*/
setLogFile(file: string): Options;
/**
* Sets the IEDriverServer's logging {@linkplain Level level}.
* @param {Level} level The logging level.
* @return {!Options} A self reference.
*/
setLogLevel(level: webdriver.logging.Level): Options;
/**
* Sets the IP address of the driver's host adapter.
* @param {string} host The IP address to use.
* @return {!Options} A self reference.
*/
setHost(host: string): Options;
/**
* Sets the path of the temporary data directory to use.
* @param {string} path The log file path.
* @return {!Options} A self reference.
*/
setExtractPath(path: string): Options;
/**
* Sets whether the driver should start in silent mode.
* @param {boolean} silent Whether to run in silent mode.
* @return {!Options} A self reference.
*/
silent(silent: boolean): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,177 +2,173 @@
import * as webdriver from './index';
import * as remote from './remote';
declare namespace opera {
/**
* Creates {@link remote.DriverService} instances that manages an
* [OperaDriver](https://github.com/operasoftware/operachromiumdriver)
* server in a child process.
*/
export class ServiceBuilder {
/**
* Creates {@link remote.DriverService} instances that manages an
* [OperaDriver](https://github.com/operasoftware/operachromiumdriver)
* server in a child process.
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the operadriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the operadriver
* cannot be found on the PATH.
*/
class ServiceBuilder {
/**
* @param {string=} opt_exe Path to the server executable to use. If omitted,
* the builder will attempt to locate the operadriver on the current
* PATH.
* @throws {Error} If provided executable does not exist, or the operadriver
* cannot be found on the PATH.
*/
constructor(opt_exe?: string);
/**
* Sets the port to start the OperaDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
usingPort(port: number): ServiceBuilder;
/**
* Sets the path of the log file the driver should log to. If a log file is
* not specified, the driver will log to stderr.
* @param {string} path Path of the log file to use.
* @return {!ServiceBuilder} A self reference.
*/
loggingTo(path: string): ServiceBuilder;
/**
* Enables verbose logging.
* @return {!ServiceBuilder} A self reference.
*/
enableVerboseLogging(): ServiceBuilder;
/**
* Silence sthe drivers output.
* @return {!ServiceBuilder} A self reference.
*/
silent(): ServiceBuilder;
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array<string|number|!stream.Stream|null|undefined>)}
* config The configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: Object): ServiceBuilder;
/**
* Creates a new DriverService using this instance's current configuration.
* @return {!remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
constructor(opt_exe?: string);
/**
* Sets the default service to use for new OperaDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
* Sets the port to start the OperaDriver on.
* @param {number} port The port to use, or 0 for any free port.
* @return {!ServiceBuilder} A self reference.
* @throws {Error} If the port is invalid.
*/
function setDefaultService(service: remote.DriverService): any;
usingPort(port: number): ServiceBuilder;
/**
* Returns the default OperaDriver service. If such a service has not been
* configured, one will be constructed using the default configuration for
* a OperaDriver executable found on the system PATH.
* @return {!remote.DriverService} The default OperaDriver service.
* Sets the path of the log file the driver should log to. If a log file is
* not specified, the driver will log to stderr.
* @param {string} path Path of the log file to use.
* @return {!ServiceBuilder} A self reference.
*/
function getDefaultService(): remote.DriverService;
loggingTo(path: string): ServiceBuilder;
/**
* Class for managing {@linkplain Driver OperaDriver} specific options.
* Enables verbose logging.
* @return {!ServiceBuilder} A self reference.
*/
class Options {
/**
* Extracts the OperaDriver specific options from the given capabilities
* object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The OperaDriver options.
*/
static fromCapabilities(caps: webdriver.Capabilities): Options;
enableVerboseLogging(): ServiceBuilder;
/**
* Add additional command line arguments to use when launching the Opera
* browser. Each argument may be specified with or without the '--' prefix
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
* delimited by an '=': 'foo=bar'.
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: Array<string>): Options;
/**
* Silence sthe drivers output.
* @return {!ServiceBuilder} A self reference.
*/
silent(): ServiceBuilder;
/**
* Add additional extensions to install when launching Opera. Each extension
* should be specified as the path to the packed CRX file, or a Buffer for an
* extension.
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
* extensions to add.
* @return {!Options} A self reference.
*/
addExtensions(...var_args: Array<any>): Options;
/**
* Defines the stdio configuration for the driver service. See
* {@code child_process.spawn} for more information.
* @param {(string|!Array<string|number|!stream.Stream|null|undefined>)}
* config The configuration to use.
* @return {!ServiceBuilder} A self reference.
*/
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
/**
* Sets the path to the Opera binary to use. On Mac OS X, this path should
* reference the actual Opera executable, not just the application binary. The
* binary path be absolute or relative to the operadriver server executable, but
* it must exist on the machine that will launch Opera.
*
* @param {string} path The path to the Opera binary to use.
* @return {!Options} A self reference.
*/
setOperaBinaryPath(path: string): Options;
/**
* Defines the environment to start the server under. This settings will be
* inherited by every browser session started by the server.
* @param {!Object.<string, string>} env The environment to use.
* @return {!ServiceBuilder} A self reference.
*/
withEnvironment(env: Object): ServiceBuilder;
/**
* Sets the logging preferences for the new session.
* @param {!./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
}
class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@link getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}
/**
* Creates a new DriverService using this instance's current configuration.
* @return {!remote.DriverService} A new driver service using this instance's
* current configuration.
* @throws {Error} If the driver exectuable was not specified and a default
* could not be found on the current PATH.
*/
build(): remote.DriverService;
}
export = opera;
/**
* Sets the default service to use for new OperaDriver instances.
* @param {!remote.DriverService} service The service to use.
* @throws {Error} If the default service is currently running.
*/
export function setDefaultService(service: remote.DriverService): any;
/**
* Returns the default OperaDriver service. If such a service has not been
* configured, one will be constructed using the default configuration for
* a OperaDriver executable found on the system PATH.
* @return {!remote.DriverService} The default OperaDriver service.
*/
export function getDefaultService(): remote.DriverService;
/**
* Class for managing {@linkplain Driver OperaDriver} specific options.
*/
export class Options {
/**
* Extracts the OperaDriver specific options from the given capabilities
* object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The OperaDriver options.
*/
static fromCapabilities(caps: webdriver.Capabilities): Options;
/**
* Add additional command line arguments to use when launching the Opera
* browser. Each argument may be specified with or without the '--' prefix
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
* delimited by an '=': 'foo=bar'.
* @param {...(string|!Array.<string>)} var_args The arguments to add.
* @return {!Options} A self reference.
*/
addArguments(...var_args: string[]): Options;
/**
* Add additional extensions to install when launching Opera. Each extension
* should be specified as the path to the packed CRX file, or a Buffer for an
* extension.
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
* extensions to add.
* @return {!Options} A self reference.
*/
addExtensions(...var_args: any[]): Options;
/**
* Sets the path to the Opera binary to use. On Mac OS X, this path should
* reference the actual Opera executable, not just the application binary. The
* binary path be absolute or relative to the operadriver server executable, but
* it must exist on the machine that will launch Opera.
*
* @param {string} path The path to the Opera binary to use.
* @return {!Options} A self reference.
*/
setOperaBinaryPath(path: string): Options;
/**
* Sets the logging preferences for the new session.
* @param {!./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Sets the proxy settings for the new session.
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
* @return {!Options} A self reference.
*/
setProxy(proxy: webdriver.ProxyConfig): Options;
/**
* Converts this options instance to a {@link capabilities.Capabilities}
* object.
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!capabilities.Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
}
export class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {remote.DriverService=} opt_service The session to use; will use
* the {@link getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
*/
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
/**
* This function is a no-op as file detectors are not supported by this
* implementation.
* @override
*/
setFileDetector(): void;
}

View File

@ -1,72 +1,106 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace remote {
/**
* A record object that defines the configuration options for a DriverService
* instance.
*
* @record
*/
interface ServiceOptions { }
/**
* Manages the life and death of a native executable WebDriver server.
*
* It is expected that the driver server implements the
* https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
* Furthermore, the managed server should support multiple concurrent sessions,
* so that this class may be reused for multiple clients.
*/
export class DriverService {
/**
* A record object that defines the configuration options for a DriverService
* instance.
*
* @record
* @param {string} executable Path to the executable to run.
* @param {!ServiceOptions} options Configuration options for the service.
*/
interface ServiceOptions { }
constructor(executable: string, options: ServiceOptions);
/**
* Manages the life and death of a native executable WebDriver server.
*
* It is expected that the driver server implements the
* https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
* Furthermore, the managed server should support multiple concurrent sessions,
* so that this class may be reused for multiple clients.
* @return {!promise.Promise<string>} A promise that resolves to
* the server's address.
* @throws {Error} If the server has not been started.
*/
class DriverService {
/**
* @param {string} executable Path to the executable to run.
* @param {!ServiceOptions} options Configuration options for the service.
*/
constructor(executable: string, options: ServiceOptions);
address(): webdriver.promise.Promise<string>;
/**
* @return {!promise.Promise<string>} A promise that resolves to
* the server's address.
* @throws {Error} If the server has not been started.
*/
address(): webdriver.promise.Promise<string>;
/**
* Returns whether the underlying process is still running. This does not take
* into account whether the process is in the process of shutting down.
* @return {boolean} Whether the underlying service process is running.
*/
isRunning(): boolean;
/**
* Returns whether the underlying process is still running. This does not take
* into account whether the process is in the process of shutting down.
* @return {boolean} Whether the underlying service process is running.
*/
isRunning(): boolean;
/**
* Starts the server if it is not already running.
* @param {number=} opt_timeoutMs How long to wait, in milliseconds, for the
* server to start accepting requests. Defaults to 30 seconds.
* @return {!promise.Promise<string>} A promise that will resolve
* to the server's base URL when it has started accepting requests. If the
* timeout expires before the server has started, the promise will be
* rejected.
*/
start(opt_timeoutMs?: number): webdriver.promise.Promise<string>;
/**
* Starts the server if it is not already running.
* @param {number=} opt_timeoutMs How long to wait, in milliseconds, for the
* server to start accepting requests. Defaults to 30 seconds.
* @return {!promise.Promise<string>} A promise that will resolve
* to the server's base URL when it has started accepting requests. If the
* timeout expires before the server has started, the promise will be
* rejected.
*/
start(opt_timeoutMs?: number): webdriver.promise.Promise<string>;
/**
* Stops the service if it is not currently running. This function will kill
* the server immediately. To synchronize with the active control flow, use
* {@link #stop()}.
* @return {!promise.Promise} A promise that will be resolved when
* the server has been stopped.
*/
kill(): webdriver.promise.Promise<any>;
/**
* Stops the service if it is not currently running. This function will kill
* the server immediately. To synchronize with the active control flow, use
* {@link #stop()}.
* @return {!promise.Promise} A promise that will be resolved when
* the server has been stopped.
*/
kill(): webdriver.promise.Promise<any>;
/**
* Schedules a task in the current control flow to stop the server if it is
* currently running.
* @return {!promise.Promise} A promise that will be resolved when
* the server has been stopped.
*/
stop(): webdriver.promise.Promise<any>;
}
/**
* Schedules a task in the current control flow to stop the server if it is
* currently running.
* @return {!promise.Promise} A promise that will be resolved when
* the server has been stopped.
*/
stop(): webdriver.promise.Promise<any>;
}
export = remote;
/**
* A {@link webdriver.FileDetector} that may be used when running
* against a remote
* [Selenium server](http://selenium-release.storage.googleapis.com/index.html).
*
* When a file path on the local machine running this script is entered with
* {@link webdriver.WebElement#sendKeys WebElement#sendKeys}, this file detector
* will transfer the specified file to the Selenium server's host; the sendKeys
* command will be updated to use the transfered file's path.
*
* __Note:__ This class depends on a non-standard command supported on the
* Java Selenium server. The file detector will fail if used with a server that
* only supports standard WebDriver commands (such as the ChromeDriver).
*
* @final
*/
export class FileDetector extends webdriver.FileDetector {
/**
* @constructor
**/
constructor();
/**
* Prepares a `file` for use with the remote browser. If the provided path
* does not reference a normal file (i.e. it does not exist or is a
* directory), then the promise returned by this method will be resolved with
* the original file path. Otherwise, this method will upload the file to the
* remote server, which will return the file's path on the remote system so
* it may be referenced in subsequent commands.
*
* @param {!webdriver.WebDriver} driver The driver for the current browser.
* @param {string} file The path of the file to process.
* @return {!webdriver.promise.Promise<string>} A promise for the processed
* file path.
*/
handleFile(driver: webdriver.WebDriver, file: string): webdriver.promise.Promise<string>;
}

View File

@ -1,94 +1,90 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace safari {
class Server { }
export class Server { }
/**
* @return {!Promise<string>} A promise that will resolve with the path
* to Safari on the current system.
*/
function findSafariExecutable(): any;
/**
* @return {!Promise<string>} A promise that will resolve with the path
* to Safari on the current system.
*/
export function findSafariExecutable(): any;
/**
* @param {string} serverUrl The URL to connect to.
* @return {!Promise<string>} A promise for the path to a file that Safari can
* open on start-up to trigger a new connection to the WebSocket server.
*/
function createConnectFile(serverUrl: string): any;
/**
* @param {string} serverUrl The URL to connect to.
* @return {!Promise<string>} A promise for the path to a file that Safari can
* open on start-up to trigger a new connection to the WebSocket server.
*/
export function createConnectFile(serverUrl: string): any;
/**
* Deletes all session data files if so desired.
* @param {!Object} desiredCapabilities .
* @return {!Array<promise.Promise>} A list of promises for the deleted files.
*/
function cleanSession(desiredCapabilities: webdriver.Capabilities): any[];
/**
* Deletes all session data files if so desired.
* @param {!Object} desiredCapabilities .
* @return {!Array<promise.Promise>} A list of promises for the deleted files.
*/
export function cleanSession(desiredCapabilities: webdriver.Capabilities): any[];
/** @return {string} . */
function getRandomString(): string;
/** @return {string} . */
export function getRandomString(): string;
/**
* @implements {command.Executor}
*/
class CommandExecutor {
}
/**
* Configuration options specific to the {@link Driver SafariDriver}.
*/
class Options {
/**
* Extracts the SafariDriver specific options from the given capabilities
* object.
* @param {!Capabilities} capabilities The capabilities object.
* @return {!Options} The ChromeDriver options.
*/
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
/**
* Sets whether to force Safari to start with a clean session. Enabling this
* option will cause all global browser data to be deleted.
* @param {boolean} clean Whether to make sure the session has no cookies,
* cache entries, local storage, or databases.
* @return {!Options} A self reference.
*/
setCleanSession(clean: boolean): Options;
/**
* Sets the logging preferences for the new session.
* @param {!./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Converts this options instance to a {@link Capabilities} object.
* @param {Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* A WebDriver client for Safari. This class should never be instantiated
* directly; instead, use the {@linkplain ./builder.Builder Builder}:
*
* var driver = new Builder()
* .forBrowser('safari')
* .build();
*
*/
class Driver extends webdriver.WebDriver {
/**
* @param {(Options|Capabilities)=} opt_config The configuration
* options for the new session.
* @param {promise.ControlFlow=} opt_flow The control flow to create
* the driver under.
*/
constructor(opt_config?: Options | webdriver.Capabilities, opt_flow?: webdriver.promise.ControlFlow);
}
/**
* @implements {command.Executor}
*/
export class CommandExecutor {
}
export = safari;
/**
* Configuration options specific to the {@link Driver SafariDriver}.
*/
export class Options {
/**
* Extracts the SafariDriver specific options from the given capabilities
* object.
* @param {!Capabilities} capabilities The capabilities object.
* @return {!Options} The ChromeDriver options.
*/
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
/**
* Sets whether to force Safari to start with a clean session. Enabling this
* option will cause all global browser data to be deleted.
* @param {boolean} clean Whether to make sure the session has no cookies,
* cache entries, local storage, or databases.
* @return {!Options} A self reference.
*/
setCleanSession(clean: boolean): Options;
/**
* Sets the logging preferences for the new session.
* @param {!./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
/**
* Converts this options instance to a {@link Capabilities} object.
* @param {Capabilities=} opt_capabilities The capabilities to
* merge these options into, if any.
* @return {!Capabilities} The capabilities.
*/
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
}
/**
* A WebDriver client for Safari. This class should never be instantiated
* directly; instead, use the {@linkplain ./builder.Builder Builder}:
*
* var driver = new Builder()
* .forBrowser('safari')
* .build();
*
*/
export class Driver extends webdriver.WebDriver {
/**
* @param {(Options|Capabilities)=} opt_config The configuration
* options for the new session.
* @param {promise.ControlFlow=} opt_flow The control flow to create
* the driver under.
*/
constructor(opt_config?: Options | webdriver.Capabilities, opt_flow?: webdriver.promise.ControlFlow);
}

View File

@ -53,7 +53,7 @@ function TestServiceBuilder() {
builder = builder.setUrlBasePath('path');
builder = builder.setStdio('config');
builder = builder.setStdio(['A', 'B']);
builder = builder.withEnvironment({ 'A': 'a', 'B': 'b' });
builder = builder.withEnvironment({ A: 'a', B: 'b' });
}
function TestChromeModule() {

View File

@ -9,7 +9,7 @@ function TestBinary() {
binary.addArguments('A', 'B', 'C');
var promise: webdriver.promise.Promise<void> = binary.kill();
binary.launch('profile').then(function (result: any) { });
binary.launch('profile').then((result: any) => {});
}
function TestFirefoxDriver() {
@ -39,7 +39,7 @@ function TestFirefoxProfile() {
var bool: boolean = profile.acceptUntrustedCerts();
profile.addExtension('ext');
bool = profile.assumeUntrustedCertIssuer();
profile.encode().then(function (prof: string) { });
profile.encode().then((prof: string) => {});
var num: number = profile.getPort();
var anything: any = profile.getPreference('key');
bool = profile.nativeEventsEnabled();

View File

@ -29,7 +29,7 @@ function TestBuilder() {
builder = builder.setEnableNativeEvents(true);
builder = builder.setFirefoxOptions(new firefox.Options());
builder = builder.setLoggingPrefs(new webdriver.logging.Preferences());
builder = builder.setLoggingPrefs({ 'key': 'value' });
builder = builder.setLoggingPrefs({ key: 'value' });
builder = builder.setProxy({ proxyType: 'type' });
builder = builder.setScrollBehavior(1);
builder = builder.usingServer('http://someserver');
@ -90,7 +90,7 @@ function TestActionSequence() {
sequence = sequence.sendKeys('A', 'B', 'C');
sequence = sequence.sendKeys('A', webdriver.Key.NULL);
sequence.perform().then(function () { });
sequence.perform().then(() => {});
}
function TestTouchSequence() {
@ -112,7 +112,7 @@ function TestTouchSequence() {
sequence = sequence.flick({ xspeed: 100, yspeed: 100 });
sequence = sequence.flickElement(element, { x: 100, y: 100 }, 100);
sequence.perform().then(function () { });
sequence.perform().then(() => {});
}
function TestAlert() {
@ -122,10 +122,10 @@ function TestAlert() {
var alert: webdriver.Alert = driver.switchTo().alert();
alert.accept().then(function () { });
alert.dismiss().then(function () { });
alert.getText().then(function (text: string) { });
alert.sendKeys('ABC').then(function () { });
alert.accept().then(() => {});
alert.dismiss().then(() => {});
alert.getText().then((text: string) => {});
alert.sendKeys('ABC').then(() => {});
}
function TestBrowser() {
@ -165,7 +165,7 @@ function TestCapabilities() {
capabilities = capabilities.set(webdriver.Capability.VERSION, { abc: 'def' });
capabilities = capabilities.set(webdriver.Capability.VERSION, null);
capabilities = capabilities.setLoggingPrefs(new webdriver.logging.Preferences());
capabilities = capabilities.setLoggingPrefs({ 'key': 'value' });
capabilities = capabilities.setLoggingPrefs({ key: 'value' });
capabilities = capabilities.setProxy({ proxyType: 'Type' });
capabilities = capabilities.setEnableNativeEvents(true);
capabilities = capabilities.setScrollBehavior(1);
@ -329,7 +329,7 @@ function TestCommandName() {
function TestEventEmitter() {
var emitter: webdriver.EventEmitter = new webdriver.EventEmitter();
var callback = function (a: number, b: number, c: number) { };
var callback = (a: number, b: number, c: number) => {};
emitter = emitter.addListener('ABC', callback);
emitter = emitter.addListener('ABC', callback, this);
@ -454,7 +454,7 @@ function TestBy() {
locatorHash = { tagName: 'tag' };
locatorHash = { xpath: 'xpath' };
webdriver.By.js('script', 1, 2, 3)(driver).then(function (abc: number) { });
webdriver.By.js('script', 1, 2, 3)(driver).then((abc: number) => {});
}
function TestSession() {
@ -471,11 +471,11 @@ function TestSession() {
}
function TestUnhandledAlertError() {
var someFunc = function (error: webdriver.UnhandledAlertError) {
var someFunc = (error: webdriver.UnhandledAlertError) => {
var baseError: Error = error;
var str: string = error.getAlertText();
str = error.toString();
}
};
}
function TestWebDriverFileDetector() {
@ -485,7 +485,7 @@ function TestWebDriverFileDetector() {
var fileDetector: webdriver.FileDetector = new webdriver.FileDetector();
fileDetector.handleFile(driver, 'path/to/file').then(function (path: string) { });
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => {});
}
function TestWebDriverLogs() {
@ -495,8 +495,8 @@ function TestWebDriverLogs() {
var logs: webdriver.Logs = new webdriver.Logs(driver);
logs.get(webdriver.logging.Type.BROWSER).then(function (entries: webdriver.logging.Entry[]) { });;
logs.getAvailableLogTypes().then(function (types: string[]) { });
logs.get(webdriver.logging.Type.BROWSER).then((entries: webdriver.logging.Entry[]) => {});
logs.getAvailableLogTypes().then((types: string[]) => {});
}
function TestWebDriverNavigation() {
@ -506,10 +506,10 @@ function TestWebDriverNavigation() {
var navigation: webdriver.Navigation = new webdriver.Navigation(driver);
navigation.back().then(function () { });
navigation.forward().then(function () { });
navigation.refresh().then(function () { });
navigation.to('http://google.com').then(function () { });
navigation.back().then(() => {});
navigation.forward().then(() => {});
navigation.refresh().then(() => {});
navigation.to('http://google.com').then(() => {});
}
function TestWebDriverOptions() {
@ -530,8 +530,8 @@ function TestWebDriverOptions() {
promise = options.deleteAllCookies();
promise = options.deleteCookie('name');
options.getCookie('name').then(function (cookies: webdriver.IWebDriverOptionsCookie) { });
options.getCookies().then(function (cookies: webdriver.IWebDriverOptionsCookie[]) { });
options.getCookie('name').then((cookies: webdriver.IWebDriverOptionsCookie) => {});
options.getCookies().then((cookies: webdriver.IWebDriverOptionsCookie[]) => {});
var logs: webdriver.Logs = options.logs();
var timeouts: webdriver.Timeouts = options.timeouts();
@ -601,10 +601,10 @@ function TestWebDriver() {
var touchActions: webdriver.TouchSequence = driver.touchActions();
// call
stringPromise = driver.call<string>(function () { return 'value'; });
stringPromise = driver.call<string>(function () { return stringPromise; });
stringPromise = driver.call<string>(function () { var d: any = this; return 'value'; }, driver);
stringPromise = driver.call<string>(function (a: number) { return 'value'; }, driver, 1);
stringPromise = driver.call<string>(() => 'value');
stringPromise = driver.call<string>(() => stringPromise);
stringPromise = driver.call<string>(() => { var d: any = this; return 'value'; }, driver);
stringPromise = driver.call<string>((a: number) => 'value', driver, 1);
voidPromise = driver.close();
flow = driver.controlFlow();
@ -612,14 +612,14 @@ function TestWebDriver() {
// executeAsyncScript
stringPromise = driver.executeAsyncScript<string>('function(){}');
stringPromise = driver.executeAsyncScript<string>('function(){}', 1, 2, 3);
stringPromise = driver.executeAsyncScript<string>(function () { });
stringPromise = driver.executeAsyncScript<string>(function (a: number) { }, 1);
stringPromise = driver.executeAsyncScript<string>(() => {});
stringPromise = driver.executeAsyncScript<string>((a: number) => {}, 1);
// executeScript
stringPromise = driver.executeScript<string>('function(){}');
stringPromise = driver.executeScript<string>('function(){}', 1, 2, 3);
stringPromise = driver.executeScript<string>(function () { });
stringPromise = driver.executeScript<string>(function (a: number) { }, 1);
stringPromise = driver.executeScript<string>(() => {});
stringPromise = driver.executeScript<string>((a: number) => {}, 1);
// findElement
var element: webdriver.WebElement;
@ -627,15 +627,15 @@ function TestWebDriver() {
element = driver.findElement(webdriver.By.js('function(){}'));
// findElements
driver.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
driver.findElements(webdriver.By.js('function(){}')).then(function (elements: webdriver.WebElement[]) { });
driver.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {});
driver.findElements(webdriver.By.js('function(){}')).then((elements: webdriver.WebElement[]) => {});
voidPromise = driver.get('http://www.google.com');
driver.getAllWindowHandles().then(function (handles: string[]) { });
driver.getCapabilities().then(function (caps: webdriver.Capabilities) { });
driver.getAllWindowHandles().then((handles: string[]) => {});
driver.getCapabilities().then((caps: webdriver.Capabilities) => {});
stringPromise = driver.getCurrentUrl();
stringPromise = driver.getPageSource()
driver.getSession().then(function (session: webdriver.Session) { });;
stringPromise = driver.getPageSource();
driver.getSession().then((session: webdriver.Session) => {});
stringPromise = driver.getTitle();
stringPromise = driver.getWindowHandle();
@ -657,8 +657,8 @@ function TestWebDriver() {
var booleanCondition: webdriver.until.Condition<boolean>;
booleanPromise = driver.wait(booleanPromise);
booleanPromise = driver.wait(booleanCondition);
booleanPromise = driver.wait(function (driver: webdriver.WebDriver) { return true; });
let conditionFunction: Function;
booleanPromise = driver.wait((driver: webdriver.WebDriver) => true);
let conditionFunction: Function; // tslint:disable-line:prefer-const
booleanPromise = driver.wait(conditionFunction);
booleanPromise = driver.wait(booleanPromise, 123);
booleanPromise = driver.wait(booleanPromise, 123, 'Message');
@ -691,16 +691,16 @@ function TestWebElement() {
voidPromise = element.click();
element = element.findElement(webdriver.By.id('ABC'));
element.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
element.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {});
booleanPromise = element.isElementPresent(webdriver.By.className('ABC'));
stringPromise = element.getAttribute('class');
stringPromise = element.getCssValue('display');
driver = element.getDriver();
stringPromise = element.getInnerHtml();
element.getLocation().then(function (location: webdriver.ILocation) { });
element.getLocation().then((location: webdriver.ILocation) => {});
stringPromise = element.getOuterHtml();
element.getSize().then(function (size: webdriver.ISize) { });
element.getSize().then((size: webdriver.ISize) => {});
stringPromise = element.getTagName();
stringPromise = element.getText();
booleanPromise = element.isDisplayed();
@ -712,9 +712,9 @@ function TestWebElement() {
voidPromise = element.sendKeys(stringPromise, stringPromise, stringPromise);
voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise);
voidPromise = element.submit();
element.getId().then(function (id: string) { });
element.getRawId().then(function (id: string) { });
element.serialize().then(function (id: webdriver.IWebElementId) { });
element.getId().then((id: string) => {});
element.getRawId().then((id: string) => {});
element.serialize().then((id: webdriver.IWebElementId) => {});
booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId'));
}
@ -732,13 +732,13 @@ function TestWebElementPromise() {
var bool: boolean = elementPromise.isPending();
elementPromise.then();
elementPromise.then(function (element: webdriver.WebElement) { });
elementPromise.then(function (element: webdriver.WebElement) { }, function (error: any) { });
elementPromise.then(function (element: webdriver.WebElement) { return 'foo'; }, function (error: any) { }).then(function (result: string) { });
elementPromise.then((element: webdriver.WebElement) => {});
elementPromise.then((element: webdriver.WebElement) => {}, (error: any) => {});
elementPromise.then((element: webdriver.WebElement) => 'foo', (error: any) => {}).then((result: string) => {});
elementPromise.thenCatch(function (error: any) { }).then(function (value: any) { });
elementPromise.thenCatch((error: any) => {}).then((value: any) => {});
elementPromise.thenFinally(function () { });
elementPromise.thenFinally(() => {});
}
function TestLogging() {
@ -795,52 +795,51 @@ function TestPromiseModule() {
var booleanPromise: webdriver.promise.Promise<boolean>;
var voidPromise: webdriver.promise.Promise<void>;
webdriver.promise.all([stringPromise]).then(function (values: string[]) { });
webdriver.promise.all([stringPromise]).then((values: string[]) => {});
webdriver.promise.asap('abc', function (value: any) { return true; });
webdriver.promise.asap('abc', function (value: any) { }, function (err: any) { return 'ABC'; });
webdriver.promise.asap('abc', (value: any) => true);
webdriver.promise.asap('abc', (value: any) => {}, (err: any) => 'ABC');
stringPromise = webdriver.promise.checkedNodeCall<string>(function (err: any, value: any) { return 'abc'; });
stringPromise = webdriver.promise.checkedNodeCall<string>((err: any, value: any) => 'abc');
webdriver.promise.consume(function () {
webdriver.promise.consume(() => {
return 5;
}).then(function (value: number) { });
webdriver.promise.consume(function () {
}).then((value: number) => {});
webdriver.promise.consume(() => {
return 5;
}, this).then(function (value: number) { });
webdriver.promise.consume(function (a: number, b: number, c: number) {
return 5;
}, this, 1, 2, 3).then(function (value: number) { });
}, this).then((value: number) => {});
webdriver.promise.consume((a: number, b: number, c: number) => 5, this, 1, 2, 3)
.then((value: number) => {});
var numbersPromise: webdriver.promise.Promise<number[]> = webdriver.promise.filter([1, 2, 3], function (element: number, type: any, index: number, arr: number[]) {
var numbersPromise: webdriver.promise.Promise<number[]> = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => {
return true;
});
numbersPromise = webdriver.promise.filter([1, 2, 3], function (element: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => {
return true;
}, this);
numbersPromise = webdriver.promise.filter(numbersPromise, function (element: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.filter(numbersPromise, (element: number, type: any, index: number, arr: number[]) => {
return true;
});
numbersPromise = webdriver.promise.filter(numbersPromise, function (element: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.filter(numbersPromise, (element: number, type: any, index: number, arr: number[]) => {
return true;
}, this);
numbersPromise = webdriver.promise.map([1, 2, 3], function (el: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.map([1, 2, 3], (el: number, type: any, index: number, arr: number[]) => {
return true;
});
numbersPromise = webdriver.promise.map([1, 2, 3], function (el: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.map([1, 2, 3], (el: number, type: any, index: number, arr: number[]) => {
return true;
}, this);
numbersPromise = webdriver.promise.map(numbersPromise, function (el: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.map(numbersPromise, (el: number, type: any, index: number, arr: number[]) => {
return true;
});
numbersPromise = webdriver.promise.map(numbersPromise, function (el: number, type: any, index: number, arr: number[]) {
numbersPromise = webdriver.promise.map(numbersPromise, (el: number, type: any, index: number, arr: number[]) => {
return true;
}, this);
var flow: webdriver.promise.ControlFlow = webdriver.promise.controlFlow();
stringPromise = webdriver.promise.createFlow<string>(function (newFlow: webdriver.promise.ControlFlow) { return 'ABC' });
stringPromise = webdriver.promise.createFlow<string>((newFlow: webdriver.promise.ControlFlow) => 'ABC');
var deferred: webdriver.promise.Deferred<string>;
deferred = webdriver.promise.defer();
@ -858,14 +857,14 @@ function TestPromiseModule() {
stringPromise = webdriver.promise.fullyResolved('abc');
var bool: boolean = webdriver.promise.isGenerator(function () { });
var bool: boolean = webdriver.promise.isGenerator(() => {});
var isPromise: boolean = webdriver.promise.isPromise('ABC');
stringPromise = webdriver.promise.rejected('{a: 123}');
webdriver.promise.setDefaultFlow(new webdriver.promise.ControlFlow());
numberPromise = webdriver.promise.when('abc', function (value: any) { return 123; }, function (err: Error) { return 123; });
numberPromise = webdriver.promise.when('abc', (value: any) => 123, (err: Error) => 123);
}
function TestUntilModule() {
@ -873,7 +872,7 @@ function TestUntilModule() {
withCapabilities(webdriver.Capabilities.chrome()).
build();
var conditionB: webdriver.until.Condition<boolean> = new webdriver.until.Condition<boolean>('message', function (driver: webdriver.WebDriver) { return true; });
var conditionB: webdriver.until.Condition<boolean> = new webdriver.until.Condition<boolean>('message', (driver: webdriver.WebDriver) => true);
var conditionBBase: webdriver.until.Condition<boolean> = conditionB;
var conditionWebElement: webdriver.until.Condition<webdriver.WebElement>;
var conditionWebElements: webdriver.until.Condition<webdriver.WebElement[]>;
@ -913,9 +912,9 @@ function TestControlFlow() {
eventType = webdriver.promise.ControlFlow.EventType.UNCAUGHT_EXCEPTION;
var stringPromise: webdriver.promise.Promise<string>;
stringPromise = flow.execute(function () { return 'value'; });
stringPromise = flow.execute(function () { return stringPromise; });
stringPromise = flow.execute(function () { return stringPromise; }, 'Description');
stringPromise = flow.execute(() => 'value');
stringPromise = flow.execute(() => stringPromise);
stringPromise = flow.execute(() => stringPromise, 'Description');
var schedule: string;
schedule = flow.toString();
@ -929,9 +928,9 @@ function TestControlFlow() {
stringPromise = flow.wait(stringPromise);
voidPromise = flow.wait<void>(function () { return true; });
voidPromise = flow.wait<void>(function () { return true; }, 123);
voidPromise = flow.wait<void>(function () { return stringPromise; }, 123, 'Timeout Message');
voidPromise = flow.wait<void>(() => true);
voidPromise = flow.wait<void>(() => true, 123);
voidPromise = flow.wait<void>(() => stringPromise, 123, 'Timeout Message');
}
function TestDeferred() {
@ -953,28 +952,22 @@ function TestDeferred() {
function TestPromiseClass() {
var controlFlow: webdriver.promise.ControlFlow;
var promise: webdriver.promise.Promise<string>;
promise = new webdriver.promise.Promise<string>(function (
resolve: (value: string) => void,
reject: () => void) { });
promise = new webdriver.promise.Promise<string>(function (
resolve: (value: webdriver.promise.Promise<string>) => void,
reject: () => void) { });
promise = new webdriver.promise.Promise<string>(function (
resolve: (value: string) => void,
reject: () => void) { }, controlFlow);
promise = new webdriver.promise.Promise<string>((resolve: (value: string) => void, reject: () => void) => {});
promise = new webdriver.promise.Promise<string>((resolve: (value: webdriver.promise.Promise<string>) => void, reject: () => void) => {});
promise = new webdriver.promise.Promise<string>((resolve: (value: string) => void, reject: () => void) => {}, controlFlow);
promise.cancel('Abort');
var isPending: boolean = promise.isPending();
promise = promise.then();
promise = promise.then(function (a: string) { return 'cde'; });
promise = promise.then(function (a: string) { return 'cde'; }, function (e: any) { });
promise = promise.then(function (a: string) { return 'cde'; }, function (e: any) { return 123; });
promise = promise.then((a: string) => 'cde');
promise = promise.then((a: string) => 'cde', (e: any) => {});
promise = promise.then((a: string) => 'cde', (e: any) => 123);
promise = promise.thenCatch(function (error: any) { });
promise = promise.thenCatch((error: any) => {});
promise.thenFinally(function () { });
promise.thenFinally(() => {});
}
function TestThenableClass() {
@ -986,13 +979,13 @@ function TestThenableClass() {
var isPending: boolean = thenable.isPending();
thenable = thenable.then(function (a: string) { return 'cde'; });
thenable = thenable.then(function (a: string) { return 'cde'; }, function (e: any) { });
thenable = thenable.then(function (a: string) { return 'cde'; }, function (e: any) { return 123; });
thenable = thenable.then((a: string) => 'cde');
thenable = thenable.then((a: string) => 'cde', (e: any) => {});
thenable = thenable.then((a: string) => 'cde', (e: any) => 123);
thenable = thenable.thenCatch(function (error: any) { });
thenable = thenable.thenCatch((error: any) => {});
thenable.thenFinally(function () { });
thenable.thenFinally(() => {});
}
function TestErrorCode() {
@ -1030,29 +1023,29 @@ async function TestAsyncAwaitable() {
}
function TestTestingModule() {
testing.before(function () {
testing.before(() => {
});
testing.beforeEach(function () {
testing.beforeEach(() => {
});
testing.describe('My test suite', function () {
testing.it('My test', function () {
testing.describe('My test suite', () => {
testing.it('My test', () => {
});
testing.iit('My exclusive test.', function () {
testing.iit('My exclusive test.', () => {
});
});
testing.xdescribe('My disabled suite', function () {
testing.xit('My disabled test.', function () {
testing.xdescribe('My disabled suite', () => {
testing.xit('My disabled test.', () => {
});
});
testing.after(function () {
testing.after(() => {
});
testing.afterEach(function () {
testing.afterEach(() => {
});
}

View File

@ -0,0 +1,13 @@
/* tslint:disable */
import * as remote from "selenium-webdriver/remote";
import * as webdriver from "selenium-webdriver";
function TestRemoteFileDetector() {
const driver: webdriver.WebDriver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
.build();
const fileDetector: remote.FileDetector = new remote.FileDetector();
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => { /* empty */ });
}

View File

@ -1,64 +1,60 @@
/* tslint:disable */
declare namespace testing {
/**
* Registers a new test suite.
* @param name The suite name.
* @param fn The suite function, or {@code undefined} to define a pending test suite.
*/
function describe(name: string, fn: Function): void;
/**
* Registers a new test suite.
* @param name The suite name.
* @param fn The suite function, or {@code undefined} to define a pending test suite.
*/
export function describe(name: string, fn: Function): void;
/**
* Defines a suppressed test suite.
* @param name The suite name.
* @param fn The suite function, or {@code undefined} to define a pending test suite.
*/
function xdescribe(name: string, fn: Function): void;
/**
* Defines a suppressed test suite.
* @param name The suite name.
* @param fn The suite function, or {@code undefined} to define a pending test suite.
*/
export function xdescribe(name: string, fn: Function): void;
/**
* Register a function to call after the current suite finishes.
* @param fn
*/
function after(fn: Function): void;
/**
* Register a function to call after the current suite finishes.
* @param fn
*/
export function after(fn: Function): void;
/**
* Register a function to call after each test in a suite.
* @param fn
*/
function afterEach(fn: Function): void;
/**
* Register a function to call after each test in a suite.
* @param fn
*/
export function afterEach(fn: Function): void;
/**
* Register a function to call before the current suite starts.
* @param fn
*/
function before(fn: Function): void;
/**
* Register a function to call before the current suite starts.
* @param fn
*/
export function before(fn: Function): void;
/**
* Register a function to call before each test in a suite.
* @param fn
*/
function beforeEach(fn: Function): void;
/**
* Register a function to call before each test in a suite.
* @param fn
*/
export function beforeEach(fn: Function): void;
/**
* Add a test to the current suite.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
function it(name: string, fn: Function): void;
/**
* Add a test to the current suite.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
export function it(name: string, fn: Function): void;
/**
* An alias for {@link #it()} that flags the test as the only one that should
* be run within the current suite.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
function iit(name: string, fn: Function): void;
/**
* An alias for {@link #it()} that flags the test as the only one that should
* be run within the current suite.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
export function iit(name: string, fn: Function): void;
/**
* Adds a test to the current suite while suppressing it so it is not run.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
function xit(name: string, fn: Function): void;
}
export = testing;
/**
* Adds a test to the current suite while suppressing it so it is not run.
* @param name The test name.
* @param fn The test function, or {@code undefined} to define a pending test case.
*/
export function xit(name: string, fn: Function): void;

View File

@ -1,10 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
@ -34,6 +34,7 @@
"testing.d.ts",
"test/index.ts",
"test/chrome.ts",
"test/firefox.ts"
"test/firefox.ts",
"test/remote.ts"
]
}