Added selenium-webdriver missing fields to Firefox Options

This commit is contained in:
Joshua Goldberg
2018-06-03 17:08:40 -07:00
parent e4a45e562b
commit 0f79908f2f
2 changed files with 42 additions and 0 deletions

View File

@@ -149,6 +149,15 @@ export class Profile {
* Configuration options for the FirefoxDriver.
*/
export class Options {
/**
* Specify additional command line arguments that should be used when starting
* the Firefox browser.
*
* @param {...(string|!Array<string>)} args The arguments to include.
* @return {!Options} A self reference.
*/
addArguments(...args: string[]): Options;
/**
* Sets the browser to be in headless mode.
*
@@ -156,6 +165,33 @@ export class Options {
*/
headless(): Options;
/**
* Sets the initial window size when running in
* {@linkplain #headless headless} mode.
*
* @param {{width: number, height: number}} size The desired window size.
* @return {!Options} A self reference.
* @throws {TypeError} if width or height is unspecified, not a number, or
* less than or equal to 0.
*/
windowSize(size: { width: number, height: number }): Options;
/**
* Add extensions that should be installed when starting Firefox.
*
* @param {...string} paths The paths to the extension XPI files to install.
* @return {!Options} A self reference.
*/
addExtensions(...paths: string[]): Options;
/**
* @param {string} key the preference key.
* @param {(string|number|boolean)} value the preference value.
* @return {!Options} A self reference.
* @throws {TypeError} if either the key or value has an invalid type.
*/
setPreference(key: string, value: string | number | boolean): 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

View File

@@ -25,6 +25,12 @@ function TestFirefoxDriver() {
function TestFirefoxOptions() {
let options: firefox.Options = new firefox.Options();
options = options.addArguments('foo', 'bar');
options = options.windowSize({ width: 320, height: 480 });
options = options.addExtensions('foo', 'bar');
options = options.setPreference('a', 1);
options = options.setPreference('a', true);
options = options.setPreference('a', '1');
options = options.setBinary('binary');
options = options.setBinary(new firefox.Binary());
options = options.setLoggingPreferences(new webdriver.logging.Preferences());