Handle the same-city search alert
Easy30 pts~2 min
- Native alerts
- Autocomplete
- Error messages
Practice app · SkyWay
An online travel agency: airport autocomplete, a custom calendar, travellers popover, timed search results with sorting and filters, a fare modal, passenger validation, a seat map, card payment inside an iframe, and a manage-booking page with native confirm and prompt dialogs.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Search for a flight from Bengaluru to Bengaluru, handle the native alert that rejects the search, and verify the error shown on the page afterwards.
Your task
- 1Open TEST_URL.
- 2Type “Bengaluru” into #from-input and click the suggestion #from-option-BLR.
- 3Type “Bengaluru” into #to-input and click the suggestion #to-option-BLR.
- 4Get ready to handle a browser alert, then click Search flights (#search-flights).
- 5Assert the alert text is “Origin and destination cannot be the same” and accept it.
- 6Assert the #search-error alert on the page contains “Origin and destination cannot be the same”.
Acceptance criteria
- The native alert was accepted, so no dialog is left open.
- The page shows the same-city error in #search-error.
- The test asserts the alert message or the page error.
Fixtures
- Airports
- BLR Bengaluru · DEL New Delhi · BOM Mumbai · MAA Chennai · GOI Goa · HYD Hyderabad
- Today
- Tuesday, 10 November 2026 (earlier dates are disabled)
- Test card
- 4111 1111 1111 1111 · expiry 12/29 · CVV 123
- Declined card
- 4000 0000 0000 0002
- Existing booking
- PNR SW7K2Q · last name Verma
- Travellers
- Asha Verma (34, Female) · Rohan Verma (36, Male) · asha.verma@example.com · 9876543210
Selenium WebDriver 4 · Selenium Challenges · SkyWay