Selenium WebDriver 4

Assert content across two windows

Hard120 pts~45 min
  • Multiple windows
  • Cross-window assertions
Practice app · Help Center

Links and buttons that open new tabs and windows.

Test URL
/lab/selenium-assert-content-across-two-windows

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

Objective

Verify state in the main window and in the live chat popup within one test, switching between them.

Your task

  1. 1Assert #window-heading reads “Help Center” and #main-status reads “You have 3 unread messages”.
  2. 2Click #open-window and switch to the “Live chat” window.
  3. 3Assert #child-heading reads “Live chat” and #child-message contains “An agent will join”.
  4. 4Switch back to the main window, click #mark-read and assert #main-status reads “All caught up”.

Acceptance criteria

  • The driver switches to the popup and back
  • #main-status shows “All caught up”
  • At least 4 assertions pass across both windows

Selenium WebDriver 4 · Selenium · Frames, windows & tabs