I'm trying to click multiple links from a page but it seems that I can only click the first link and then the program crashes at the second link. This is the program that I'm running:
driver = webdriver.Chrome("C://Users//user/chromedriver.exe")
profile_url = "https://www.goodreads.com/list?ref=nav_brws_lists"
driver.get(profile_url)
src = driver.page_source
soup = bs(src, "lxml")
ul_wrapper = soup.find_all("ul", {"class": "listTagsTwoColumn"})
for tag in ul_wrapper:
list = tag.find_all("li")
for li in list:
a = li.find("a")
elem = WebDriverWait(driver, 10).until(EC.element_to_be_clickable(
(By.XPATH, "//a[@href='" + a.get("href") + "']")))
elem.click()
driver.back()
This is the error that I get on the elem.click()
function:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a class="actionLinkLite" href="/list/tag/...">fiction</a> is not clickable at point (704, 677). Other element would receive the click: <div class="modal modal--overlay modal--centered" tabindex="0" data-reactid=".1i6bv62jphg">...</div> (Session info: chrome=108.0.5359.125)
The program works as expected for the first link. It clicks through it and I'm able to get the contents. But it fails for the second loop. I'm expecting to be able to click through all the links. Any suggestions?