selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element

w8f9ii69  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(161)

我想通过点击一个带有span标签的链接进入下一页,使用 selenium Python,但堆栈的地方。请善意地需要您的帮助。

主件代号

driver.get('https://shoobs.com/find-events')
selector= '//*[@class="pagination"]/span[7]/a'
links = WebDriverWait(driver, timeout=160).until(lambda d: d.find_element(By.XPATH,selector))
links.click()

driver.quit()

错误

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a rel="next" href="/events?page=2">...</a> is not clickable at point (865, 924). Other element would receive the click: <div class="cookie-banner">...</div>
  (Session info: chrome=105.0.5195.102)

一旦浏览器打开,如果我向下滚动它的工作正常,并路由到下一页,但如果我不向下滚动,并把它给上面提到的错误。

yhived7q

yhived7q1#

上面提到的错误指示您必须执行JavaScript

driver.get('https://shoobs.com/find-events')
selector= '//*[@class="pagination"]/span[7]/a'
links = WebDriverWait(driver, timeout=160).until(lambda d: d.find_element(By.XPATH,selector))
driver.execute_script("arguments[0].click();", links)

相关问题