【问题标题】:Python Selenium Webdriver/Chromedriver (Device attached is not functioning...)Python Selenium Webdriver/Chromedriver(附加的设备无法正常工作......)
【发布时间】:2020-12-31 03:28:23
【问题描述】:

我使用 Selenium 来显示网站。 这是我的代码:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

browser = webdriver.Chrome(executable_path = 'SELE/chromedriver.exe')

browser.get("https://lolprofile.net/")

代码确实运行了,但是网站只出现一秒就出现了这组问题代码:

[15696:7680:1231/111918.721:ERROR:device_event_log_impl.cc(211)] [11:19:18.721] USB: 
usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the 
system is not functioning. (0x1F)

现在我无法继续编码的下一步了。

【问题讨论】:

  • 您好 Jamuxi,我认为您的问题与one 类似

标签: python selenium webdriver selenium-chromedriver


【解决方案1】:

这不是错误,而是警告,不会影响运行。

浏览器关闭是因为python垃圾收集器在代码执行完成后关闭chromedriver

您可以添加 time.sleep() ,或要求某些用户 input("Enter any key to exit:") 阻止代码退出

【讨论】:

    【解决方案2】:

    是的,我添加了以下代码,它会在关闭前等待 3 秒...

        import time 
        << your chrome get code goes here >> 
        time.sleep(3)
    

    我见过一些人绕过这个错误消息,但这并不是微不足道的。

    试试这个...

        from selenium import webdriver
        from selenium.webdriver.chrome.options import Options
        options = webdriver.ChromeOptions()
        options.add_experimental_option('excludeSwitches', ['enable-logging'])
        driver = webdriver.Chrome(options=options)
        driver.get('https://something.com/login')
        driver.maximize_window()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      • 1970-01-01
      • 2020-03-18
      相关资源
      最近更新 更多