← Selenium Automation Testing learning path
Selenium Automation Testing · Module 6 of 10

Frames, windows and alerts

Handle iframes, tabs and browser dialogs.

📖 Key ideas

  1. Switch into iframes: driver.switch_to.frame(...).
  2. Return: driver.switch_to.default_content().
  3. Handle new tabs with window_handles and switch_to.window.
  4. Alerts: driver.switch_to.alert.accept() / dismiss().
  5. 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