Skip to content

Commit

Permalink
[JS] Fixing ieOptions in JS bindings (SeleniumHQ#8152)
Browse files Browse the repository at this point in the history
* Modify: Updating year in NOTICE and LICENSE document

* [JS] Fixing ieOptions

Signed-off-by: Sri Harsha <sri_harsha509@hotmail.com>
  • Loading branch information
harsha509 committed Apr 2, 2020
1 parent 7824d1d commit bc5dfbb
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions javascript/node/selenium-webdriver/ie.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ const {Browser, Capabilities, Capability} = require('./lib/capabilities');


const IEDRIVER_EXE = 'IEDriverServer.exe';


const OPTIONS_CAPABILITY_KEY = 'se:ieOptions';

/**
* IEDriverServer logging levels.
Expand All @@ -56,8 +55,6 @@ const Level = {
TRACE: 'TRACE'
};



/**
* Option keys:
* https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#ie-specific
Expand Down Expand Up @@ -93,12 +90,17 @@ class Options extends Capabilities {
*/
constructor(other = undefined) {
super(other);
this.setBrowserName(Browser.IE);

/** @private {!Object} */
this.options_ = this.get(OPTIONS_CAPABILITY_KEY) || {};

this.set(OPTIONS_CAPABILITY_KEY, this.options_);
this.setBrowserName(Browser.INTERNET_EXPLORER);
}

/**
* Whether to disable the protected mode settings check when the session is
* created. Disbling this setting may lead to significant instability as the
* created. Disabling this setting may lead to significant instability as the
* browser may become unresponsive/hang. Only "best effort" support is provided
* when using this capability.
*
Expand All @@ -109,7 +111,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings) {
this.set(Key.IGNORE_PROTECTED_MODE_SETTINGS, !!ignoreSettings);
this.options_[Key.IGNORE_PROTECTED_MODE_SETTINGS] = !!ignoreSettings;
return this;
}

Expand All @@ -121,7 +123,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
ignoreZoomSetting(ignore) {
this.set(Key.IGNORE_ZOOM_SETTING, !!ignore);
this.options_[Key.IGNORE_ZOOM_SETTING] = !!ignore;
return this;
}

Expand All @@ -136,7 +138,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
initialBrowserUrl(url) {
this.set(Key.INITIAL_BROWSER_URL, url);
this.options_[Key.INITIAL_BROWSER_URL] = url;
return this;
}

Expand All @@ -149,7 +151,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
enablePersistentHover(enable) {
this.set(Key.ENABLE_PERSISTENT_HOVER, !!enable);
this.options_[Key.ENABLE_PERSISTENT_HOVER] = !!enable;
return this;
}

Expand All @@ -163,7 +165,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
enableElementCacheCleanup(enable) {
this.set(Key.ENABLE_ELEMENT_CACHE_CLEANUP, !!enable);
this.options_[Key.ENABLE_ELEMENT_CACHE_CLEANUP] = !!enable;
return this;
}

Expand All @@ -177,7 +179,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
requireWindowFocus(require) {
this.set(Key.REQUIRE_WINDOW_FOCUS, !!require);
this.options_[Key.REQUIRE_WINDOW_FOCUS] = !!require;
return this;
}

Expand All @@ -190,7 +192,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
browserAttachTimeout(timeout) {
this.set(Key.BROWSER_ATTACH_TIMEOUT, Math.max(timeout, 0));
this.options_[Key.BROWSER_ATTACH_TIMEOUT] = Math.max(timeout, 0);
return this;
}

Expand All @@ -204,7 +206,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
forceCreateProcessApi(force) {
this.set(Key.FORCE_CREATE_PROCESS, !!force);
this.options_[Key.FORCE_CREATE_PROCESS] = !!force;
return this;
}

Expand All @@ -217,9 +219,7 @@ class Options extends Capabilities {
*/
addArguments(...args) {
let current = this.get(Key.BROWSER_COMMAND_LINE_SWITCHES) || [];
this.set(
Key.BROWSER_COMMAND_LINE_SWITCHES,
current.concat.apply(current, args));
this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] = current.concat.apply(current, args);
return this;
}

Expand All @@ -232,7 +232,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
usePerProcessProxy(enable) {
this.set(Key.USE_PER_PROCESS_PROXY, !!enable);
this.options_[Key.USE_PER_PROCESS_PROXY] = !!enable;
return this;
}

Expand All @@ -246,7 +246,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
ensureCleanSession(cleanSession) {
this.set(Key.ENSURE_CLEAN_SESSION, !!cleanSession);
this.options_[Key.ENSURE_CLEAN_SESSION] = !!cleanSession;
return this;
}

Expand All @@ -256,7 +256,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
setLogFile(file) {
this.set(Key.LOG_FILE, file);
this.options_[Key.LOG_FILE] = file;
return this;
}

Expand All @@ -266,7 +266,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
setLogLevel(level) {
this.set(Key.LOG_LEVEL, level);
this.options_[Key.LOG_LEVEL] = level;
return this;
}

Expand All @@ -276,7 +276,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
setHost(host) {
this.set(Key.HOST, host);
this.options_[Key.HOST] = host;
return this;
}

Expand All @@ -286,7 +286,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
setExtractPath(path) {
this.set(Key.EXTRACT_PATH, path);
this.options_[Key.EXTRACT_PATH] = path;
return this;
}

Expand All @@ -296,7 +296,7 @@ class Options extends Capabilities {
* @return {!Options} A self reference.
*/
silent(silent) {
this.set(Key.SILENT, silent);
this.options_[Key.SILENT] = silent;
return this;
}
}
Expand Down

0 comments on commit bc5dfbb

Please sign in to comment.