Java 没有这样的元素例外,但元素显然存在

Java 没有这样的元素例外,但元素显然存在,java,android,automation,appium,nosuchelementexception,Java,Android,Automation,Appium,Nosuchelementexception,我正在尝试编写代码,使一个android应用程序能够自动完成你用手指所能做的一切 现在的目标是让它选择一张图片。我键入了这一行,因此它通过uiautomatorviewer中的资源id选择元素 driver.findElement(By.id(“com.offerup:id/photo\u image\u view”)。单击() 但当我运行代码时,这就是我的Appium服务器日志中显示的内容 `[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding

我正在尝试编写代码,使一个android应用程序能够自动完成你用手指所能做的一切

现在的目标是让它选择一张图片。我键入了这一行,因此它通过uiautomatorviewer中的资源id选择元素

driver.findElement(By.id(“com.offerup:id/photo\u image\u view”)。单击()

但当我运行代码时,这就是我的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.
`


我不确定问题出在哪里,有人能帮我解决吗?

使用以下xpath:

driver.findElement(By.xpath("//*[contains(@id,'photo_image_view')]")).click();

没有成功,我的控制台在想要运行这个命令时停止执行代码,它甚至没有给我一个异常。