Skip to content

Commit

Permalink
supprt browser
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng committed May 3, 2016
1 parent fed81a6 commit 8471f4e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions lib/macaca-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const errors = require('webdriver-dfn-error-code').errors;
const _ = require('./helper');
const logger = require('./logger');
const controllers = require('./controllers');

const WEBVIEW = 'WEBVIEW';

class Android extends DriverBase {
Expand All @@ -27,21 +26,27 @@ class Android extends DriverBase {
this.proxy = null;
this.udid = null;
this.uiautomator = null;
this.isChrome = null;
this.contexts = [];
}
}

Android.prototype.startDevice = function *(caps) {
this.args = _.clone(caps);
this.isChrome = this.args.browserName && this.args.browserName.toLowerCase() === 'chrome';
yield JAVA.getVersion();
this.initAdb();
yield this.initDevice();
yield this.getApkInfo();
yield this.initUiautomator();
yield this.getApkInfo();
yield this.adb.install(UnlockApk.apkPath);
yield this.unlock();
yield this.launchApk();
yield this.waitActivityReady();

if (this.isChrome) {
yield this.getWebviews();
}
};

Android.prototype.stopDevice = function() {
Expand Down Expand Up @@ -132,6 +137,14 @@ Android.prototype.initDevice = function *() {
};

Android.prototype.getApkInfo = function *() {

if (this.isChrome) {
return this.apkInfo = {
package: 'com.android.browser',
activity: '.BrowserActivity'
}
}

if (this.args.package && this.args.activity) {
this.apkInfo = {
package: this.args.package,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-android",
"version": "1.0.9",
"version": "1.0.10",
"description": "Macaca Android driver",
"keywords": [
"android"
Expand Down

0 comments on commit 8471f4e

Please sign in to comment.