【发布时间】:2014-05-18 04:46:36
【问题描述】:
这是我试图点击链接的 html 代码:
class="MainMenuBody" valign="top">
<a href="https://portal.regify.com/phpCreateRegify.php">Create regimail online</a><br>
这里是代码:
driver.findElement(By.xpath("//a[contains(@href, 'phpCreateRegify.php')]")).click();
我也尝试过使用此driver.findElement(By.linkText("Create regimail online")).click(); 和部分链接文本,甚至尝试过driver.switchTo().defaultContent();,但似乎没有任何效果。几周前它起作用了,但知道它没有。还有其他想法、建议吗?
【问题讨论】:
标签: java html selenium xpath web