这是我的代码:
from selenium import webdriver
user = "someemail@email.com"
browser = webdriver.Chrome("/path/to/browser/")
browser.get("https://www.quora.com/")
username = browser.find_element_by_name("email")
browser.implicitly_wait(10)
username.send_keys(user)
这是错误消息:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
我认为还有另一个线程有类似的问题。要么该线程中的解决方案对我不起作用,要么我不知道如何实现这些解决方案。
最佳答案
find_element_by_name("email")
在 DOM 中多次出现。所以这是行不通的。
您可以尝试使用此 css 选择器:
input[class*='header_login_text_box'][name='email']
代码:
username = browser.find_element_by_css_selector("input[class*='header_login_text_box'][name='email']")
username.send_keys("user@gmail.com")
关于python - ElementNotInteractableException : Message: element not interactable error while sending text to Email field on Quora using Selenium with Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55945497/