6

My jenkins failure reports for my functional tests are full of lines like this:

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 lines of output for every line of stacktrace that I actually want to see. How do I turn them off?

Things I have 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 reducing any of the output.

aychedee
  • 24,871
  • 8
  • 79
  • 83
  • Does [this solution](http://stackoverflow.com/a/21688906/771848) help? – alecxe May 07 '14 at 15:01
  • 1
    Yup, that works perfectly. Why don't you add it as an answer or link it through or something and I'll award you the bounty. – aychedee May 07 '14 at 16:54

1 Answers1

14

You need to set the logging level on the remote_connection higher than DEBUG:

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

FYI, based on this answer.

barshopen
  • 1,190
  • 2
  • 15
  • 28
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • how do i do that for local?(Not remote_connection) Is it possible? – rodrigorf Mar 06 '18 at 16:58
  • This should work locally: ChromeOptions options = new ChromeOptions(); options.AddArgument("--log-level=3"); driver = webdriver.Chrome(DRIVER_PATH, chrome_options=options) – Chop Labalagun Jul 25 '20 at 00:28