Screenshots¶
Learn how to use screenshots for debugging and monitoring.
Automatic Screenshots¶
Screenshots are automatically captured on:
- Page load events - When a page finishes loading
- Scroll events - When the page is scrolled
Manual Screenshots¶
Use capture_screenshot(description) to capture at specific moments:
# Before an action
await capture_screenshot("Before login")
await login_button.click()
# After an action
await capture_screenshot("After login")
# In error handling
try:
await risky_operation()
except Exception as e:
await capture_screenshot("Error state")
debug_log(f"Error: {e}")
Viewing Screenshots¶
Screenshots appear in the execution history:
- Go to History in the navigation
- Click on an execution
- View screenshots with timestamps and descriptions
Best Practices¶
Document Workflow¶
await capture_screenshot("Step 1: Login page")
await login()
await capture_screenshot("Step 2: Dashboard")
await navigate_to_data()
await capture_screenshot("Step 3: Data page")
Debug Issues¶
await capture_screenshot("Before clicking problematic button")
await button.click()
await capture_screenshot("After click - did it work?")
Verify State¶
# After form fill
await fill_form()
await capture_screenshot("Form filled - verify data")
# Before submission
await capture_screenshot("Before submit")
await submit()