Macaca 证实:Macaca 支持对 IOS 微信小程序 UI 自动化,简单且方便

Baozhida · 2017年02月21日 · 最后由 Baozhida 回复于 2017年02月21日 · 1598 次阅读

IOS 微信小程序

不同于 Android 系统上的微信小程序, 需要特别设置 androidProcess,而且小程序的 webview 页面至少 3 个,点击等操作进入新的 webwiew,很难确定进入了哪个 webview

IOS 系统上的微信小程序的 webview macaca 旗下的 app-inspector 能改完全识别,不需特殊设置,和 app 定位控件的方式一模一样

正确安装 app-inspector 即可查看小程序 webview 的布局,亲测定位和点击有效。

java 简单代码:

Element  el = driver.elementByXPath("//*[@name='发现']");
el.click();
driver.sleep(5000);
el = driver.elementByXPath("//*[@name='小程序']");
el.click();
driver.sleep(5000);
el = driver.elementByXPath("//*[@name='美团生活']");
el.click();
driver.sleep(5000);
el = driver.elementByXPath("//*[@name='爱玩乐']");
el.click();

见图,webview 的控件识别非常清楚:

IOS 微信公共号目前不可以

app 切到在公共号页面,刷新浏览器,微信闪退

app-inspector -u xxx 报错信息

  <-- GET /
The source may be wrong, please report with below message at:
    https://github.com/macacajs/app-inspector/issues/new
    ****** xctest source start *******
    {"value":{"tree":{"bounds":"{{0, 0}, {0, 0}}","rawIdentifier":null,"isVisible":"0","value":null,"label":null,"type":"Any","name":null,"isEnabled":"0"}},"sessionId":null,"status":0}
    '****** xctest source end *******

  TypeError: Cannot read property 'x' of undefined
      at adaptor (/usr/local/lib/node_modules/app-inspector/lib/ios.js:27:9)
      at Object.exports.dumpXMLAndScreenShot (/usr/local/lib/node_modules/app-inspector/lib/ios.js:60:22)
      at next (native)
      at onFulfilled (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:65:19)
      at process._tickCallback (internal/process/next_tick.js:103:7)
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 6 条回复 时间 点赞

@seveniruby 普及普及

@utopia 微信公众号不行吧

真棒

#3 楼 @CodeToSurvive1 IOS 微信公共号不行,见上面的报错

#2 楼 @Lihuazhang 名字而已😂

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册