问题
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time
import pyautogui
import requests
import nltk
import urllib.request
import random
driver=webdriver.Chrome()
driver.get('https://www.karsanj.net/login.php')
userm=driver.find_element_by_id('username')
userm.send_keys('gdbcfss')
time.sleep(2)
passwoord=driver.find_element_by_id('password')
passwoord.send_keys('fbxeedf')
time.sleep(2)
sal =driver.find_element_by_id("salTahsili")
sal.click()
time.sleep(2)
pyautogui.press('down')
time.sleep(2)
pyautogui.press('enter')
time.sleep(2)
login=driver.find_element_by_name('login')
login.click()
time.sleep(10)
driver.get('https://www.karsanj.net/vschool_list.php')
def goonline():
urlsite=driver.current_url()
def urlgetter(driver):
time.sleep(7)
try:
onlineclass=driver.find_element_by_class_name('entrance-btn')
onlineclass.click()
except:
print('no online classes in this time ')
time.sleep(5)
classon=driver.find_element_by_id('room_unique_url')
classon.click()
time.sleep(20)
attend= driver.find_elements_by_class_name('tablet-beta-label')
pyautogui.press('enter')
time.sleep(15)
try:
pyautogui.click()
close1=driver.find_elements_by_id('recording-locked-notifier_0')
close1.click()
close2=driver.find_elements_by_class_name('spectrum-Button spectrum-Button--secondary')
close2.click()
except:
pass
urlgetter(driver)
When i run it give me this error at the end
DevTools listening on ws://127.0.0.1:60683/devtools/browser/9b15c32e-ddc1-4ddd-9abe-bcf597ad4821
[4888:9376:1120/223739.924:ERROR:device_event_log_impl.cc(211)] [22:37:39.924] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
回答1:
This error message...
DevTools listening on ws://127.0.0.1:60683/devtools/browser/9b15c32e-ddc1-4ddd-9abe-bcf597ad4821
[4888:9376:1120/223739.924:ERROR:device_event_log_impl.cc(211)]
[22:37:39.924] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
...implies that the ChromeDriver raised an error while in trying to initiate/spawn a new Browsing Context i.e. google-chrome session.
Analysis
This error surfaces on windows-10 systems due to an error in callback of an attached USB device which isn't functioning properly.
This error is defined within usb_device_handle_win.cc as follows:
void UsbDeviceHandleWin::GotDescriptorFromNodeConnection(
TransferCallback callback,
scoped_refptr<base::RefCountedBytes> request_buffer,
scoped_refptr<base::RefCountedBytes> original_buffer,
Request* request_ptr,
DWORD win32_result,
size_t bytes_transferred) {
std::unique_ptr<Request> request = UnlinkRequest(request_ptr);
if (win32_result != ERROR_SUCCESS) {
SetLastError(win32_result);
USB_PLOG(ERROR) << "Failed to read descriptor from node connection";
std::move(callback).Run(UsbTransferStatus::TRANSFER_ERROR, nullptr, 0);
return;
}
Solution
This error isn't harmful and doesn't blocks the spawning of the new Browsing Context i.e. the Chrome Browser session. So you can safely ignore the error.
References
You can find a couple of relevant detailed discussions in:
- USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
来源:https://stackoverflow.com/questions/64940553/failed-to-read-descriptor-from-node-connection-a-device-attached-to-the-system