(已解)不初始化APP,进行运行

遇到的问题:每次运行用例,都会被初始化APP,导致进入APP会显示有引导,但又不知道怎么对引导进行定位

解决方案:不初始化APP,提前手动将引导弄掉

实践:

简单改造 appium ,实现 Android 平台不启动应用直接执行用例

转载自 https://testerhome.com/topics/3371
首先,上面提到的配置 android 平台的 session 的主要过程都在这个函数中:\appium\Appium\node_modules\appium\lib\devices\android\android.js
修改后的内容(注释部分代码):
Android.prototype.start = function (cb, onDie) {
  this.launchCb = cb;
  this.uiautomatorExitCb = onDie;
  logger.info("Starting android appium");
  async.series([
    this.initJavaVersion.bind(this),
    this.initAdb.bind(this),
    //this.packageAndLaunchActivityFromManifest.bind(this),
    this.initUiautomator.bind(this),
    this.prepareDevice.bind(this),
    this.checkApiLevel.bind(this),
    //this.pushStrings.bind(this),
    //this.processFromManifest.bind(this),
    //this.uninstallApp.bind(this),
    //this.installAppForTest.bind(this),
    this.forwardPort.bind(this),
    this.pushAppium.bind(this),
    this.initUnicode.bind(this),
    this.pushSettingsApp.bind(this),
    this.pushUnlock.bind(this),
    function (cb) {this.uiautomator.start(cb);}.bind(this),
    this.wakeUp.bind(this),
    this.unlock.bind(this),
    this.getDataDir.bind(this),
    this.setupCompressedLayoutHierarchy.bind(this),
    //this.startAppUnderTest.bind(this),
    //this.initAutoWebview.bind(this),
    this.setActualCapabilities.bind(this)
  ], function (err) {
    if (err) {
      this.shutdown(function () {
        this.launchCb(err);
      }.bind(this));
    } else {
      this.didLaunch = true;
      this.launchCb(null, this.proxySessionId);
    }
  }.bind(this));
};
此举有个不好的地方,得手动将APP的页面弄成python定位的第1个元素的页面,他不会自己打开APP
还有转载链接:http://chjvps.com/blog/?p=848



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值