ElementNotInteractableException:消息:在使用 Selenium 和 Python 将文本发送到 Quora 上的电子邮件字段时,元素不可交互错误 [英] ElementNotInteractableException: Message: element not interactable error while sending text to Email field on Quora using Selenium with Python

查看:51
本文介绍了ElementNotInteractableException:消息:在使用 Selenium 和 Python 将文本发送到 Quora 上的电子邮件字段时,元素不可交互错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

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

我认为还有另一个线程有类似的问题.该线程中的解决方案对我不起作用,或者我不知道如何实施这些解决方案.

I think there is another thread with a similar issue. Either the solutions in that thread didn't work for me or I don't know how to implement the solutions.

推荐答案

find_element_by_name("email")

在 DOM 中多次出现.所以那行不通.

is present multiple times in DOM. So that wouldn't work.

你可以试试这个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")

这篇关于ElementNotInteractableException:消息:在使用 Selenium 和 Python 将文本发送到 Quora 上的电子邮件字段时,元素不可交互错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆