When a Selenium test fails, why is it helpful to collect a screenshot at the moment of failure?
Think about how seeing the page helps you find problems.
A screenshot captures the page as it appeared during failure, giving visual clues that logs alone might miss.
Why is it important to collect browser console logs during Selenium test runs?
Think about what information the browser console shows.
Browser console logs reveal JavaScript errors and warnings that can explain why a test failed.
Given the following Selenium Python code that collects a screenshot and saves it, what will be the result?
import os driver.get('https://example.com') driver.save_screenshot('page.png') print(os.path.exists('page.png'))
Consider if the screenshot file is created after saving.
The save_screenshot method saves the image file, so checking its existence returns True.
Which option contains the correct syntax to collect browser logs in Selenium Python?
logs = driver.get_log('browser') for entry in logs: print(entry['message'])
Check method names and indentation carefully.
Option D uses the correct method name and proper Python indentation.
You want to collect screenshots only when a Selenium test step fails to save time. Which approach is best?
Think about capturing evidence only when needed.
Capturing screenshots only on failure saves time and still provides useful debugging info.