如何在XPath选择中包含属性

Md.*_*sin 6 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&currentPage=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&currentPage=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&currentPage=7';this.form.submit();" > 
                <input type="hidden" name="currentPage" id="currentPage" value="7" />
Run Code Online (Sandbox Code Playgroud)

我正在使用seleniums click方法点击下一页,

browser.find_element_by_xpath('//*[@name="next"]').click()                  
Run Code Online (Sandbox Code Playgroud)

现在,当我来到最后一页(下面是源代码)时,我得到了相同的xpath(用于下一页链接)---最后有属性disabled.我想让硒停在这里.

但是我不确定如何disabled在xpath中包含该属性.

                <input type="button" name="next" value="Next" onclick="this.form.action = 'coca-cola-north-america-group-company-37452.htm?next=true&currentPage=7';this.form.submit();" disabled>
            </td>
Run Code Online (Sandbox Code Playgroud)

Eer*_*ius 15

尝试:

//*[@name="next"][not(@disabled)]
Run Code Online (Sandbox Code Playgroud)