Python Selenium - How to loop to the last <li> element in a site
问题 I have created a python selenium script that should navigate through a website and collect people profiles (https://www.shearman.com/people). The program won't loop through the pages to collect the links. I have used this which doesn't work; try: # this is navigate to next page driver.find_element_by_xpath('//div[@id="searchResultsSection"]/ul/li[12]').click() time.sleep(1) except NoSuchElementException: break The syntax behind the next button can be seen below; <a href="" onclick=