Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在XPath选择中包含属性_Python_Selenium_Xpath - Fatal编程技术网

Python 如何在XPath选择中包含属性

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&currentPage=6';th

我正在使用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" />
现在,当我进入最后一页(下面是源代码)时,我得到了相同的xpath(用于下一页链接)---在末尾禁用了属性
。我想在这里停下来

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

                <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>

试试:

                <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>
//*[@name="next"][not(@disabled)]