Skip to content

Commit

Permalink
download all linux chromedriver architectures
Browse files Browse the repository at this point in the history
using the --chromedriver-install-all flag now downloads 32 and 64 bit archs
without the flag, the machine will download the one appropriate to its arch
fix #3368
  • Loading branch information
jlipps committed Aug 13, 2014
1 parent 9cf150d commit f8d8e55
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
40 changes: 28 additions & 12 deletions lib/devices/android/chromedriver.js
Expand Up @@ -22,22 +22,37 @@ var Chromedriver = function (args, onDie) {
this.onDie = onDie;
this.exitCb = null;
this.shuttingDown = false;

this.initChromedriverPath(args);
this.executable = args.executable;
};

Chromedriver.prototype.initChromedriverPath = function (args) {
if (args.executable) {
this.chromedriver = args.executable;
Chromedriver.prototype.initChromedriverPath = function (cb) {
if (this.executable) {
this.chromedriver = this.executable;
} else {
var executable = isWindows ? "chromedriver.exe" : "chromedriver";
var platform = "mac";
if (isWindows) {
platform = "windows";
} else if (isLinux) {
platform = "linux";
var setPath = function (platform, executable) {
this.chromedriver = path.resolve(__dirname, "..", "..", "..", "build",
"chromedriver", platform, executable);
logger.debug("Set chromedriver binary as: " + this.chromedriver);
}.bind(this);
if (isLinux) {
logger.debug("Determining linux architecture");
exec("uname -m", function (err, stdout) {
var executable;
if (err) return cb(err);
if (stdout.trim() === "i686") {
executable = "chromedriver32";
} else {
executable = "chromedriver64";
}
setPath("linux", executable);
cb();
});
} else {
var executable = isWindows ? "chromedriver.exe" : "chromedriver";
var platform = isWindows ? "windows" : "mac";
setPath(platform, executable);
cb();
}
this.chromedriver = path.resolve(__dirname, "..", "..", "..", "build", "chromedriver", platform, executable);
}
};

Expand Down Expand Up @@ -137,6 +152,7 @@ Chromedriver.prototype.createSession = function (caps, cb) {
desiredCapabilities: caps
};
async.waterfall([
this.initChromedriverPath.bind(this),
this.ensureChromedriverExists.bind(this),
this.killOldChromedrivers.bind(this),
this.start.bind(this),
Expand Down
11 changes: 9 additions & 2 deletions reset.sh
Expand Up @@ -507,20 +507,23 @@ reset_chromedriver() {
platform="mac"
chromedriver_file="chromedriver_mac32.zip"
run_cmd mkdir "$appium_home"/build/chromedriver/mac
install_chromedriver $platform $chromedriver_version $chromedriver_file
else
platform="linux"
chromedriver_file="chromedriver_linux$machine.zip"
binary="chromedriver$machine"
run_cmd mkdir "$appium_home"/build/chromedriver/linux
install_chromedriver $platform $chromedriver_version $chromedriver_file $binary
fi
install_chromedriver $platform $chromedriver_version $chromedriver_file
else
echo "* Building directory structure"
run_cmd mkdir "$appium_home"/build/chromedriver/mac
run_cmd mkdir "$appium_home"/build/chromedriver/linux
run_cmd mkdir "$appium_home"/build/chromedriver/windows

install_chromedriver "mac" $chromedriver_version "chromedriver_mac32.zip"
install_chromedriver "linux" $chromedriver_version "chromedriver_linux$machine.zip"
install_chromedriver "linux" $chromedriver_version "chromedriver_linux32.zip" "chromedriver32"
install_chromedriver "linux" $chromedriver_version "chromedriver_linux64.zip" "chromedriver64"
install_chromedriver "windows" $chromedriver_version "chromedriver_win32.zip"
fi
}
Expand All @@ -529,6 +532,7 @@ install_chromedriver() {
platform=$1
version=$2
file=$3
binary=$4

echo "* Downloading ChromeDriver version $version for $platform"
run_cmd curl -L http://chromedriver.storage.googleapis.com/$version/$file -o "$appium_home"/build/chromedriver/$platform/chromedriver.zip
Expand All @@ -537,6 +541,9 @@ install_chromedriver() {
echo "* Unzipping ChromeDriver"
run_cmd unzip chromedriver.zip
run_cmd rm chromedriver.zip
if [[ $binary != "" ]]; then
run_cmd mv chromedriver $binary
fi
run_cmd popd
}

Expand Down

0 comments on commit f8d8e55

Please sign in to comment.