selenium.common.exceptions.ElementClickInterceptedException error clicking on a toggle button on yahoo finance income statement data

huangapple go评论77阅读模式
英文:

selenium.common.exceptions.ElementClickInterceptedException error clicking on a toggle button on yahoo finance income statement data

问题

我正在尝试从https://finance.yahoo.com/quote/AAPL/financials?p=AAPL网站上抓取损益表数据。

我试图模拟点击"Operating Expense"以展开行,以查看研发费用的数值,就像这样:
selenium.common.exceptions.ElementClickInterceptedException error clicking on a toggle button on yahoo finance income statement data

这是我目前的代码:

def clickOperatingExpense(url):
    options = Options()
    options.add_argument('--headless')
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    driver.get(url)
    # 这是我遇到的一个selenium.common.exceptions.ElementClickInterceptedException错误
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[4]/div[1]/div[1]/div[1]/button'))).click()

仅供参考,完整错误消息如下:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button aria-label="Operating Expense" class="P(0) M(0) Va(m) Bd(0) Fz(s) Mend(2px) tgglBtn">...</button> is not clickable at point (39, 592). Other element would receive the click: <div tabindex="1" class="lightbox-wrapper Ta(c) Pos(f) T(0) Start(0) H(100%) W(100%) Bgc($modalBackground) Ovy(a) Z(50) Op(1)">...</div>

问题似乎是一个

标签会接收点击,但我不确定为什么。如何让
huangapple
  • 本文由 发表于 2023年3月7日 04:32:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75655561.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定