Selenium WebDriver 4

Close a tab vs quit the driver

Easy30 pts~12 min
  • close vs quit
  • Window handles
Practice app · Help Center

Links and buttons that open new tabs and windows.

Test URL
/lab/qa-automation-close-a-tab-vs-quit-the-driver

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Close only a secondary tab with close(), keep the session alive, and leave quit() for teardown.

Your task

  1. 1Open TEST_URL and store the original window handle.
  2. 2Click #open-tab, switch to the new tab and assert #child-heading is “Release notes”.
  3. 3Call close() on that tab, then switch back to the original handle.
  4. 4Click #mark-read and assert #main-status shows “All caught up” — proof the session survived.

Acceptance criteria

  • The test closes the tab with close()
  • #main-status shows “All caught up” in the main window
  • At least 2 assertions pass

Selenium WebDriver 4 · QA Automation · Setup & first script