Skip to content

fix(ie): Use 32-bit version by default for IEDriver #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(ie): Use 32-bit version by default for IEDriver
closes #180
  • Loading branch information
cnishina committed Jan 5, 2017
commit 8b48b958b599c4535afeee968b4a1aed510facbf
1 change: 0 additions & 1 deletion lib/binaries/android_sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class AndroidSDK extends Binary {
static id = 'android';
static versionDefault = Config.binaryVersions().android;
static isDefault = false;
static shortName = ['android'];
static DEFAULT_API_LEVELS = '24';
static DEFAULT_ARCHITECTURES = getAndroidArch();
static DEFAULT_PLATFORMS = 'google_apis';
Expand Down
1 change: 0 additions & 1 deletion lib/binaries/appium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class Appium extends Binary {
static id = 'appium';
static versionDefault = Config.binaryVersions().appium;
static isDefault = false;
static shortName = ['appium'];

constructor(alternateCDN?: string) {
super(alternateCDN || Config.cdnUrls().appium);
Expand Down
2 changes: 0 additions & 2 deletions lib/binaries/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export interface BinaryMap<T extends Binary> { [id: string]: T; }
export class Binary {
static os: OS[]; // the operating systems, the binary can run on
static id: string; // the binaries key identifier
static isDefault: boolean; // to download by default
static versionDefault: string; // a static default version variable
static shortName: string[]; // the names used for a binary download
name: string; // used for logging to console
prefixDefault: string; // start of the file name
versionCustom: string; // version of file
Expand Down
1 change: 0 additions & 1 deletion lib/binaries/chrome_driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class ChromeDriver extends Binary {
static id = 'chrome';
static versionDefault = Config.binaryVersions().chrome;
static isDefault = true;
static shortName = ['chrome'];

constructor(alternateCDN?: string) {
super(alternateCDN || Config.cdnUrls().chrome);
Expand Down
1 change: 0 additions & 1 deletion lib/binaries/gecko_driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class GeckoDriver extends Binary {
static id = 'gecko';
static versionDefault = Config.binaryVersions().gecko;
static isDefault = true;
static shortName = ['gecko'];

private static suffixes: SuffixMap = {
'Darwin': {'x64': '-macos.tar.gz'},
Expand Down
4 changes: 2 additions & 2 deletions lib/binaries/ie_driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class IEDriver extends Binary {
static os = [OS.Windows_NT];
static id = 'ie';
static versionDefault = Config.binaryVersions().ie;
static isDefault = false;
static shortName = ['ie', 'ie32'];
static isDefault32 = false;
static isDefault64 = false;

constructor(alternateCDN?: string) {
super(alternateCDN || Config.cdnUrls().ie);
Expand Down
1 change: 0 additions & 1 deletion lib/binaries/stand_alone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class StandAlone extends Binary {
static id = 'standalone';
static versionDefault = Config.binaryVersions().selenium;
static isDefault = true;
static shortName = ['standalone'];

constructor(alternateCDN?: string) {
super(alternateCDN || Config.cdnUrls().selenium);
Expand Down
5 changes: 3 additions & 2 deletions lib/cmds/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ export function android(
'android-sdk: Downloading more additional SDK updates ' +
'(this may take a while)');
return downloadAndroidUpdates(
sdkPath, ['build-tools-24.0.0'].concat(
getAndroidSDKTargets(apiLevels, architectures, platforms, oldAVDs)),
sdkPath,
['build-tools-24.0.0'].concat(
getAndroidSDKTargets(apiLevels, architectures, platforms, oldAVDs)),
true, acceptLicenses, verbose);
})
.then(() => {
Expand Down
12 changes: 9 additions & 3 deletions lib/cmds/opts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const STANDALONE = 'standalone';
export const CHROME = 'chrome';
export const IE = 'ie';
export const IE32 = 'ie32';
export const IE64 = 'ie64';
export const EDGE = 'edge';
export const GECKO = 'gecko';
export const ANDROID = 'android';
Expand Down Expand Up @@ -58,8 +59,12 @@ opts[STANDALONE] = new Option(
opts[CHROME] =
new Option(CHROME, 'Install or update chromedriver', 'boolean', ChromeDriver.isDefault);
opts[GECKO] = new Option(GECKO, 'Install or update geckodriver', 'boolean', GeckoDriver.isDefault);
opts[IE] = new Option(IE, 'Install or update ie driver', 'boolean', IEDriver.isDefault);
opts[IE32] = new Option(IE32, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault);
opts[IE] = new Option(IE, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault32);
opts[IE32] =
new Option(IE32, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault32);
opts[IE64] = new Option(
IE64, 'Update: install or update 64-bit IE driver. Start: use installed x64 IE driver.',
'boolean', IEDriver.isDefault64);
opts[EDGE] = new Option(
EDGE, 'Use installed Microsoft Edge driver', 'string',
'C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe');
Expand Down Expand Up @@ -105,7 +110,8 @@ opts[STARTED_SIGNIFIER] = new Option(
'A string to be outputted once the selenium server is up and running. Useful if you are writing a script which uses webdriver-manager.',
'string');
opts[SIGNAL_VIA_IPC] = new Option(
SIGNAL_VIA_IPC, 'If you are using --' + STARTED_SIGNIFIER +
SIGNAL_VIA_IPC,
'If you are using --' + STARTED_SIGNIFIER +
', this flag will emit the signal string using process.send(), rather than writing it to stdout',
'boolean', false);
opts[DETACH] = new Option(
Expand Down
10 changes: 4 additions & 6 deletions lib/cmds/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ if (Config.osType() === 'Darwin') {
}

if (Config.osType() === 'Windows_NT') {
prog.addOption(Opts[Opt.VERSIONS_IE])
.addOption(Opts[Opt.IE32])
.addOption(Opts[Opt.IE])
.addOption(Opts[Opt.EDGE]);
prog.addOption(Opts[Opt.VERSIONS_IE]).addOption(Opts[Opt.IE64]).addOption(Opts[Opt.EDGE]);
}

export var program = prog;
Expand Down Expand Up @@ -153,8 +150,9 @@ function start(options: Options) {
path.resolve(outputDir, binaries[GeckoDriver.id].executableFilename(osType)));
}
if (downloadedBinaries[IEDriver.id] != null) {
if (options[Opt.IE32].getBoolean()) {
binaries[IEDriver.id].arch = 'Win32';
binaries[IEDriver.id].arch = 'Win32'; // use Win 32 by default
if (options[Opt.IE64].getBoolean()) {
binaries[IEDriver.id].arch = Config.osArch(); // use the system architecture
}
args.push(
'-Dwebdriver.ie.driver=' +
Expand Down
2 changes: 1 addition & 1 deletion lib/cmds/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function status(options: Options) {
updateConfig = {};
}


let downloadedBinaries = FileManager.downloadedBinaries(outputDir);

// Log which binaries have been downloaded.
for (let bin in downloadedBinaries) {
let downloaded = downloadedBinaries[bin];
Expand Down
13 changes: 8 additions & 5 deletions lib/cmds/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (Config.osType() === 'Darwin') {
}

if (Config.osType() === 'Windows_NT') {
prog.addOption(Opts[Opt.IE]).addOption(Opts[Opt.IE32]);
prog.addOption(Opts[Opt.IE]).addOption(Opts[Opt.IE32]).addOption(Opts[Opt.IE64]);
}

prog.addOption(Opts[Opt.VERSIONS_STANDALONE])
Expand Down Expand Up @@ -72,13 +72,16 @@ function update(options: Options): Promise<void> {
let standalone = options[Opt.STANDALONE].getBoolean();
let chrome = options[Opt.CHROME].getBoolean();
let gecko = options[Opt.GECKO].getBoolean();
let ie: boolean = false;
let ie32: boolean = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why two variables if they're just gonna be the same thing anyway? Combine both into ie32

let ie64: boolean = false;
if (options[Opt.IE]) {
ie = options[Opt.IE].getBoolean();
ie32 = ie32 || options[Opt.IE].getBoolean();
}
if (options[Opt.IE32]) {
ie32 = options[Opt.IE32].getBoolean();
ie32 = ie32 || options[Opt.IE32].getBoolean();
}
if (options[Opt.IE64]) {
ie64 = options[Opt.IE64].getBoolean();
}
let android: boolean = options[Opt.ANDROID].getBoolean();
let ios: boolean = false;
Expand Down Expand Up @@ -150,7 +153,7 @@ function update(options: Options): Promise<void> {
updateBrowserFile(binary, outputDir);
promises.push(updateBinary(binary, outputDir, proxy, ignoreSSL));
}
if (ie) {
if (ie64) {
let binary = binaries[IEDriver.id];
binary.arch = Config.osArch(); // Win32 or x64
updateBrowserFile(binary, outputDir);
Expand Down
6 changes: 5 additions & 1 deletion lib/files/file_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ export class FileManager {
}
// if the suffix does not match the executable,
// the binary is something like: .exe and .zip
else if (existFile.indexOf(binary.suffix(osType, arch)) === -1) {
// TODO(cnishina): fix implementation. Suffix method is dependent on the version number
// example: chromedriver < 2.23 has a different suffix than 2.23+ (mac32.zip vs mac64.zip).
else if (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an extra check... current implementation of this needs some fixing. This is because downloading a file before 2.23 suffix is mac32.zip and this method is returning mac64.zip. Unfortunately, when we get the suffix the version is not set.

Not having extra checks:

webdriver-manager status

chromedriver versions available: 2.20 [last], 2.20mac32.zip, 2.26 [default]

Adding a TODO(cnishina) to fix this.

!existFile.endsWith('.zip') && !existFile.endsWith('.tar.gz') &&
existFile.indexOf(binary.suffix(osType, arch)) === -1) {
editExistFile = editExistFile.replace(binary.executableSuffix(osType), '');
editExistFile = editExistFile.indexOf('_') === 0 ?
editExistFile.substring(1, editExistFile.length) :
Expand Down
2 changes: 0 additions & 2 deletions spec/cmds/status_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe('status', () => {
// geckodriver {{config version}} [last] [default]
// standalone 2.24 [last], {{config version}} [default]
beforeAll((done) => {
Config.osType_ = 'Linux';
Config.osArch_ = 'x64';
argv = {
'_': ['update'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not matter which os arch and type we are downloading.

'versions': {'chrome': '2.24', 'standalone': '2.44.0'},
Expand Down