我试图在https://www.ecobolsa.com/index.html
中使用python3中的Selenium登录,但是send_keys函数为我提供了消息:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: headless chrome=78.0.3904.97)
守则是:
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)
我尝试过其他的解决办法,但都没有成功。我需要帮助。
发布于 2019-11-12 13:30:22
要在网站https://www.ecobolsa.com/index.html
中使用Selenium登录,您需要:
- 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()
https://stackoverflow.com/questions/58807729
复制相似问题