【发布时间】:2017-05-07 22:09:54
【问题描述】:
我尝试使用 appium 自动化混合应用程序。我使用 Ionic 框架开发了我的应用程序。我已经完成了整个设置。然后我尝试在 Mozilla 中查找使用 firebug 进行检查的元素。我发现特定按钮的 xpath 是 //Button[text()='BROWSE MENU']。
但是当我尝试使用 appium 对其进行测试时,它无法找到它,我的测试失败了。
我在测试中尝试过这样的事情
driver.findElement(By.xpath("//button[text()='BROWSE MENU']")).click();
这是我在控制台上遇到的错误
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
我不知道我到底哪里出错了。最初我尝试使用 WEB_VIEW 在 chrome 中进行检查,然后我注意到 ionic 具有使用 ionic serve 直接检查的优势。所以我只是转移到那个地方,然后我又在这里得到了结构。请帮我解决这个问题。
提前致谢。
【问题讨论】:
-
显示目标按钮的
HTML -
感谢您的回复,您的意思是 html 检查器。显示按钮
-
我的意思是提到的元素的确切
HTML代码示例,例如<button>BROWSE MENU</button>... -
我更新了我的代码 Mr.Andersson
-
您能否检查一下您的按钮是否位于
iframe元素内?
标签: android xpath selenium-webdriver appium