mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 05:20:24 +08:00
add(selenium-webdriver): SeleniumServer to remote.d.ts (#20516)
* add(selenium-webdriver): SeleniumServer to remote.d.ts * adding test for SeleniumServer * Add missing interface definition and tests * Removing "undefined" from optional interface definitions * Moving comments to invidual members
This commit is contained in:
46
types/selenium-webdriver/remote.d.ts
vendored
46
types/selenium-webdriver/remote.d.ts
vendored
@@ -157,6 +157,52 @@ export namespace DriverService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages the life and death of the
|
||||
* <a href="http://selenium-release.storage.googleapis.com/index.html">
|
||||
* standalone Selenium server</a>.
|
||||
*/
|
||||
export class SeleniumServer extends DriverService {
|
||||
/**
|
||||
* @param {string} jar Path to the Selenium server jar.
|
||||
* @param {SeleniumServer.Options=} opt_options Configuration options for the
|
||||
* server.
|
||||
* @throws {Error} If the path to the Selenium jar is not specified or if an
|
||||
* invalid port is specified.
|
||||
**/
|
||||
constructor(jar: string, opt_options?: SeleniumServer.Options);
|
||||
}
|
||||
|
||||
export namespace SeleniumServer {
|
||||
/**
|
||||
* Options for the Selenium server
|
||||
*/
|
||||
interface Options {
|
||||
/** Whether the server should only be accessed on this host's loopback address.*/
|
||||
loopback?: boolean;
|
||||
|
||||
/** The port to start the server on (must be > 0). If the port is provided
|
||||
as a promise, the service will wait for the promise to resolve before starting. */
|
||||
port?: number|webdriver.promise.IThenable<number>;
|
||||
|
||||
/** The arguments to pass to the service. If a promise is provided, the
|
||||
service will wait for it to resolve before starting. */
|
||||
args?: string[]|webdriver.promise.IThenable<string[]>;
|
||||
|
||||
/** The arguments to pass to the JVM. If a promise is provided, the service
|
||||
will wait for it to resolve before starting. */
|
||||
jvmArgs?: string[]|webdriver.promise.IThenable<string[]>;
|
||||
|
||||
/** The environment variables that should be visible to the server process.
|
||||
Defaults to inheriting the current process's environment.*/
|
||||
env?: {[key: string]: string};
|
||||
|
||||
/** IO configuration for the spawned server process. For more information,
|
||||
refer to the documentation of `child_process.spawn`*/
|
||||
stdio?: string|Array<string|number>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link webdriver.FileDetector} that may be used when running
|
||||
* against a remote
|
||||
|
||||
@@ -9,3 +9,21 @@ function TestRemoteFileDetector() {
|
||||
const fileDetector: remote.FileDetector = new remote.FileDetector();
|
||||
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => { /* empty */ });
|
||||
}
|
||||
|
||||
function TestSeleniumServer() {
|
||||
const pathToJar = '/path/to/jar';
|
||||
const seleniumServer: remote.SeleniumServer = new remote.SeleniumServer(pathToJar);
|
||||
}
|
||||
|
||||
function TestSeleniumServerOptions() {
|
||||
const pathToJar = '/path/to/jar';
|
||||
const options: remote.SeleniumServer.Options = {
|
||||
loopback: false,
|
||||
port: 4444,
|
||||
args: ['--testArg'],
|
||||
jvmArgs: ['--testJvmArg'],
|
||||
env: {test1: 'test1', test2: 'test2'},
|
||||
stdio: 'inherit'
|
||||
}
|
||||
const seleniumServer: remote.SeleniumServer = new remote.SeleniumServer(pathToJar, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user