Appium 修改 appium 源码以修改启动 ui2.0 server 的顺序

bauul · 2017年07月11日 · 最后由 bauul 回复于 2017年07月12日 · 1993 次阅读

修改文件

\node_modules\appium-uiautomator2-driver\lib\driver.js

剪切下面这行代码

// launch UiAutomator2 and wait till its online and we have a session
await this.uiautomator2.startSession(this.caps);

剪切后:

await this.adb.forwardPort(this.opts.systemPort, DEVICE_PORT);

 // launch UiAutomator2 and wait till its online and we have a session
await this.uiautomator2.startSession(this.caps);

目的:让 appium 先启动 uiautomator2.0 server,再执行安装被测应用的动作。

解决安装弹窗问题,部分手机在安装应用时,会有安装界面需要点击确认才可以,
之前已经在 ui2.0 的 server 中加入了弹窗点击的动作

此心法还须配合外功使用:

https://testerhome.com/topics/8512

编译

> cd appium\node_modules\appium-uiautomator2-driver
> gulp transpile
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 4 条回复 时间 点赞
匿名 #7 · 2017年07月12日

"修改下这段代码到上面这句话的后面就可以了。"这个意思是说替换还是追加?没说明白呢?蟹蟹啦~

从原来的位置剪切到新的位置

匿名 #5 · 2017年07月12日
bauul 回复

是删掉原来的那行,然后加上 await this.uiautomator2.startSession(this.caps);这行么?我试试哈~O(∩_∩) O 谢谢~

我更新了下,另外要配合 ui2.0server 端的修改才可以自动点击弹窗

bauul app 弹窗有没有通用的解决方法啊 中提及了此贴 09月20日 10:07
bauul Appium 中没有 UiWatcher,有可以代替的么? 中提及了此贴 10月10日 22:24
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册