macaca icon indicating copy to clipboard operation
macaca copied to clipboard

iOS-xpath获取不稳定

Open ztwo opened this issue 9 years ago • 4 comments

  • Macaca Version: 2.0.4

  • Macaca Doctor Logs: Node.js checklist:

    node env: /usr/local/bin/node node version: v6.10.2

    iOS checklist:

    Xcode Command Line Tools is ready, version: 2347. xcodebuild version: 8.3.2 iproxy[usbmuxd] is installed at: /usr/local/bin/iproxy ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy carthage is installed, version: 0.23.0

    Android checklist:

    JAVA version is 1.8.0_121 JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home ANDROID_HOME is set to /Users/joko/Library/Android/sdk Platforms is set to /Users/joko/Library/Android/sdk/platforms/android-25 ADB tool is set to /Users/joko/Library/Android/sdk/platform-tools/adb gradle is installed, version: 3.5

    Installed driver list:

    android: 2.0.22 ios: 2.0.15

  • Operate System: macos :10.12.4 iOS虚拟机:iphone6s 10.3

  • Programming Language:python

  • 步骤:iOS-使用xpath定位

  • 问题描述:经常性出现定位失败情况。如果单步执行,无异常,可获取,当集中运行既会报错

  • 分析:每步执行后,均调用次driver.source,可缓解报错情况,但依然经常发生

  • 注:每步执行后,加入了非常长的sleep,通过肉眼观察,页面已经加载完毕,且封装的代码中有失败重试,会重试20次,共20秒。可排除页面未加载完成导致的控件未获取

xpath

//XCUIElementTypeScrollView[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeOther[2]/XCUIElementTypeButton[3]

//XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeOther[1]/XCUIElementTypeButton[1]

//XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[1]

ztwo avatar Jun 13 '17 10:06 ztwo

更新一下版本试一下, 目前版本在18

SamuelZhaoY avatar Jun 18 '17 13:06 SamuelZhaoY

@SamuelZhaoY 升级18,4,5天了。依然有问题,问题依然一样:单步调试没问题,一组合起来就找不到控件

responseHandler.js:11:12 [master] pid:50469 Recieve HTTP Request from Client[2017-06-21 17:04:27]: method: POST url: /wd/hub/session/610fabc9-e08e-403f-8be4-0a69654444aa/element, jsonBody: {"using":"xpath","value":"//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[3]/XCUIElementTypeScrollView[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[1]/XCUIElementTypeStaticText[3]"} proxy.js:55:14 [master] pid:50469 Proxy: /wd/hub/session/610fabc9-e08e-403f-8be4-0a69654444aa/element:POST to http://localhost:8001/wd/hub/session/D66EBF61-7F6F-4C0B-8902-A303C4A50AA7/element:POST with body: {"using":"xpath","value":"//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOth... proxy.js:83:20 [master] pid:50469 Got response with status 200: {"sessionId":"","status":7,"value":""}

ztwo avatar Jun 21 '17 09:06 ztwo

问题还在 版本 ios: 2.0.22

xray2008 avatar Jul 27 '17 06:07 xray2008

升级至 macaca-ios 2.0.29, xcode 9.0+ , iOS 模拟器 11.

SamuelZhaoY avatar Nov 13 '17 05:11 SamuelZhaoY