【发布时间】:2019-10-25 12:46:31
【问题描述】:
我正在尝试单击下面给出的 xpath 提供的按钮。 它显示此错误:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a href="http://gogoanime.io/category/one-piece#disqus_thread">...</a> is not clickable at point (650, 736). Other element would receive the click: <div style="position:fixed;z-index:9999;background:#ffc119;bottom:0;text-align:center;color:#000;width:100%;padding:10px 0;font-weight:600;">...</div>
在 cmd 中。
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Chrome()
url = "https://www5.gogoanime.tv/category/one-piece"
driver.maximize_window()
driver.get(url)
content = driver.page_source.encode('utf-8').strip()
soup = BeautifulSoup(content,'html.parser')
#btn_comment_div = soup.find('div',{'class':'specialButton'})
#btn_comment = btn_comment_div.find('a')
btn_comment = driver.find_element_by_xpath('/html/body/div[2]/div/div/section/section[1]/div[1]/div[7]/div[1]/div/div/a')
btn_comment.click()
【问题讨论】:
-
@Hardik Mehta 您应该提供您想要点击的链接的屏幕截图或名称。
标签: python selenium web-scraping beautifulsoup