I'm using selenium for a scraping script along with a chromedriver service on windows here is how initialised them
# Setting up the options
options = Options()
options.add_argument("--headless=new")
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors=yes')
# Setting up service
service = Service(ChromeDriverManager().install(), log_output='nul')
driver = webdriver.Chrome(service=service,options=options)
# Rest of the code ...
My script is working fine I just want to ignore these annoying errors/warnings that keep showing up in the console anytime I run it,
DevTools listening on ws://127.0.0.1:57253/devtools/browser/10819d8d-19ce-4893-8632-7c841dc8f6f7
[12856:28660:0307/001815.740:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105
ERROR: Time is after notAfter
[12856:28660:0307/001818.072:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105
I'm wondering if there's a way to do that...
I tried adding this argument to the Service constructor but it did not fix it : log_output='nul'
I tried this also but it did not work:
# Suppressing stderr
sys.stderr = open(os.devnull, 'w')
# Setting up the options
options = Options()
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
# Instantiate the WebDriver with suppressed console errors
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service, options=options)
sys.stderr.close()
sys.stderr = sys.__stderr__
# Rest of the code
Try to add this line:
options.add_argument("--log-level=3")
0: verbose
1: info
2: warning
3: error