How to use this.startAUT method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

driver.js

Source:driver.js Github

copy

Full Screen

...254      await this.startChromeSession();255    } else {256      if (this.opts.autoLaunch) {257        // start app258        await this.startAUT();259      }260    }261    if (util.hasValue(this.opts.orientation)) {262      log.debug(`Setting initial orientation to '${this.opts.orientation}'`);263      await this.setOrientation(this.opts.orientation);264    }265    await this.initAutoWebview();266  }267  async initAutoWebview () {268    if (this.opts.autoWebview) {269      let viewName = this.defaultWebviewName();270      let timeout = (this.opts.autoWebviewTimeout) || 2000;271      log.info(`Setting auto webview to context '${viewName}' with timeout ${timeout}ms`);272      // try every 500ms until timeout is over...

Full Screen

Full Screen

general.js

Source:general.js Github

copy

Full Screen

...154  return this.apkStrings[language];155};156commands.launchApp = async function () {157  await this.initAUT();158  await this.startAUT();159};160commands.startActivity = async function (appPackage, appActivity,161                                         appWaitPackage, appWaitActivity,162                                         intentAction, intentCategory,163                                         intentFlags, optionalIntentArguments,164                                         dontStopAppOnReset) {165  log.debug(`Starting package '${appPackage}' and activity '${appActivity}'`);166  // dontStopAppOnReset is both an argument here, and a desired capability167  // if the argument is set, use it, otherwise use the cap168  if (!util.hasValue(dontStopAppOnReset)) {169    dontStopAppOnReset = !!this.opts.dontStopAppOnReset;170  }171  let args = {172    pkg: appPackage,173    activity: appActivity,174    waitPkg: appWaitPackage || appPackage,175    waitActivity: appWaitActivity || appActivity,176    action: intentAction,177    category: intentCategory,178    flags: intentFlags,179    optionalIntentArguments,180    stopApp: !dontStopAppOnReset181  };182  this.opts.startActivityArgs = this.opts.startActivityArgs || {};183  this.opts.startActivityArgs[`${appPackage}/${appActivity}`] = args;184  await this.adb.startApp(args);185};186commands.reset = async function () {187  if (this.opts.fullReset) {188    log.info("Running old fashion reset (reinstall)");189    await this.adb.stopAndClear(this.opts.appPackage);190    await this.adb.uninstallApk(this.opts.appPackage);191    await androidHelpers.installApkRemotely(this.adb, this.opts);192  } else {193    log.info("Running fast reset (stop and clear)");194    await this.adb.stopAndClear(this.opts.appPackage);195  }196  await this.grantPermissions();197  return await this.startAUT();198};199commands.startAUT = async function () {200  await this.adb.startApp({201    pkg: this.opts.appPackage,202    activity: this.opts.appActivity,203    action: this.opts.intentAction,204    category: this.opts.intentCategory,205    flags: this.opts.intentFlags,206    waitPkg: this.opts.appWaitPackage,207    waitActivity: this.opts.appWaitActivity,208    waitDuration: this.opts.appWaitDuration,209    optionalIntentArguments: this.opts.optionalIntentArguments,210    stopApp: !this.opts.dontStopAppOnReset211  });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2driver.init({3}).then(function() {4}).then(function() {5    return driver.quit();6}).done();7info: Welcome to Appium v1.3.4 (REV 0d3e6d3c3e0d3d9b1f0b6f8c6d5a6cfc7b0d0f8d)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var desiredCaps = {4};5var driver = wd.remote('localhost', 4723);6driver.init(desiredCaps, function(err) {7  if (err) {8    throw err;9  }10  driver.startAUT(function(err) {11    if (err) {12      throw err;13    }14    driver.isAppInstalled("io.appium.TestApp", function(err, installed) {15      if (err) {16        throw err;17      }18      console.log("App installed : " + installed);19      assert.equal(installed, true);20      driver.quit();21    });22  });23});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Android Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful