【发布时间】:2014-07-18 13:25:30
【问题描述】:
我正在使用 selenium 浏览页面。
以下是页面来源:
<td colspan="10" align="right">
<input type="button" name="previous" value="Previous" onclick="this.form.action = 'coca-cola-north-america-group-company-37452.htm?previous=true¤tPage=6';this.form.submit();" >
<input type="hidden" name="currentPage" id="currentPage" value="6" />
<input type="button" name="next" value="Next" onclick="this.form.action = 'coca-cola-north-america-group-company-37452.htm?next=true¤tPage=6';this.form.submit();" >
</td>
<td colspan="10" align="right">
<input type="button" name="previous" value="Previous" onclick="this.form.action = 'coca-cola-north-america-group-company-37452.htm?previous=true¤tPage=7';this.form.submit();" >
<input type="hidden" name="currentPage" id="currentPage" value="7" />
我正在使用seleniums click方法点击下一页,
browser.find_element_by_xpath('//*[@name="next"]').click()
现在当我来到最后一页(下面是源代码)时,我得到了相同的 xpath(用于下一页链接)--- 最后带有属性 disabled。我希望 selenium 到此为止。
但是我不确定如何在 xpath 中包含 disabled 属性。
<input type="button" name="next" value="Next" onclick="this.form.action = 'coca-cola-north-america-group-company-37452.htm?next=true¤tPage=7';this.form.submit();" disabled>
</td>
【问题讨论】: