Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit e98f71e

Browse files
tombatossalsjuliemr
authored andcommitted
fix(webdriver-manager): fix IEDriver install and running via windows
Changed the binaries.ie.url function to return the correct URL for the IEDriverServer. Created the zip object in the win32 section to be able to decompress IEDriverServer. Added a function to normalize a command across OS and spawn it. It allows start the webdriver in win32. Seen here: https://github.com/yeoman/generator/blob/master/lib/actions/spawn_command.js
1 parent e97ea35 commit e98f71e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

bin/webdriver-manager

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ var binaries = {
5656
var urlPrefix = 'https://selenium.googlecode.com/files/IEDriverServer';
5757
if (os.type() == 'Windows_NT') {
5858
if (os.arch() == 'x64') {
59-
binaries.iedriver.url = urlPrefix + '_x64_' + versions.iedriver +
60-
'.zip';
59+
return urlPrefix + '_x64_' + versions.iedriver + '.zip';
6160
} else {
62-
binaries.iedriver.url = urlPrefix + '_win32_' + versions.iedriver +
63-
'.zip';
61+
return urlPrefix + '_win32_' + versions.iedriver + '.zip';
6462
}
6563
}
6664
}
@@ -125,6 +123,18 @@ var httpGetFile = function(fileUrl, fileName, outputDir, callback) {
125123
});
126124
};
127125

126+
/**
127+
* Normalize a command across OS
128+
*/
129+
var spawnCommand = function(command, args) {
130+
var win32 = process.platform === 'win32';
131+
var winCommand = win32 ? 'cmd' : command;
132+
var finalArgs = win32 ? ['/c'].concat(command, args) : args;
133+
134+
return require('child_process').spawn(winCommand, finalArgs,
135+
{ stdio: 'inherit' });
136+
};
137+
128138
/**
129139
* If a new version of the file with the given url exists, download and
130140
* delete the old version.
@@ -197,8 +207,7 @@ switch (argv._[0]) {
197207
args.push('-Dwebdriver.ie.driver=' +
198208
path.join(argv.out_dir, executableName('IEDriverServer')));
199209
}
200-
var javaChild = require('child_process').spawn(
201-
'java', args, { stdio: 'inherit' });
210+
spawnCommand('java', args);
202211
break;
203212
case 'status':
204213
for (name in binaries) {
@@ -232,6 +241,7 @@ switch (argv._[0]) {
232241
if (argv.ie) {
233242
downloadIfNew(binaries.ie, argv.out_dir, existingFiles,
234243
function(filename) {
244+
var zip = new AdmZip(filename);
235245
// Expected contents of the zip:
236246
// IEDriverServer.exe
237247
zip.extractAllTo(argv.out_dir);

0 commit comments

Comments
 (0)