Selenium WebDriver 4

Read a code from the host profile in a new tab

Medium55 pts~2 min
  • Multiple tabs
  • Window switching
  • Reading text
Practice app · StayNest

A home-sharing marketplace: destination autocomplete, a two-month date-range calendar, a guests popover with steppers, results with a list/map toggle and a filters modal, listing pages with a photo gallery, a reserve card with a price breakdown, host profiles in a new tab, a wishlist that needs sign-in and a message-host form.

Test URL
/lab/selenium-staynest-host-verification-tab

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

Objective

The host profile opens in a new browser tab. Read the host verification code there, return to the listing and use the code to verify the host.

Your task

  1. 1Open TEST_URL and open Casa Azulejo · Alfama Townhouse from Featured stays.
  2. 2Click “View host profile” (#host-profile-link); it opens in a new tab.
  3. 3Switch to the new tab, wait for #host-profile-name (“Marta S.”) and read the code in #host-verification-code.
  4. 4Close the tab and switch back to the listing tab.
  5. 5Type the code into #verify-host-input, click Verify (#verify-host-button) and assert #host-verify-status contains “Host verified”.

Acceptance criteria

  • The verification field holds Marta's code.
  • The listing shows “Host verified” and the verified badge.
  • The browser ends on the Casa Azulejo listing in the original tab.
  • The test makes at least two assertions.

Fixtures

Email
guest@staynest.test
Password
Nest@2026
Account name
Jordan Lee
Today
Tuesday, 10 November 2026 (earlier days are disabled)
Destinations
Goa · Lisbon · Kyoto · Banff · Cape Town
Service fee
14% of the nightly subtotal
Guest limits
Adults 1–16 (adults + children ≤ 16) · infants up to 5 · pets up to 5
Host verification code
Shown only on the host profile tab

Selenium WebDriver 4 · Selenium Challenges · StayNest