Last active
March 16, 2025 18:48
-
-
Save cgoldberg/267aab305529f5107d1c89fec219ed11 to your computer and use it in GitHub Desktop.
Python - Enable DEBUG logging for Selenium WebDriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
# add one of these logging configurations to your selenium script to enable logging. | |
# 6 logger levels are supported: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET. | |
# (default is WARNING) | |
# enable DEBUG logging to console for all modules globally (selenium, urllib3, etc) | |
logging.basicConfig(level=logging.DEBUG) | |
# enable DEBUG logging to console for selenium module | |
logger = logging.getLogger('selenium') | |
handler = logging.StreamHandler() | |
logger.addHandler(handler) | |
# enable DEBUG logging to file for selenium module | |
logger = logging.getLogger('selenium') | |
handler = logging.FileHandler('/path/to/log') | |
logger.addHandler(handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment