I am trying to scrape Federal reserve's press releases on https://www.federalreserve.gov/newsevents/pressreleases.htm
, and to scrape documents from previous years, I need to move onto the next page by clicking on Next button at the bottom of the page.
I have tried a few things, but all of them return a Message: no such element: Unable to locate element:
error, and I can't figure out the issue:
#Attempt 1
driver.find_element_by_css_selector('.pagination-next ng-scope').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".pagination-next ng-scope"))).click()
#Attempt 2
driver.find_element_by_xpath("//*[@id='article']/ul[2]/li[7]/a").click()
#Attempt 3
element=WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH ,"//*[@id='article']/ul[2]/li[7]/a")))
element.click()
Could anyone help me with where I am going wrong? For ease, the HTML for the Next button is:
<li ng-if="::directionLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-next ng-scope"><a href="" ng-click="selectPage(page + 1, $event)" ng-disabled="noNext()||ngDisabled" uib-tabindex-toggle="" class="ng-binding">Next</a></li>
<a href="" ng-click="selectPage(page + 1, $event)" ng-disabled="noNext()||ngDisabled" uib-tabindex-toggle="" class="ng-binding">Next</a>
Thanks