1

New user to python here, I'm trying some webscraping with Selenium. The code executes correctly however there are a few things that come up in the log, should I be concerned about them and where can I find the solution to these errors?

[12592:15880:0416/191306.015:ERROR:device_event_log_impl.cc(214)] [19:13:06.014] USB: usb_service_win.cc:391 Could not read device interface GUIDs: The system cannot find the file specified. (0x2)
[12592:15880:0416/191306.018:ERROR:device_event_log_impl.cc(214)] [19:13:06.017] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[12592:15880:0416/191306.028:ERROR:device_event_log_impl.cc(214)] [19:13:06.027] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[12592:15880:0416/191306.036:ERROR:device_event_log_impl.cc(214)] [19:13:06.035] Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed.

I'm running windows 10, installed the latest python (3.10.4) and chromedriver (Latest stable release: 100.0.4896.60)

Here's my helloworld code, if it helps:

# import selenium
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys #for interaction so you can search inputs and press buttons
import time

# PATH = "C:\Program Files (x86)\chromedriver.exe"
# driver = webdriver.Chrome(PATH)

PATH=Service('C:\Program Files (x86)\chromedriver.exe')
driver = webdriver.Chrome(service=PATH)

driver.get("https://www.google.com/")

search = driver.find_element_by_name("q") #find an input with this name
search.send_keys("pink sandals")
search.send_keys(Keys.RETURN) #like pressing enter

time.sleep(5)

# driver.close() #close current tab
driver.quit() #close entire browser

P.S. I am using deprecated keywords cause I've only checked out one tutorial so far (published in 2020) so I'm still learning the ropes.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
ArabianMaiden
  • 505
  • 7
  • 24

1 Answers1

1

This error messages...

[12592:15880:0416/191306.015:ERROR:device_event_log_impl.cc(214)] [19:13:06.014] USB: usb_service_win.cc:391 Could not read device interface GUIDs: The system cannot find the file specified. (0x2)
[12592:15880:0416/191306.018:ERROR:device_event_log_impl.cc(214)] [19:13:06.017] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[12592:15880:0416/191306.028:ERROR:device_event_log_impl.cc(214)] [19:13:06.027] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[12592:15880:0416/191306.036:ERROR:device_event_log_impl.cc(214)] [19:13:06.035] Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed.

are triggered as attempts to read properties of USB devices that are currently suspended and you can ignore those warnings if you are not facing any issues connecting to a device with WebUSB.

You can find a relevant detailed discssion 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


Solution

To supress these messages from appearing on the console you can add the following experimental option:

add_experimental_option('excludeSwitches', ['enable-logging'])

as follows:

compatible code block

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
PATH=Service('C:\Program Files (x86)\chromedriver.exe')
driver = webdriver.Chrome(service=PATH, options=options)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352