a._1f-eo:last selector for the pagination and I’m not sure how many pages there will be, so I want to click on the next page button to go to the next page until it’s disabled. I think this is how the Agenty works.
The problem is that the next page button has the same class as the previous, or numbered page buttons. So I use the
:last CSS selector. but it doesn’t works.
You should be using the
:nth-last-child(n) selector to paginate in this case.
Because if you see the HTML > The Next button is the last item (
li ) of this list (
ul ) and will always be in last, so we can use the :nth-last-child(1) easily.
This is just opposite of the nth-child(n) selector, and will count the number from the last child traversing towards backward.
So, the correct selector to paginate will be
._25feg :nth-last-child(1) a
Learn more about this css selector here - CSS :nth-last-child() Selector