我想做的
我正在尝试编写一个Python Selenium代码,它将特定的键发送到特定的框中
我在代码中所写的:
import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from time import sleep
driver = webdriver.Chrome()
driver.get(url="https://netflix.com/login")
sleep(5)
email= driver.find_element(By.ID, ("id_userLoginId"))
sleep(1)
email.send_keys("this is a test")
什么行不通
email.send_keys()
函数不起作用。
完整回溯:
DevTools listening on ws://127.0.0.1:57667/devtools/browser/02d155e8-cdf4-46ce-b2a0-db7cab336de7
[21032:13540:1222/231537.176:ERROR:device_event_log_impl.cc(215)] [23:15:37.176] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
1条答案
按热度按时间6ss1mwsb1#
似乎是Windows+Chrome问题。This question可能会有所帮助。
FWIW,你的例子对我来说使用
driver = webdriver.Firefox()
是有效的。尝试一个不同的驱动程序,或者更好的是,切换到Linux(并从Windows的更多“功能”中保存自己)。