Appium:在Android混合应用程序中无法使用Xpath定位元素?

Suk*_* MS 5 xpath android selenium-webdriver appium

我尝试使用appium.i使用Ionic Framework开发我的应用程序来自动化混合应用程序.我已经完成了整个设置准备就绪.然后我试图在Mozilla.i中找到使用firebug检查的元素,发现特定按钮的xpath //Button[text()='BROWSE MENU'].

但是当我尝试使用appium进行测试时,它无法找到它,我的测试失败了.

我在测试中试过这样的东西

driver.findElement(By.xpath("//button[text()='BROWSE MENU']")).click();
Run Code Online (Sandbox Code Playgroud)

这是我在控制台上遇到的错误

FAILED: Loginforsample
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5.13 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Run Code Online (Sandbox Code Playgroud)

这是检查员在此输入图像描述

我不知道到底哪里出错了.最初我尝试用WEB_VIEW检查铬,然后我注意到离子具有使用离子服务直接检查的优势.所以我只是转移到那里,我又在这里得到了结构.请帮我们这个问题给我.

提前致谢.

Emn*_*mna 2

我曾经遇到过这个问题,所以我使用cssSelector它是测试混合应用程序的好方法!