简体   繁体   中英

Can't silence audio errors using Chromedriver with selenium in python

I'm running a python script to scrape some webpages and am using selenium + chromedriver. The script is working fine and doing what it's meant to do without crashing, howver chromedriver is logging audio errors that I can't silence.

错误日志

I'm using log-level 3 so that only fatal errors should print, but I'm still getting the above. I also tried the option to disable logging and again I still got the same output as above.

options = webdriver.ChromeOptions() 
options.add_argument('--disable-gpu')
options.add_argument('--start-maximized')
options.add_argument('--log-level=3')
#options.add_argument('--disable-logging')

driver = webdriver.Chrome(chrome_options = options)
driver.get(link)

Any help to get round this would be greatly appreciated!

Just try using the --mute-audio argument this should disable the audio.

like this:

options = webdriver.ChromeOptions() 
options.add_argument('--disable-gpu')
options.add_argument('--start-maximized')
options.add_argument('--log-level=3')
# options.add_argument('--disable-logging')
options.add_argument("--mute-audio")

driver = webdriver.Chrome(chrome_options = options)
driver.get(link)

EDIT:

Try using logging (this is based on this answer ):

import logging
from selenium.webdriver.remote.remote_connection import LOGGER


LOGGER.setLevel(logging.WARNING)
options = webdriver.ChromeOptions()


options.add_argument('--disable-gpu')
options.add_argument('--start-maximized')
options.add_argument('--log-level=3')
# options.add_argument('--disable-logging')
options.add_argument("--mute-audio")

driver = webdriver.Chrome(chrome_options = options)
driver.get(link)

Hope this helps you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM