python - python selenium:元素点击被拦截:元素在点不可点击
问题描述
我正在尝试使用 textFile 中的 brutForce 密码,一切似乎都正常,但仍然存在问题:
def tryToLogin(self):
self.driver.get('{}/accounts/login/'.format(self.base_url))
time.sleep(2)
self.driver.find_element_by_xpath("//button[contains(text(),'Accept')]").click()
self.driver.find_element_by_name('username').send_keys(self.username)
for line in self.pswFile:
line = line.strip('\n')
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.NAME, 'password'))).click()
self.driver.execute_script('arguments[0].value = "";', self.driver.find_element_by_name('password'))
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.NAME, 'password'))).send_keys(line)
#Login button:
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="loginForm"]/div'
'/div[3]/button'))).click()
time.sleep(2)
我收到此错误:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="sqdOP L3NKy y3zKF " type="submit" disabled="">...<
/button> is not clickable at point (509, 265). Other element would receive the click: <div class=" Igw0E IwRSH eGOV_ _4EzTm bkEs3
CovQj jKUp7 DhRcB ">...</div>
(Session info: chrome=87.0.4280.141)
为什么会这样?
解决方案
推荐阅读
- firebase - 如何解决 Firestore 集合快照的问题
- php - 如何在laravel中以分层顺序显示这个一对多的关系数据?
- javascript - 本地主机上的 GoogleAuth.disconnect() 无法正常工作
- java - 为什么 Spring Boot 项目中某些依赖项不需要指定版本?
- reactjs - 不能在反应渲染方法中使用 if/else
- kubernetes - 使用 `kubectl explain` 命令
- xcode - 无法打开文档 project.xcworkspace
- wordpress - 联系表格 7 间距问题
- php - 来自表单输入的数组 - 选择语句 MySQLi 参数化
- visual-studio-code - VSCode:2019 年 10 月发行说明中的绿色状态栏终端图标是什么?