首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >selenium.common.exceptions.ElementNotInteractableException:消息:在尝试使用Selenium和Python登录时,元素不可交互的错误

selenium.common.exceptions.ElementNotInteractableException:消息:在尝试使用Selenium和Python登录时,元素不可交互的错误
EN

Stack Overflow用户
提问于 2019-11-11 19:46:11
回答 2查看 1.8K关注 0票数 4

我试图在https://www.ecobolsa.com/index.html中使用python3中的Selenium登录,但是send_keys函数为我提供了消息:

代码语言:javascript
运行
复制
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: headless chrome=78.0.3904.97)

守则是:

代码语言:javascript
运行
复制
from selenium.webdriver.chrome.options import Options
from selenium import webdriver

options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")

email = 'fake@gmail.com'
password = 'fakepass3'

driver = webdriver.Chrome('chromedriver', options=options)

driver.get('https://www.ecobolsa.com/index.html')

driver.find_element_by_id("userNameTextBox").send_keys(email)
driver.find_element_by_id("password_login").send_keys(password)

我尝试过其他的解决办法,但都没有成功。我需要帮助。

EN

Stack Overflow用户

发布于 2019-11-12 13:30:22

要在网站https://www.ecobolsa.com/index.html中使用Selenium登录,您需要:

  • 诱导WebDriverWait:

代码语言:javascript
运行
复制
- Button with text as `ACEPTO` to be clickable.
- Element containing the link to login to be clickable.
- Username field to be clickable.

  • 代码块:

选项= options.add_experimental_option("excludeSwitches",() options.add_argument("window-size=1920x1080") options.add_argument(“--无头”)webdriver.ChromeOptions“启用-自动化”)驱动程序= webdriver.Chrome(options=options,executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe') driver.get("https://www.ecobolsa.com/index.html") WebDriverWait(驱动程序,20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,)( 20).until(EC.invisibility_of_element((By.CSS_SELECTOR,)div.qc-cmp-cmp- ActionChains(driver).move_to_element(WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,“li.login>a”))(.click().perform()WebDriverWait(驱动程序,.click().perform().click().click().perform()WebDriverWait(驱动程序,20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"input#userNameTextBox"))).send_keys("jatorna") driver.find_element_by_css_selector("input#password_login").send_keys("jatorna") driver.save_screenshot('./Screenshots/login.png')打印(“程序完成”) driver.quit()

  • Browser快照:

票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58807729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档