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

来源:互联网 发布:免费刷超级会员软件 编辑:程序博客网 时间:2024/05/01 07:35

遇到的问题:每次运行用例,都会被初始化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
原创粉丝点击