How to reduce the frequency of chrome rib logs when running under selenium?

My jenkins error reports for my functional tests have a lot of such lines:

selenium.webdriver.remote.remote_connection: DEBUG: Finished Request
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:52932/session/60d406aa8e55ac841cf4efb4a43e63be/element {"using": "css selector", "sessionId": "60d406aa8e55ac841cf4efb4a43e63be", "value": "#Login input[name=email]"}

I don't care about them, and there are hundreds of these output lines for every stacktrace line that I really want to see. How to disable them?

Things I've tried so far that don't work:

from selenium import webdriver
driver = webdriver.Chrome(
    service_args=['--silent'], 
    service_log_path='/tmp/throwaway.log')

AND...

from selenium import webdriver
driver = webdriver.Chrome(
    service_args=['2>/dev/null'])

AND...

from selenium import webdriver
driver = webdriver.Chrome(
    service_args=['>', '/dev/null', '2>&1'])

All without decreasing the output signal.

+4
source share
1 answer

You need to install logging levelin the remote_connectionabove DEBUG:

from selenium.webdriver.remote.remote_connection import LOGGER
LOGGER.setLevel(logging.WARNING)

FYI, based on this answer .

+7
source

Source: https://habr.com/ru/post/1538852/


All Articles