I am using selenium to move through the pages.
Following is the page source:
<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" />
I am using seleniums click method to click the next page,
browser.find_element_by_xpath('//*[@name="next"]').click()
Now when I come to the last page (below is the source code) I get the same xpath (for next page link)--- with attribute disabled
at the end. And I want selenium to stop here.
However I am not sure how to include the disabled
attribute in the xpath.
<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>
Try:
//*[@name="next"][not(@disabled)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With