0
0
Selenium Pythontesting~20 mins

Logging setup in Selenium Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Logging Setup Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this Selenium Python logging setup?
Given the following Python code snippet configuring logging for Selenium, what will be printed to the console?
Selenium Python
import logging
from selenium import webdriver

logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(message)s')
logger = logging.getLogger('selenium.webdriver.remote.remote_connection')

logger.info('Starting WebDriver')
driver = webdriver.Firefox()
logger.info('WebDriver started')
driver.quit()
ANo output printed
B
Starting WebDriver
WebDriver started
C
DEBUG:Starting WebDriver
DEBUG:WebDriver started
D
INFO:Starting WebDriver
INFO:WebDriver started
Attempts:
2 left
💡 Hint
Check the logging level and format specified in basicConfig.
Configuration
intermediate
1:30remaining
Which logging configuration disables Selenium's DEBUG logs?
You want to suppress DEBUG logs from Selenium WebDriver but keep INFO and above logs visible. Which logging configuration achieves this?
Alogging.basicConfig(level=logging.WARNING)
Blogging.basicConfig(level=logging.INFO)
Clogging.basicConfig(level=logging.DEBUG)
Dlogging.basicConfig(level=logging.ERROR)
Attempts:
2 left
💡 Hint
DEBUG logs are lower than INFO level.
Troubleshoot
advanced
2:00remaining
Why does this Selenium Python logging code not print any logs?
Consider this code snippet: import logging logger = logging.getLogger('selenium.webdriver.remote.remote_connection') logger.info('Test log message') Why does it not print anything to the console?
ANo logging configuration is set, so default level WARNING hides INFO messages
BThe logger name is incorrect, so messages are discarded
CThe info method is misspelled, causing no output
DThe logger is disabled by default in Selenium
Attempts:
2 left
💡 Hint
Default logging level is WARNING if not configured.
🔀 Workflow
advanced
2:30remaining
What is the correct order to enable file logging for Selenium Python logs?
Arrange these steps in the correct order to log Selenium WebDriver messages to a file named 'selenium.log' with INFO level.
A1,4,2,3
B1,2,4,3
C4,1,2,3
D2,1,4,3
Attempts:
2 left
💡 Hint
You must create the handler before setting formatter and level, then add it to logger.
Best Practice
expert
3:00remaining
Which practice is best for managing Selenium Python logs in a CI/CD pipeline?
In a CI/CD environment, you want to capture Selenium WebDriver logs efficiently without cluttering the console. Which approach is best?
AUse print statements instead of logging for simplicity
BDisable all logging to avoid slowing down tests
CConfigure logging to write to a rotating file handler and only show warnings/errors on console
DPrint all logs to console with DEBUG level for full detail
Attempts:
2 left
💡 Hint
Consider log size and readability in automated environments.