Python selenium: DevTools listening on ws://127.0.0.1

前端 未结 4 910
时光说笑
时光说笑 2020-12-03 14:50

Today I got this message on the console when running selenium using the chromedriver. How do I suppress this?

DevTools listening on ws://127.0.0.1:12740/devt         


        
相关标签:
4条回答
  • 2020-12-03 15:14

    It might be due to chromedriver no longer supports chrome version installed on your machine. Update your Chromedriver to more up to date version.

    0 讨论(0)
  • 2020-12-03 15:15

    I had the same issue, did a bit of digging and finally found a working solution. This should remove the DevTools message popping up:

    options = webdriver.ChromeOptions()
    options.add_experimental_option('excludeSwitches', ['enable-logging'])
    driver = webdriver.Chrome(executable_path='<path-to-chrome>', options=options)
    

    As per the solution from this chromium issue.

    0 讨论(0)
  • 2020-12-03 15:23

    Not sure if you are aware but try:

    options.add_argument('--log-level=3')
    

    Mind you I'm using headless, though I believe you could configure this for normal browser. It feels better :). I was amazed at how annoying that notification message was.

    0 讨论(0)
  • 2020-12-03 15:38

    a workaround: :)

    sys.stdout.write("\033[F") #back to previous line
    sys.stdout.write("\033[K") #clear line
    
    0 讨论(0)
提交回复
热议问题