Adding adb stop to chrome to prevent leaking of adb issue

This commit is contained in:
Moiz Virani
2014-08-14 14:53:42 -07:00
parent dcb6680318
commit af856a15e5
2 changed files with 18 additions and 2 deletions

View File

@@ -233,3 +233,16 @@ capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
```
Note that on 4.4+ devices, you can also use the 'Browser' `browserName` cap to automate the built-in browser. On all devices you can use the 'Chromium' `browserName` cap to automate a build of Chromium.
#### Troubleshooting chromedriver
As of Chrome version 33, a rooted device is no longer required. If running tests on older versions of Chrome, devices needed to be rooted as ChromeDriver required write access to the /data/local directory
to set Chrome's command line arguments.
If testing on Chrome app prior to version 33, ensure adb shell has read/write access to /data/local directory on the device:
```center
$ adb shell su -c chmod 777 /data/local
```
For more chromedriver specific documentation see [ChromeDriver documentation](https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android).

View File

@@ -107,7 +107,10 @@ ChromeAndroid.prototype.createSession = function (cb) {
ChromeAndroid.prototype.stop = function (cb) {
this.chromedriver.stop(function (err) {
if (err) return cb(err);
this.adb.forceStop(this.args.appPackage, cb);
this.adb.forceStop(this.args.appPackage, function (err) {
if (err) return cb(err);
this.adb.stopLogcat(cb);
}.bind(this));
}.bind(this));
};
@@ -117,7 +120,7 @@ ChromeAndroid.prototype.onChromedriverExit = function () {
_.partial(this.adb.forceStop.bind(this.adb), this.args.appPackage)
], function (err) {
if (err) logger.error(err.message);
this.onDie();
this.adb.stopLogcat(this.onDie());
}.bind(this));
};