Skip to main content

Travel Portal Automation Practice (PlanMyTrip)

A hands-on guide to testing a travel booking application with Selenium and Playwright · TesterRank team

PlanMyTrip is a flight and hotel booking site with search, results, booking forms, an itinerary planner and a bookings history. It is full of date pickers, autocomplete city fields and dynamic search results — some of the hardest elements to automate reliably.

Travel booking is a popular interview scenario ("automate a flight search") because it tests your handling of autocomplete, calendars, dynamic lists and waits all at once.

Demo login

URL/travel/login
Emailarjun@planmytrip.com
PasswordTravel@123
Key locators[data-testid='email-input'], [data-testid='password-input'], [data-testid='login-btn'], [data-testid='login-error']

All data is fictional and stored only in your browser. Clear site storage to reset the app.

What makes this app challenging to automate

Autocomplete city fields

Type part of a city name, wait for suggestions, then click the correct one — not just the first.

Date pickers

Return date must be after departure. Practice selecting dates months ahead.

Dynamic search results

Results load after search. Use explicit waits for the results list, then assert price sorting and filters.

Passenger counts

Adult/child counters change the total price. Verify the maths.

Pages and what to practise on each

PagePractise
FlightsFrom/To autocomplete, dates, passenger counters, results list.
Flight bookingPassenger detail forms and fare summary.
HotelsCity search, filters, sort by price/rating.
Hotel bookingRoom selection, nights × price calculation.
ItineraryAdd/remove plan items, ordering.
BookingsVerify new bookings appear; cancel flow.

Starter code: login test

Both examples use the app's stable data-testid attributes, which is the locator strategy most teams prefer over long XPaths. Copy one into your project, run it, then extend it to the pages above.

Selenium 4 + Java + TestNG
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.*;
import org.testng.Assert;
import org.testng.annotations.*;
import java.time.Duration;

public class PlanMyTripLoginTest {
    WebDriver driver;
    WebDriverWait wait;

    @BeforeMethod
    public void setUp() {
        driver = new ChromeDriver();
        wait = new WebDriverWait(driver, Duration.ofSeconds(10));
        driver.get("https://www.testerrank.com/travel/login");
    }

    @Test
    public void validLoginOpensApp() {
        driver.findElement(By.cssSelector("[data-testid='email-input']"))
              .sendKeys("arjun@planmytrip.com");
        driver.findElement(By.cssSelector("[data-testid='password-input']"))
              .sendKeys("Travel@123");
        driver.findElement(By.cssSelector("[data-testid='login-btn']")).click();

        // Explicit wait: the URL leaves the login page after success
        wait.until(ExpectedConditions.not(
            ExpectedConditions.urlContains("/login")));
        Assert.assertFalse(driver.getCurrentUrl().contains("/login"));
    }

    @AfterMethod
    public void tearDown() { driver.quit(); }
}
Playwright + TypeScript
import { test, expect } from '@playwright/test';

test.describe('PlanMyTrip login', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('https://www.testerrank.com/travel/login');
  });

  test('valid credentials open the app', async ({ page }) => {
    await page.getByTestId('email-input').fill('arjun@planmytrip.com');
    await page.getByTestId('password-input').fill('Travel@123');
    await page.getByTestId('login-btn').click();
    await expect(page).not.toHaveURL(/login/);
  });

  test('wrong password shows an error', async ({ page }) => {
    await page.getByTestId('email-input').fill('arjun@planmytrip.com');
    await page.getByTestId('password-input').fill('Wrong@999');
    await page.getByTestId('login-btn').click();
  await expect(page.getByTestId('login-error')).toBeVisible();
  });
});

Guided exercises

  1. Search Round-Trip Flights and Filter Non-Stop (intermediate)
    Verify flight search engine with date pickers and stops filter.
  2. Hotel Room Booking with Date Range Picker (beginner)
    Automate hotel discovery with check-in/check-out calendar and room count.
  3. Passenger Details & Seat Selection Map (intermediate)
    Automate passenger information input and interactive seat map selection.
  4. Flight Sorting by Price and Duration (intermediate)
    Verify sorting algorithm on flight search results list.
  5. Trip Itinerary Generation & Booking Cancellation (advanced)
    Automate managing existing bookings and calculating cancellation refund amount.
See step-by-step instructions and expected results →

Edge cases worth testing

Test case writing practice

Before automating, write manual test cases. This portal has 20 reference scenarios across Flight Search & Booking, Hotel Room Booking & Amenities, Ticket Cancellation & Refund Calculation, Promo Codes & Travel Insurance Add-on. Try the test case challenge.

Interview questions from this app

How do you handle autocomplete dropdowns?

Type the text, wait for the suggestion list to be visible, find the option whose text matches exactly, and click it. Then assert the input value.

Implicit vs explicit wait — which here?

Explicit waits (WebDriverWait / Playwright auto-wait) on specific conditions like visibility of results. Mixing implicit and explicit waits causes unpredictable timeouts.

Keep learning