Appium appium+pyhton 元素可以定位到,日志显示执行成功,但实际并未执行点击事件,请高手指点

Magicchn · 2018年10月22日 · 最后由 Magicchn 回复于 2018年11月20日 · 2331 次阅读

编写自动化测试脚本时,遇到如下问题:

  • 元素使用 ID 可定位到,而且,查看 appium 监控日志,日志显示已执行了点击操作,但实际上真机并未执行点击时间操作,在网上查询到,说需要开启开发者选项的模拟点击,但我使用的是魅族 MX3 手机,查了几遍,都没有这个选项。还有一个疑惑的是,其他元素控件,都可以正常执行点击事件,就这个控件点击有问题,查看元素定位工具,没有发现什么异常, 哪位知道是什么问题,或者遇到此问题,请给与指点,多谢,多谢。
  • 元素控件
  • appium 日志

[HTTP] --> POST /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element
[HTTP] {"using":"id","value":"com.xxxx.xxxx.mobile:id/btn_scene_time_date","sessionId":"076c110d-370f-4430-886e-0c30c1434ed0"}
[W3C] Calling AppiumDriver.findElement() with args: ["id","com.xxxx.xxxx.mobile:id/btn_scene_time_date","076c110d-370f-4430-886e-0c30c1434ed0"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 15000 ms for condition
[JSONWP Proxy] Matched '/element' to command name 'findElement'
[JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8203/wd/hub/session/8183debe-dd29-43c8-b9b6-e5d4fac997bd/element] with body: {"strategy":"id","selector":"com.xxxx.xxxx.mobile:id/btn_scene_time_date","context":"","multiple":false}
[JSONWP Proxy] Got response with status 200: {"sessionId":"8183debe-dd29-43c8-b9b6-e5d4fac997bd","status":0,"value":{"ELEMENT":"d58b1287-9f98-4d70-8f88-4d7300dec21f"}}
[W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"d58b1287-9f98-4d70-8f88-4d7300dec21f"}
[HTTP] <-- POST /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element 200 34 ms - 88
[HTTP]
[HTTP] --> GET /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/text
[HTTP] {}
[W3C] Driver proxy active, passing request on via HTTP proxy
[JSONWP Proxy] Matched '/wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/text' to command name 'getText'
[JSONWP Proxy] Proxying [GET /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/text] to [GET http://localhost:8203/wd/hub/session/8183debe-dd29-43c8-b9b6-e5d4fac997bd/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/text] with body: {}
[JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"8183debe-dd29-43c8-b9b6-e5d4fac997bd\",\"status\":0,\"value\":\"2018-10-22\"}"
[JSONWP Proxy] Replacing sessionId 8183debe-dd29-43c8-b9b6-e5d4fac997bd with 076c110d-370f-4430-886e-0c30c1434ed0
[HTTP] <-- GET /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/text 200 20 ms - 84
[HTTP]
[HTTP] --> POST /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/click
[HTTP] {"id":"d58b1287-9f98-4d70-8f88-4d7300dec21f","sessionId":"076c110d-370f-4430-886e-0c30c1434ed0"}
[W3C] Calling AppiumDriver.click() with args: ["d58b1287-9f98-4d70-8f88-4d7300dec21f","076c110d-370f-4430-886e-0c30c1434ed0"]
[JSONWP Proxy] Matched '/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/click' to command name 'click'
[JSONWP Proxy] Proxying [POST /element/d58b1287-9f98-4d70-8f88-4d7300dec21f/click] to [POST http://localhost:8203/wd/hub/session/8183debe-dd29-43c8-b9b6-e5d4fac997bd/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/click] with body: {"element":"d58b1287-9f98-4d70-8f88-4d7300dec21f"}
[JSONWP Proxy] Got response with status 200: {"sessionId":"8183debe-dd29-43c8-b9b6-e5d4fac997bd","status":0,"value":true}
[W3C] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element/d58b1287-9f98-4d70-8f88-4d7300dec21f/click 200 45 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/076c110d-370f-4430-886e-0c30c1434ed0/element
[HTTP] {"using":"id","value":"com.xxxx.xxxx.mobile:id/year_pv","sessionId":"076c110d-370f-4430-886e-0c30c1434ed0"}
[W3C] Calling AppiumDriver.findElement() with args: ["id","com.xxxx.xxxx.mobile:id/year_pv","076c110d-370f-4430-886e-0c30c1434ed0"]

共收到 3 条回复 时间 点赞

我也遇到了这个情况,手机开发者设置中也没有网上说的,暂时没办法只能通过 tap 点击做了,期待大神帮忙看一看

王小虎 回复

我也用了 tap,和 click() 一样,日志显示已执行,但实际并未点击

哪位大神指导是什么问题

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