Skip to content

Commit

Permalink
fix: Detect the browser activity dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Feb 5, 2024
1 parent e58f997 commit c4c74cc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,15 @@ class AndroidUiautomator2Driver

if (this.isChromeSession) {
this.log.info("We're going to run a Chrome-based session");
const {pkg, activity} = utils.getChromePkg(this.opts.browserName!);
const {pkg, activity: defaultActivity} = utils.getChromePkg(this.opts.browserName!);
let activity: string = defaultActivity;
if (await this.adb.getApiLevel() >= 24) {
try {
activity = await this.adb.resolveLaunchableActivity(pkg);
} catch (e) {
this.log.warn(`Using the default ${pkg} activity ${activity}. Original error: ${e.message}`);
}
}
this.opts.appPackage = this.caps.appPackage = pkg;
this.opts.appActivity = this.caps.appActivity = activity;
this.log.info(`Chrome-type package and activity are ${pkg} and ${activity}`);
Expand Down

0 comments on commit c4c74cc

Please sign in to comment.