Search code examples
pythonseleniumtestingnose

Nose skip debug messages


I starts nosetests with selenium as

python my_test.py  --tests=my_test --with-xunit  --xunit-file=my_output.xml

and I get a lot of useless output like:

selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:42919/session/23784289y34ui2hi2u3hi2u/elements {"using": "xpath", "sessionId": "23784289y34ui2hi2u3hi2u", "value": "//span[@class='somename']"}
selenium.webdriver.remote.remote_connection: DEBUG: Finished Request
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:22919/session/2i3ur2oirhi2u3hri2uhri/element/0.37232323248244116-1/click {"sessionId": "2i3ur2oirhi2u3hri2uhri", "id": "0.37232323248244116-1"}

How can I skip all these debug messages and gets only messages about errors? I did tried with --logging-level=Error or Default but it does not works


Solution

  • The problem was in the selenium. I added a couple lines of code and this fixed the problem.

    import logging
    from selenium.webdriver.remote.remote_connection import LOGGER
    LOGGER.setLevel(logging.WARNING) # this line should be before webdriver initialization