【发布时间】:2014-01-04 20:15:35
【问题描述】:
无法使用 Selenium 单击链接 - Webdriver:Chrome:Win7
以下是我检查按钮时的代码:
a id="continue_button" disabled="false" class="button button-large ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="#" role="button" aria-disabled="false">
span class="ui-button-text"> span class="button-content">继续
我尝试了以下方法,但没有任何效果:
driver.findElement(By.xpath("//*[@id='continue_button']")).click();
driver.findElement(By.xpath("//a[contains(..,'Continue')]")).click();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.querySelector(\"a[id$='continue_button']\").click()");
【问题讨论】:
-
等待按钮先在debug中尝试,然后尝试点击driver.verify().verifyElementPresent(by)