Python Selenium返回错误:“消息:元素不可交互”

时间:2019-06-20 00:58:41

标签: selenium-webdriver selenium-chromedriver

我正在尝试使用硒登录网站:care.com。 我可以成功找到login元素,但是当我尝试在其中输入文本时,收到以下错误消息: raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

我的代码如下:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time


LOGINURL = "https://www.care.com/visitor/captureLogin.do"
email = "email@xyz.com"

driver = webdriver.Chrome()
driver.get(LOGINURL)

email_by_name = driver.find_element_by_name('email')
email_by_name.send_keys(email)

我做了一些进一步的研究,发现可能是display none的问题。我尝试包含此命令,但仍然会收到相同的错误消息

driver.execute_script("arguments[0].removeAttribute('style')", email_by_name)

网站页面为:https://www.care.com/visitor/captureLogin.do

The element is as followed

谢谢您的帮助!

0 个答案:

没有答案