← Selenium Automation Testing learning pathSelenium Automation Testing · Module 6 of 10
Frames, windows and alerts
Handle iframes, tabs and browser dialogs.
📖 Key ideas
- Switch into iframes: driver.switch_to.frame(...).
- Return: driver.switch_to.default_content().
- Handle new tabs with window_handles and switch_to.window.
- Alerts: driver.switch_to.alert.accept() / dismiss().
- Take screenshots for evidence: save_screenshot.
💡 Real-life example: Switching context is walking into a different room before touching things there.
iframePage embedded inside a page
window_handlesIDs of open windows/tabs
switch_to.alertAccess a browser alert
ScreenshotImage of current page