Analogous to this question Selenium - How to know if next page doesn't exist?, I would like to achieve a similar thing on a different website (http://digesto.asamblea.gob.ni/consultas/coleccion/) with python3 and selenium.
I would like to have my script check whether the "next page" arrow is clickable or not.
This is what I have tried so far (simplified):
try:
driver.find_element_by_css_selector('li a[data_page*=next] and not a[onclick*="return false"]').click() # check if another page exists
print("There is another page.")
except NoSuchElementException:
print("No further page exist.")
On the above mentioned website, the source code for an inactive arrow looks like this:
while active it looks like:
However, it seems that I did not get the css selector path correct. The script tells me that there is not second page, although it exist.