我正在尝试单击此页面上所有可能的课程链接,但它给了我这个错误:
Message: stale element reference: element is not attached to the page document
这是我的代码:
driver = webdriver.Chrome()
driver.get('https://catalog.maryville.edu/preview_program.php?catoid=18&poid=3085&_ga=2.22513656.232086776.1594848572-196623372.1594848572')
driver.implicitly_wait(10)
links = driver.find_elements_by_xpath('//*[@id="table_block_n2_and_content_wrapper"]/table/tbody/tr[2]/td[1]/table/tbody/tr/td/table/tbody/tr[2]/td/div/div/ul/li/span/a')
for link in links:
driver.execute_script("arguments[0].click();", link)
time.sleep(3)
driver.quit()
知道如何解决这个问题吗?