【发布时间】:2015-08-18 13:21:11
【问题描述】:
我有一个 html href 链接
<a href="/docs/configuration">App Configuration</a>
使用 Selenium 我需要点击链接。目前,我正在使用以下代码 -
Driver.findElement(By.xpath("//a[text()='App Configuration']")).click();
但它不会重定向到页面。我也试过下面的代码-
Driver.findElement(By.xpath(//a[@href ='/docs/configuration']")).click();
但这会抛出异常 -
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 13 milliseconds
链接可见且页面已完全加载。我不知道我的代码有什么问题。
【问题讨论】:
标签: java selenium xpath css-selectors webdriverwait