Skip to content

Commit

Permalink
kill chromedriver before starting new chromedriver
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Jan 15, 2014
1 parent 115bb96 commit 3b1cc35
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/devices/android/chrome.js
Expand Up @@ -36,6 +36,7 @@ ChromeAndroid.prototype.start = function(cb, onDie) {
async.waterfall([
this.ensureChromedriverExists.bind(this),
this.unlock.bind(this),
this.killOldChromedrivers.bind(this),
this.startChromedriver.bind(this),
this.createSession.bind(this)
], cb);
Expand All @@ -58,6 +59,19 @@ ChromeAndroid.prototype.ensureChromedriverExists = function(cb) {
}.bind(this));
};

ChromeAndroid.prototype.killOldChromedrivers = function(cb) {
var cmd = isWindows ? "TASKKILL /IM chromedriver.exe" : "killall chromedriver";
logger.info("Killing any old chromedrivers");
exec(cmd, function(err) {
if (err) {
logger.info("No old chromedrivers seemed to exist");
} else {
logger.info("Successfully cleaned up old chromedrivers");
}
cb();
});
};

ChromeAndroid.prototype.startChromedriver = function(cb) {
this.onChromedriverStart = cb;
logger.info("Spawning chromedriver with: " + this.chromedriver);
Expand Down

0 comments on commit 3b1cc35

Please sign in to comment.