我的应用程序中有一个包含教程覆盖的页面。我想appium只是点击屏幕去除覆盖,然后继续做测试。由于某种原因,我发送的tap命令永远不会发生,测试会超时。我没有明确地等待超过2秒钟来启动水龙头,而我可以告诉水龙头已经发送但是没有发生。
感谢您就此问题提供的任何帮助。我已经尝试与我的开发人员合作,但到目前为止我们还没有找到解决方案。
Appium Logs(这是appium项目运行到覆盖层和多个用户的屏幕的时刻):
[debug] [JSONWP Proxy] Got response with status 200: {"status":0,"id":"446B2970-66EA-4795-846E-250B55EFABC0","value":"","sessionId":"C0E25E26-64C1-4E83-BEB5-5CA7CE029299"}
[JSONWP Proxy] Replacing sessionId C0E25E26-64C1-4E83-BEB5-5CA7CE029299 with 83022946-db67-4a8c-bdbe-4b1f203a2763
[HTTP] <-- POST /wd/hub/session/83022946-db67-4a8c-bdbe-4b1f203a2763/element/446B2970-66EA-4795-846E-250B55EFABC0/click 200 548 ms - 118
[HTTP] --> POST /wd/hub/session/83022946-db67-4a8c-bdbe-4b1f203a2763/touch/perform {"actions":[{"action":"tap","options":{"x":0.5,"y":0.5,"count":1}},{"action":"release"}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"tap","options":{"x":0.5,"y":0.5,"count":1}},{"action":"release"}],"83022946-db67-4a8c-bdbe-4b1f203a2763"]
[debug] [XCUITest] Executing command 'performTouch'
[debug] [XCUITest] Received the following touch action: tap(options={"x":0.5,"y":0.5,"count":1})-release
[debug] [XCUITest] Found matching gesture: tap
[debug] [JSONWP Proxy] Proxying [POST /wda/tap/0] to [POST http://localhost:8100/session/C0E25E26-64C1-4E83-BEB5-5CA7CE029299/wda/tap/0] with body: {"x":0.5,"y":0.5}
[BaseDriver] Shutting down because we waited 60 seconds for a command
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session 7d24454e-3b9f-434c-a43a-d1f301b1802f from our master session list
[XCUITest] Shutting down sub-processes
[debug] [XCUITest] Found WDA derived data folder: '/Users/jessefish/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy'
[XCUITest] Setting '755' permissions to '/Users/jessefish/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/Attachments' folder
[debug] [XCUITest] Found WDA derived data folder: '/Users/jessefish/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs'
[XCUITest] Setting '755' permissions to '/Users/jessefish/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/Attachments' folder
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [iOSLog] Stopping iOS log capture
答案 0 :(得分:0)
不确定是否可能。 iOS提供屏幕上的完整项目列表。因此,如果您有一个可滚动的视图,并说它有1000个项目,那么Appium将获得所有项目,即使一次只有少数项目可以在屏幕上显示。
可以做的一件事是尽量避免使用xpath。然后让adsk为所有控件添加自动化ID。这样,即使您需要使用xpath,也可以缩小列表,因为您可以获得基于自动化ID的非常有针对性的列表。
可以做的另一件事是(只有当你想验证元素是否存在时)获取页面源一次。然后只搜索页面源文本中的值。这将加快执行速度,但仅限于您要检查元素是否存在的位置。