How to use this.adb.setIME method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

android-common.js

Source:android-common.js Github

copy

Full Screen

...805        logger.debug('Unsetting IME \'' + this.defaultIME + '\'');806        logger.debug('Setting IME to \'io.appium.android.ime/.UnicodeIME\'');807        this.adb.enableIME('io.appium.android.ime/.UnicodeIME', function (err) {808          if (err) return cb(err);809          this.adb.setIME('io.appium.android.ime/.UnicodeIME', cb);810        }.bind(this));811      }.bind(this));812    }.bind(this));813  } else {814    cb();815  }816};817androidCommon.getNetworkConnection = function (cb) {818  logger.info('Getting network connection');819  this.adb.isAirplaneModeOn(function (err, airplaneModeOn) {820    if (err) return cb(err);821    var connection = airplaneModeOn ? 1 : 0;822    if (airplaneModeOn) {823      // airplane mode on implies wifi and data off824      return cb(null, {825        status: status.codes.Success.code,826        value: connection827      });828    }829    this.adb.isWifiOn(function (err, wifiOn) {830      if (err) return cb(err);831      connection += (wifiOn ? 2 : 0);832      this.adb.isDataOn(function (err, dataOn) {833        if (err) return cb(err);834        connection += (dataOn ? 4 : 0);835        cb(null, {836          status: status.codes.Success.code,837          value: connection838        });839      }.bind(this));840    }.bind(this));841  }.bind(this));842};843androidCommon.setNetworkConnection = function (type, ocb) {844  logger.info('Setting network connection');845  // decode the input846  var airplaneMode = type % 2;847  type >>= 1;848  var wifi = type % 2;849  type >>= 1;850  var data = type % 2;851  var series = [];852  // do airplane mode stuff first, since it will change the other statuses853  series.push(function (cb) {854    this.wrapActionAndHandleADBDisconnect(function (ncb) {855      this.adb.setAirplaneMode(airplaneMode, ncb);856    }.bind(this), cb);857  }.bind(this));858  series.push(function (cb) {859    this.wrapActionAndHandleADBDisconnect(function (ncb) {860      this.adb.broadcastAirplaneMode(airplaneMode, ncb);861    }.bind(this), cb);862  }.bind(this));863  // no need to do anything else if we are in or going into airplane mode864  if (airplaneMode === 0) {865    series.push(function (cb) {866      this.wrapActionAndHandleADBDisconnect(function (ncb) {867        this.adb.setWifiAndData({868          wifi: wifi,869          data: data870        }, ncb);871      }.bind(this), cb);872    }.bind(this));873  }874  async.series(series, function (err) {875    if (err) return ocb(err);876    return this.getNetworkConnection(ocb);877  }.bind(this));878};879androidCommon.isIMEActivated = function (cb) {880  // IME is always activated on Android devices881  cb(null, {882    status: status.codes.Success.code,883    value: true884  });885};886androidCommon.availableIMEEngines = function (cb) {887  logger.debug('Retrieving available IMEs');888  this.adb.availableIMEs(function (err, engines) {889    if (err) return cb(err);890    logger.debug('Engines: ' + JSON.stringify(engines));891    cb(null, {892      status: status.codes.Success.code,893      value: engines894    });895  });896};897androidCommon.getActiveIMEEngine = function (cb) {898  logger.debug('Retrieving current default IME');899  this.adb.defaultIME(function (err, engine) {900    if (err) return cb(err);901    cb(null, {902      status: status.codes.Success.code,903      value: engine904    });905  });906};907androidCommon.activateIMEEngine = function (imeId, cb) {908  logger.debug('Attempting to activate IME \'' + imeId + '\'');909  this.adb.availableIMEs(function (err, engines) {910    if (err) return cb(err);911    if (engines.indexOf(imeId) !== -1) {912      logger.debug('Found installed IME, attempting to activate.');913      this.adb.enableIME(imeId, function (err) {914        if (err) return cb(err);915        this.adb.setIME(imeId, function (err) {916          if (err) return cb(err);917          return cb(null, {918            status: status.codes.Success.code,919            value: null920          });921        });922      }.bind(this));923    } else {924      logger.debug('IME not found, failing.');925      return cb(null, {926        status: status.codes.IMENotAvailable.code,927        message: 'Unable to find requested IME \'' + imeId + '\'.'928      });929    }...

Full Screen

Full Screen

android-controller.js

Source:android-controller.js Github

copy

Full Screen

...980    if (engines.indexOf(imeId) !== -1) {981      logger.debug('Found installed IME, attempting to activate.');982      this.adb.enableIME(imeId, function (err) {983        if (err) return cb(err);984        this.adb.setIME(imeId, function (err) {985          if (err) return cb(err);986          return cb(null, {987            status: status.codes.Success.code,988            value: null989          });990        });991      }.bind(this));992    } else {993      logger.debug('IME not found, failing.');994      return cb(null, {995        status: status.codes.IMENotAvailable.code,996        message: 'Unable to find requested IME \'' + imeId + '\'.'997      });998    }...

Full Screen

Full Screen

driver.js

Source:driver.js Github

copy

Full Screen

1import { BaseDriver, DeviceSettings } from '@appium/base-driver';2import desiredConstraints from './desired-caps';3import commands from './commands/index';4import {5  helpers, ensureNetworkSpeed,6  SETTINGS_HELPER_PKG_ID,7} from './android-helpers';8import _ from 'lodash';9import { DEFAULT_ADB_PORT } from 'appium-adb';10import { fs, tempDir, util } from '@appium/support';11import { retryInterval } from 'asyncbox';12import { SharedPrefsBuilder } from 'shared-preferences-builder';13import B from 'bluebird';14const APP_EXTENSION = '.apk';15const DEVICE_PORT = 4724;16// This is a set of methods and paths that we never want to proxy to17// Chromedriver18const NO_PROXY = [19  ['POST', new RegExp('^/session/[^/]+/context')],20  ['GET', new RegExp('^/session/[^/]+/context')],21  ['POST', new RegExp('^/session/[^/]+/appium')],22  ['GET', new RegExp('^/session/[^/]+/appium')],23  ['POST', new RegExp('^/session/[^/]+/touch/perform')],24  ['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],25  ['POST', new RegExp('^/session/[^/]+/orientation')],26  ['GET', new RegExp('^/session/[^/]+/orientation')],27  ['POST', new RegExp('^/session/[^/]+/execute')],28  ['POST', new RegExp('^/session/[^/]+/execute/sync')],29  ['GET', new RegExp('^/session/[^/]+/network_connection')],30  ['POST', new RegExp('^/session/[^/]+/network_connection')],31];32class AndroidDriver extends BaseDriver {33  constructor (opts = {}, shouldValidateCaps = true) {34    super(opts, shouldValidateCaps);35    this.locatorStrategies = [36      'xpath',37      'id',38      'class name',39      'accessibility id',40      '-android uiautomator'41    ];42    this.desiredCapConstraints = desiredConstraints;43    this.sessionChromedrivers = {};44    this.jwpProxyActive = false;45    this.jwpProxyAvoid = _.clone(NO_PROXY);46    this.settings = new DeviceSettings({ignoreUnimportantViews: false},47                                       this.onSettingsUpdate.bind(this));48    this.chromedriver = null;49    this.apkStrings = {};50    this.unlocker = helpers.unlocker;51    for (let [cmd, fn] of _.toPairs(commands)) {52      AndroidDriver.prototype[cmd] = fn;53    }54    // needs to be after the line which assigns commands to AndroidDriver.prototype, so that `this.defaultContextName` is defined.55    this.curContext = this.defaultContextName();56  }57  async createSession (...args) {58    // the whole createSession flow is surrounded in a try-catch statement59    // if creating a session fails at any point, we teardown everything we60    // set up before throwing the error.61    try {62      let [sessionId, caps] = await super.createSession(...args);63      let serverDetails = {64        platform: 'LINUX',65        webStorageEnabled: false,66        takesScreenshot: true,67        javascriptEnabled: true,68        databaseEnabled: false,69        networkConnectionEnabled: true,70        locationContextEnabled: false,71        warnings: {},72        desired: this.caps73      };74      this.caps = Object.assign(serverDetails, this.caps);75      // assigning defaults76      let defaultOpts = {77        action: 'android.intent.action.MAIN',78        category: 'android.intent.category.LAUNCHER',79        flags: '0x10200000',80        disableAndroidWatchers: false,81        tmpDir: await tempDir.staticDir(),82        fullReset: false,83        autoLaunch: true,84        adbPort: DEFAULT_ADB_PORT,85        bootstrapPort: DEVICE_PORT,86        androidInstallTimeout: 90000,87      };88      _.defaults(this.opts, defaultOpts);89      this.useUnlockHelperApp = _.isUndefined(this.caps.unlockType);90      // not user visible via caps91      if (this.opts.noReset === true) {92        this.opts.fullReset = false;93      }94      if (this.opts.fullReset === true) {95        this.opts.noReset = false;96      }97      this.opts.fastReset = !this.opts.fullReset && !this.opts.noReset;98      this.opts.skipUninstall = this.opts.fastReset || this.opts.noReset;99      if (this.isChromeSession) {100        helpers.adjustBrowserSessionCaps(this.opts);101      }102      if (this.opts.nativeWebScreenshot) {103        this.jwpProxyAvoid.push(['GET', new RegExp('^/session/[^/]+/screenshot')]);104      }105      if (this.opts.reboot) {106        this.setAvdFromCapabilities(caps);107      }108      // get device udid for this session109      let {udid, emPort} = await helpers.getDeviceInfoFromCaps(this.opts);110      this.opts.udid = udid;111      this.opts.emPort = emPort;112      // set up an instance of ADB113      this.adb = await helpers.createADB({114        udid: this.opts.udid,115        emPort: this.opts.emPort,116        adbPort: this.opts.adbPort,117        suppressKillServer: this.opts.suppressKillServer,118        remoteAdbHost: this.opts.remoteAdbHost,119        clearDeviceLogsOnStart: this.opts.clearDeviceLogsOnStart,120        adbExecTimeout: this.opts.adbExecTimeout,121        allowOfflineDevices: this.opts.allowOfflineDevices,122      });123      if (await this.adb.getApiLevel() >= 23) {124        this.log.warn("Consider setting 'automationName' capability to " +125          "'uiautomator2' on Android >= 6, since UIAutomator framework " +126          'is not maintained anymore by the OS vendor.');127      }128      if (this.helpers.isPackageOrBundle(this.opts.app)) {129        // user provided package instead of app for 'app' capability, massage options130        this.opts.appPackage = this.opts.app;131        this.opts.app = null;132      }133      if (this.opts.app) {134        // find and copy, or download and unzip an app url or path135        this.opts.app = await this.helpers.configureApp(this.opts.app, APP_EXTENSION);136        await this.checkAppPresent();137      } else if (this.appOnDevice) {138        // the app isn't an actual app file but rather something we want to139        // assume is on the device and just launch via the appPackage140        this.log.info(`App file was not listed, instead we're going to run ` +141          `${this.opts.appPackage} directly on the device`);142        await this.checkPackagePresent();143      }144      // Some cloud services using appium launch the avd themselves, so we ensure netspeed145      // is set for emulators by calling adb.networkSpeed before running the app146      if (util.hasValue(this.opts.networkSpeed)) {147        if (!this.isEmulator()) {148          this.log.warn('Sorry, networkSpeed capability is only available for emulators');149        } else {150          const networkSpeed = ensureNetworkSpeed(this.adb, this.opts.networkSpeed);151          await this.adb.networkSpeed(networkSpeed);152        }153      }154      // check if we have to enable/disable gps before running the application155      if (util.hasValue(this.opts.gpsEnabled)) {156        if (this.isEmulator()) {157          this.log.info(`Trying to ${this.opts.gpsEnabled ? 'enable' : 'disable'} gps location provider`);158          await this.adb.toggleGPSLocationProvider(this.opts.gpsEnabled);159        } else {160          this.log.warn('Sorry! gpsEnabled capability is only available for emulators');161        }162      }163      await this.startAndroidSession(this.opts);164      return [sessionId, this.caps];165    } catch (e) {166      // ignoring delete session exception if any and throw the real error167      // that happened while creating the session.168      try {169        await this.deleteSession();170      } catch (ign) {}171      throw e;172    }173  }174  isEmulator () {175    return helpers.isEmulator(this.adb, this.opts);176  }177  setAvdFromCapabilities (caps) {178    if (this.opts.avd) {179      this.log.info('avd name defined, ignoring device name and platform version');180    } else {181      if (!caps.deviceName) {182        this.log.errorAndThrow('avd or deviceName should be specified when reboot option is enables');183      }184      if (!caps.platformVersion) {185        this.log.errorAndThrow('avd or platformVersion should be specified when reboot option is enabled');186      }187      let avdDevice = caps.deviceName.replace(/[^a-zA-Z0-9_.]/g, '-');188      this.opts.avd = `${avdDevice}__${caps.platformVersion}`;189    }190  }191  get appOnDevice () {192    return this.helpers.isPackageOrBundle(this.opts.app) || (!this.opts.app &&193           this.helpers.isPackageOrBundle(this.opts.appPackage));194  }195  get isChromeSession () {196    return helpers.isChromeBrowser(this.opts.browserName);197  }198  async onSettingsUpdate (key, value) {199    if (key === 'ignoreUnimportantViews') {200      await this.setCompressedLayoutHierarchy(value);201    }202  }203  async startAndroidSession () {204    this.log.info(`Starting Android session`);205    // set up the device to run on (real or emulator, etc)206    this.defaultIME = await helpers.initDevice(this.adb, this.opts);207    // set actual device name, udid, platform version, screen size, model and manufacturer details.208    this.caps.deviceName = this.adb.curDeviceId;209    this.caps.deviceUDID = this.opts.udid;210    this.caps.platformVersion = await this.adb.getPlatformVersion();211    this.caps.deviceScreenSize = await this.adb.getScreenSize();212    this.caps.deviceModel = await this.adb.getModel();213    this.caps.deviceManufacturer = await this.adb.getManufacturer();214    if (this.opts.disableWindowAnimation) {215      if (await this.adb.isAnimationOn()) {216        if (await this.adb.getApiLevel() >= 28) { // API level 28 is Android P217          // Don't forget to reset the relaxing in delete session218          this.log.warn('Relaxing hidden api policy to manage animation scale');219          await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);220        }221        this.log.info('Disabling window animation as it is requested by "disableWindowAnimation" capability');222        await this.adb.setAnimationState(false);223        this._wasWindowAnimationDisabled = true;224      } else {225        this.log.info('Window animation is already disabled');226      }227    }228    // set up app under test229    await this.initAUT();230    // start UiAutomator231    this.bootstrap = new helpers.bootstrap(this.adb, this.opts.bootstrapPort, this.opts.websocket);232    await this.bootstrap.start(this.opts.appPackage, this.opts.disableAndroidWatchers, this.opts.acceptSslCerts);233    // handling unexpected shutdown234    this.bootstrap.onUnexpectedShutdown.catch(async (err) => { // eslint-disable-line promise/prefer-await-to-callbacks235      if (!this.bootstrap.ignoreUnexpectedShutdown) {236        await this.startUnexpectedShutdown(err);237      }238    });239    if (!this.opts.skipUnlock) {240      // Let's try to unlock the device241      await helpers.unlock(this, this.adb, this.caps);242    }243    // Set CompressedLayoutHierarchy on the device based on current settings object244    // this has to happen _after_ bootstrap is initialized245    if (this.opts.ignoreUnimportantViews) {246      await this.settings.update({ignoreUnimportantViews: this.opts.ignoreUnimportantViews});247    }248    if (this.isChromeSession) {249      // start a chromedriver session and proxy to it250      await this.startChromeSession();251    } else {252      if (this.opts.autoLaunch) {253        // start app254        await this.startAUT();255      }256    }257    if (util.hasValue(this.opts.orientation)) {258      this.log.debug(`Setting initial orientation to '${this.opts.orientation}'`);259      await this.setOrientation(this.opts.orientation);260    }261    await this.initAutoWebview();262  }263  async initAutoWebview () {264    if (this.opts.autoWebview) {265      let viewName = this.defaultWebviewName();266      let timeout = (this.opts.autoWebviewTimeout) || 2000;267      this.log.info(`Setting auto webview to context '${viewName}' with timeout ${timeout}ms`);268      // try every 500ms until timeout is over269      await retryInterval(timeout / 500, 500, async () => {270        await this.setContext(viewName);271      });272    }273  }274  async initAUT () {275    // populate appPackage, appActivity, appWaitPackage, appWaitActivity,276    // and the device being used277    // in the opts and caps (so it gets back to the user on session creation)278    let launchInfo = await helpers.getLaunchInfo(this.adb, this.opts);279    Object.assign(this.opts, launchInfo);280    Object.assign(this.caps, launchInfo);281    // Uninstall any uninstallOtherPackages which were specified in caps282    if (this.opts.uninstallOtherPackages) {283      helpers.validateDesiredCaps(this.opts);284      // Only SETTINGS_HELPER_PKG_ID package is used by UIA1285      await helpers.uninstallOtherPackages(286        this.adb,287        helpers.parseArray(this.opts.uninstallOtherPackages),288        [SETTINGS_HELPER_PKG_ID]289      );290    }291    // Install any "otherApps" that were specified in caps292    if (this.opts.otherApps) {293      let otherApps;294      try {295        otherApps = helpers.parseArray(this.opts.otherApps);296      } catch (e) {297        this.log.errorAndThrow(`Could not parse "otherApps" capability: ${e.message}`);298      }299      otherApps = await B.all(otherApps.map((app) => this.helpers.configureApp(app, APP_EXTENSION)));300      await helpers.installOtherApks(otherApps, this.adb, this.opts);301    }302    // install app303    if (!this.opts.app) {304      if (this.opts.fullReset) {305        this.log.errorAndThrow('Full reset requires an app capability, use fastReset if app is not provided');306      }307      this.log.debug('No app capability. Assuming it is already on the device');308      if (this.opts.fastReset) {309        await helpers.resetApp(this.adb, this.opts);310      }311      return;312    }313    if (!this.opts.skipUninstall) {314      await this.adb.uninstallApk(this.opts.appPackage);315    }316    await helpers.installApk(this.adb, this.opts);317    const apkStringsForLanguage = await helpers.pushStrings(this.opts.language, this.adb, this.opts);318    if (this.opts.language) {319      this.apkStrings[this.opts.language] = apkStringsForLanguage;320    }321    // This must run after installing the apk, otherwise it would cause the322    // install to fail. And before running the app.323    if (!_.isUndefined(this.opts.sharedPreferences)) {324      await this.setSharedPreferences(this.opts);325    }326  }327  async checkAppPresent () {328    this.log.debug('Checking whether app is actually present');329    if (!(await fs.exists(this.opts.app))) {330      this.log.errorAndThrow(`Could not find app apk at ${this.opts.app}`);331    }332  }333  async checkPackagePresent () {334    this.log.debug('Checking whether package is present on the device');335    if (!(await this.adb.shell(['pm', 'list', 'packages', this.opts.appPackage]))) {336      this.log.errorAndThrow(`Could not find package ${this.opts.appPackage} on the device`);337    }338  }339  // Set CompressedLayoutHierarchy on the device340  async setCompressedLayoutHierarchy (compress) {341    await this.bootstrap.sendAction('compressedLayoutHierarchy', {compressLayout: compress});342  }343  async deleteSession () {344    this.log.debug('Shutting down Android driver');345    try {346      if (!_.isEmpty(this._screenRecordingProperties)) {347        await this.stopRecordingScreen();348      }349    } catch (ign) {}350    await helpers.removeAllSessionWebSocketHandlers(this.server, this.sessionId);351    await this.mobileStopScreenStreaming();352    await super.deleteSession();353    if (this.bootstrap) {354      // certain cleanup we only care to do if the bootstrap was ever run355      await this.stopChromedriverProxies();356      if (this.opts.unicodeKeyboard && this.opts.resetKeyboard && this.defaultIME) {357        this.log.debug(`Resetting IME to ${this.defaultIME}`);358        await this.adb?.setIME(this.defaultIME);359      }360      if (!this.isChromeSession && !this.opts.dontStopAppOnReset) {361        await this.adb?.forceStop(this.opts.appPackage);362      }363      await this.adb?.goToHome();364      if (this.opts.fullReset && !this.opts.skipUninstall && !this.appOnDevice) {365        await this.adb?.uninstallApk(this.opts.appPackage);366      }367      await this.bootstrap.shutdown();368      this.bootstrap = null;369    } else {370      this.log.debug("Called deleteSession but bootstrap wasn't active");371    }372    // some cleanup we want to do regardless, in case we are shutting down373    // mid-startup374    await this.adb?.stopLogcat();375    if (this.useUnlockHelperApp) {376      await this.adb?.forceStop('io.appium.unlock');377    }378    if (this._wasWindowAnimationDisabled) {379      this.log.info('Restoring window animation state');380      await this.adb?.setAnimationState(true);381      // This was necessary to change animation scale over Android P. We must reset the policy for the security.382      if (await this.adb?.getApiLevel() >= 28) {383        this.log.info('Restoring hidden api policy to the device default configuration');384        await this.adb?.setDefaultHiddenApiPolicy(!!this.opts.ignoreHiddenApiPolicyError);385      }386    }387    if (this.opts.reboot) {388      let avdName = this.opts.avd.replace('@', '');389      this.log.debug(`closing emulator '${avdName}'`);390      await this.adb?.killEmulator(avdName);391    }392  }393  async setSharedPreferences () {394    let sharedPrefs = this.opts.sharedPreferences;395    this.log.info('Trying to set shared preferences');396    let name = sharedPrefs.name;397    if (_.isUndefined(name)) {398      this.log.warn(`Skipping setting Shared preferences, name is undefined: ${JSON.stringify(sharedPrefs)}`);399      return false;400    }401    let remotePath = `/data/data/${this.opts.appPackage}/shared_prefs`;402    let remoteFile = `${remotePath}/${name}.xml`;403    let localPath = `/tmp/${name}.xml`;404    let builder = this.getPrefsBuilder();405    builder.build(sharedPrefs.prefs);406    this.log.info(`Creating temporary shared preferences: ${localPath}`);407    builder.toFile(localPath);408    this.log.info(`Creating shared_prefs remote folder: ${remotePath}`);409    await this.adb.shell(['mkdir', '-p', remotePath]);410    this.log.info(`Pushing shared_prefs to ${remoteFile}`);411    await this.adb.push(localPath, remoteFile);412    try {413      this.log.info(`Trying to remove shared preferences temporary file`);414      if (await fs.exists(localPath)) {415        await fs.unlink(localPath);416      }417    } catch (e) {418      this.log.warn(`Error trying to remove temporary file ${localPath}`);419    }420    return true;421  }422  getPrefsBuilder () {423    /* Add this method to create a new SharedPrefsBuilder instead of424     * directly creating the object on setSharedPreferences for testing purposes425    */426    return new SharedPrefsBuilder();427  }428  validateDesiredCaps (caps) {429    if (!super.validateDesiredCaps(caps)) {430      return false;431    }432    if ((!caps.browserName || !helpers.isChromeBrowser(caps.browserName)) && !caps.app && !caps.appPackage) {433      this.log.errorAndThrow('The desired capabilities must include either an app, appPackage or browserName');434    }435    return helpers.validateDesiredCaps(caps);436  }437  proxyActive (sessionId) {438    super.proxyActive(sessionId);439    return this.jwpProxyActive;440  }441  getProxyAvoidList (sessionId) {442    super.getProxyAvoidList(sessionId);443    return this.jwpProxyAvoid;444  }445  canProxy (sessionId) {446    super.canProxy(sessionId);447    // this will change depending on ChromeDriver status448    return _.isFunction(this.proxyReqRes);449  }450}451export { AndroidDriver };...

Full Screen

Full Screen

selendroid.js

Source:selendroid.js Github

copy

Full Screen

...229Selendroid.prototype.stop = function (ocb) {230  var completeShutdown = function (cb) {231    if (this.args.unicodeKeyboard && this.args.resetKeyboard && this.defaultIME) {232      logger.debug('Resetting IME to \'' + this.defaultIME + '\'');233      this.adb.setIME(this.defaultIME, function (err) {234        if (err) {235          // simply warn on error here, because we don't want to stop the shutdown236          // process237          logger.warn(err);238        }239        logger.debug("Stopping selendroid server");240        this.deleteSession(cb);241      }.bind(this));242    } else {243      logger.debug("Stopping selendroid server");244      this.deleteSession(cb);245    }246  }.bind(this);247  completeShutdown(function (err) {...

Full Screen

Full Screen

android.js

Source:android.js Github

copy

Full Screen

...427  if (this.adb) {428    this.adb.endAndroidCoverage();429    if (this.args.unicodeKeyboard && this.args.resetKeyboard && this.defaultIME) {430      logger.debug('Resetting IME to \'' + this.defaultIME + '\'');431      this.adb.setIME(this.defaultIME, function (err) {432        if (err) {433          // simply warn on error here, because we don't want to stop the shutdown434          // process435          logger.warn(err);436        }437        if (this.adb) {438          this.adb.stopLogcat(function () {439            next();440          }.bind(this));441        }442      }.bind(this));443    } else {444      this.adb.stopLogcat(function () {445        next();...

Full Screen

Full Screen

ime.js

Source:ime.js Github

copy

Full Screen

...23    throw new errors.IMENotAvailableError();24  }25  log.debug("Found installed IME, attempting to activate");26  await this.adb.enableIME(imeId);27  await this.adb.setIME(imeId);28};29commands.deactivateIMEEngine = async function () {30  let currentEngine = await this.getActiveIMEEngine();31  log.debug(`Attempting to deactivate ${currentEngine}`);32  await this.adb.disableIME(currentEngine);33};34Object.assign(extensions, commands, helpers);35export { commands, helpers };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var should = chai.should();7var expect = chai.expect;8var serverConfig = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var serverConfig = {4};5var desired = {6};7var driver = wd.promiseChainRemote(serverConfig);8  .init(desired)9  .then(function () {10    return driver.setIME("io.appium.android.ime/.UnicodeIME");11  })12  .then(function () {13    return driver.quit();14  })15  .done();16  .init(desired)17  .then(function () {18    return driver.setIME(null);19  })20  .then(function () {21    return driver.quit();22  })23  .done();

Full Screen

Using AI Code Generation

copy

Full Screen

1const path = require('path');2const wdio = require('webdriverio');3const options = {4  desiredCapabilities: {5    app: path.resolve(__dirname, 'app-debug.apk'),6  }7};8const client = wdio.remote(options);9client.init().then(() => {10  return client.adb.setIME('com.android.inputmethod.latin/.LatinIME');11}).then(() => {12  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);13}).then(() => {14  return client.click('android=new UiSelector().text("Hello World!")');15}).then(() => {16  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);17}).then(() => {18  return client.click('android=new UiSelector().text("Hello World!")');19}).then(() => {20  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);21}).then(() => {22  return client.click('android=new UiSelector().text("Hello World!")');23}).then(() => {24  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);25}).then(() => {26  return client.click('android=new UiSelector().text("Hello World!")');27}).then(() => {28  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);29}).then(() => {30  return client.click('android=new UiSelector().text("Hello World!")');31}).then(() => {32  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);33}).then(() => {34  return client.click('android=new UiSelector().text("Hello World!")');35}).then(() => {36  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);37}).then(() => {38  return client.click('android=new UiSelector().text("Hello World!")');39}).then(() => {40  return client.waitForVisible('android=new UiSelector().text("Hello World!")', 10000);41}).then(()

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