Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我能';似乎无法使用Python/Selenium定位输入框元素_Python_Html_Selenium - Fatal编程技术网

我能';似乎无法使用Python/Selenium定位输入框元素

我能';似乎无法使用Python/Selenium定位输入框元素,python,html,selenium,Python,Html,Selenium,我正在尝试使用Python自动化一些东西 我似乎找不到带有驱动程序的电子邮件输入元素。请通过查找\u元素。我尝试了很多不同的方法。我只想能够登录到网站与Chromedriver 电子邮件输入框没有任何属性。没有名称或id。类不是唯一的。密码框具有相同的类 这就是我目前所拥有的。我只想让Python为我登录并定期转到某个页面,但我无法发送_键,因为我找不到元素。它一直在说“找不到元素” 从selenium导入webdriver chrome\u path=r“C:\Users\peter\De

我正在尝试使用Python自动化一些东西

我似乎找不到带有
驱动程序的电子邮件输入元素。请通过
查找\u元素。我尝试了很多不同的方法。我只想能够登录到网站与Chromedriver


电子邮件输入框没有任何属性。没有名称或id。类不是唯一的。密码框具有相同的类

这就是我目前所拥有的。我只想让Python为我登录并定期转到某个页面,但我无法发送_键,因为我找不到元素。它一直在说“找不到元素”

从selenium导入webdriver
chrome\u path=r“C:\Users\peter\Desktop\chromedriver.exe”
driver=webdriver.Chrome(可执行文件\u path=r“C:\Users\peter\Desktop\chromedriver.exe”)
获取驱动程序(“https://”)
通过xpath(//input[@type='email'])查找元素
错误代码:

selenium.common.exceptions.NoSuchElementException:
信息:无此类元素:
找不到元素:{“方法”:“xpath”,“选择器”:“//input[@type='email']”
(会话信息:chrome=78.0.3904.108)

尝试在选择器中使用两个标识符:

driver.通过xpath(//input[@class='css-cgadzw'][@type='email'])查找元素

此外,您可能需要等待一段时间,以便能够看到页面上的元素被引用

如果您尝试
email=driver,该怎么办?通过xpath(“//input[@type='email']”)查找元素
然后使用
email[0]
*另外,与此问题无关,但您可以在此处使用变量,
driver=webdriver.Chrome(executable\u path=Chrome\u path)
,no?email=driver.find\u elements\u by_xpath(“//input[@type='email'])。这很有效,但我无法发送\u密钥。您是否尝试过
email[0].sendKeys()
?检查您的元素是否在
iframe
frame
内嘿,伙计,谢谢您的输入。我试过了。。。但是相同的错误代码是selenium.common.exceptions.NoSuchElementException:Message:没有这样的元素:无法定位元素:{“方法”:“xpath”,“选择器”:“//input[@class='css-cgadzw'][@type='email']”}(会话信息:chrome=78.0.3904.108),我将尝试添加等待和查看。谢谢:)