selenium.common.exceptions.ElementClickInterceptedException:消息:截获元素单击:

问题描述 投票:0回答:1

selenium.common.exceptions.ElementClickInterceptedException:消息:元素单击被拦截:元素...在点(79,202)不可单击。其他元素将获得点击:...(会话信息:chrome = 77.0.3865.120)

def gotoRelatorios(self):
    sleep(5)
    # self.waitLong.until(EC.visibility_of((By.XPATH, '//*[@class="m-n font-thin h3 text-black ng-binding"]')))
    self.waitLong.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="aside"]//*[@class="auto ng-scope" and @href]//*[contains(text(), "Relatórios")]'))).click()
    print("click 'Relatórios'")
python selenium selenium-webdriver pycharm self
1个回答
0
投票

chromedriver中存在一个错误(问题是它被标记为无法修复)-> GitHub Link

在第27条评论中提出了一种解决方法。它可能对您有用。

第一个解决方案-使用javascript执行程序

driver.execute_script("arguments[0].click()", element)

第二种解决方案-另一种方法是使用类似这样的操作

driver.ActionChains(driver).move_to_element(el).click(el).perform()
© www.soinside.com 2019 - 2024. All rights reserved.