alibaba / macaca

Automation solution for multi-platform. 多端自动化解决方案
https://macacajs.github.io
MIT License
3.17k stars 419 forks source link

调用MacacaClient的source()方法时,会点击app界面的某个元素 #838

Open quxiaozha opened 6 years ago

quxiaozha commented 6 years ago
macaca-bot commented 6 years ago

This is the translated issue:


When calling the source() method of MacacaClient, it will click on an element of the app interface.

  Node.js checklist:

  Node env: D:\nodejs\node.exe   Node version: v8.9.3

  Android checklist:

  JAVA version is 1.8   JAVA_HOME is set to D:\Program Files\Java\jdk1.8.0_151   ANDROID_HOME is set to E:\cjsc\android-sdk-windows   Platforms is set to E:\cjsc\android-sdk-windows\platforms\android-28   ADB tool is set to E:\cjsc\android-sdk-windows\platform-tools\adb.exe   GRADLE_HOME is set to D:\gradle-4.4

  Installed driver list:

  Android: 2.0.48

When using MacacaClient.source();, a + element on the app will be clicked. After discovery, try sending it with http://127.0.0.1:3456/wd/hub/session/f680c760-9a83-4992-8f81-781a67962e8c/source Request a test, the + element of the interface will be clicked once per request. default

quxiaozha commented 6 years ago

经排查,发现在执行/source之前,先调用了/accept_alert,这里边判断使用的是:List alertButtons = mDevice.findObjects(By.clazz("android.widget.Button").clickable(true).checkable(false));这个加号是符合这个规则,被误点了,这个是我们代码不规范还是这里的规则有问题?

macaca-bot commented 6 years ago

This is the translated issue comment: @quxiaozha


After troubleshooting, it was found that /accept_alert was called before executing /source. Here, the judgment is: List alertButtons = mDevice.findObjects(By.clazz("android.widget.Button").clickable(true) .checkable(false)); This plus sign is consistent with this rule and was delayed. Is this our code is not standardized or is there a problem with the rules here?