我尝试了各种方法来点击名为"添加"的按钮。在登录后的主页。我无法找到方法。请帮忙。
示例代码:
WebDriverWait wait = new WebDriverWait(driver, 15);// 1 minute
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addArraysButton")));
driver.findElement(By.id("addArraysButton")).click();
HTML文件:
<tr>
<td >
<img src="" alt="Storage Arrays" title="Storage Arrays" />
</td>
<td class="desc-col">
<div class="titlepagelitesmb">Storage Arrays</div>
<div>
NAS and SAN arrays from many manufacturers including NetApp,
EMC, Dell, IBM, Sun, and HP
</div>
</td>
<td class="added-col">
<img src="/images/check.none.gif" style="vertical-align: middle;"
alt="None added" title="None added" />
None added
</td>
<td class="button-col">
<a id="addArraysButton" class="buttonRight" style="float: inherit;">
<span>Add</span>
</a>
</td>
</tr>
答案 0 :(得分:0)
我已经解决了这个问题。我有这样的例外,因为我没有切换到具有那些按钮的框架。切换到特定帧后。我可以通过id找到元素。