Close a tab and return to the original
Medium70 pts~25 min
- Window handles
- Closing tabs
Practice app · Help Center
Links and buttons that open new tabs and windows.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Open a tab, close it and continue the test in the original window.
Your task
- 1Save the original handle, click #open-tab and switch to the new tab.
- 2Assert #child-heading reads “Release notes”.
- 3Close the tab (driver.close() or #close-child) and switch back to the saved handle.
- 4Click #mark-read and assert #main-status reads “All caught up”.
Acceptance criteria
- The child tab is closed
- The driver switches back to the original handle
- #main-status shows “All caught up”
- At least 2 assertions pass
Selenium WebDriver 4 · Selenium · Frames, windows & tabs