【发布时间】:2019-03-13 22:14:46
【问题描述】:
我正在尝试编写代码来自动化 android 应用程序来完成您用手指可以完成的所有操作。
现在的目标是让它选择一张图片。我输入了这一行,所以它通过来自 uiautomatorviewer 的资源 ID 选择元素。
driver.findElement(By.id("com.offerup:id/photo_image_view")).click();
但是当我运行我的代码时,这就是我的 Appium 服务器日志中显示的内容。
`[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.offerup:id/photo_image_view' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.offerup:id/photo_image_view]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.offerup:id/photo_image_view' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.offerup:id/photo_image_view]
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[W3C (3ce51f1a)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
`
我不知道是什么问题,谁能帮帮我?
【问题讨论】:
标签: java android automation appium nosuchelementexception