I'm trying to write a simple Python script using Selenium, and while the loop runs once, I'm getting a StaleElementReferenceException
.
Here's the script I'm running:
from selenium import webdriver
browser = webdriver.Firefox()
type(browser)
browser.get('http://digital2.library.ucla.edu/Search.do?keyWord=&selectedProjects=27&pager.offset=50&viewType=1&maxPageItems=1000')
links = browser.find_elements_by_class_name('searchTitle')
for link in links:
link.click()
print("clicked!")
browser.back()
I did try adding browser.refresh()
to the loop, but it didn't seem to help.
I'm new to this, so please ... don't throw stuff at me, I guess.