Python 如何在XPath选择中包含属性
我正在使用selenium浏览页面 以下是页面来源:Python 如何在XPath选择中包含属性,python,selenium,xpath,Python,Selenium,Xpath,我正在使用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';th
<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" />
现在,当我进入最后一页(下面是源代码)时,我得到了相同的xpath(用于下一页链接)---在末尾禁用了属性
。我想在这里停下来
但是,我不确定如何在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>
试试:
<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>
//*[@name="next"][not(@disabled)]