Selenium WebDriver 4

Close the delayed newsletter popup

Easy25 pts~2 min
  • Explicit waits
  • Modals
  • Delayed content
Practice app · StyleKart

A fashion store with Men, Women and Kids listings: multi-select filters with removable chips, a custom sort listbox, load-more paging, product pages with colour swatches, sizes, a size-chart modal and a hover gallery, a wishlist, a bag with per-line sizes and a coupons modal, sign-up validation and checkout.

Test URL
/lab/selenium-stylekart-newsletter-close

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

Objective

About two seconds after the home page loads, a newsletter dialog offers ₹100 off. Wait for it without fixed sleeps, close it with the × button and verify the footer records that the popup was dismissed.

Your task

  1. 1Open TEST_URL.
  2. 2Wait for the dialog #newsletter-modal (“Get ₹100 off your first order”) to appear; it opens after a delay.
  3. 3Click its × close button (aria-label “Close newsletter popup”, data-testid="newsletter-modal-close") without subscribing.
  4. 4Assert the dialog is no longer visible and the footer #newsletter-state reads “Newsletter: popup dismissed”.

Acceptance criteria

  • The newsletter dialog is closed.
  • The footer records “popup dismissed”.
  • The test waits for the dialog without fixed sleeps and asserts the outcome.

Fixtures

Coupons
STYLE20 (20% off bags of ₹1,999 or more) · FIRST100 (₹100 off)
Valid mobile
10 digits starting with 6, 7, 8 or 9, e.g. 9123456780
Password rules
8+ characters with an uppercase letter, a number and a special character, e.g. Style@2026
Seeded bag
Floral Wrap Midi Dress (Pink, S) ×1 · Essential Crew Neck T-Shirt (Black, M) ×2 · Square Neck Crop Top (White, S) ×1
Delivery address
Rohan Mehta · 9876543210 · 400001 · Flat 12, Sea View Apartments · Mumbai · Maharashtra

Selenium WebDriver 4 · Selenium Challenges · StyleKart