Real World Example

Cross-browser Smoke Check

A banking client of an IT services company needs the net banking home page checked on Chrome, Firefox and Edge after every deployment. This script loops through the browsers:

public class CrossBrowserSmoke {
    public static void main(String[] args) {
        for (String browser : List.of("chrome", "firefox", "edge")) {
            WebDriver driver = createDriver(browser);
            try {
                driver.manage().window().setSize(new Dimension(1366, 768));
                driver.get("https://shopease.example.com");
                boolean ok = driver.getTitle().contains("ShopEase");
                System.out.printf("%-8s %s  %s%n", browser, ok ? "PASS" : "FAIL", driver.getCurrentUrl());
            } finally {
                driver.quit();
            }
        }
    }
}

Example

Output:

Run CrossBrowserSmoke.main()

Example output

chrome   PASS  https://shopease.example.com/
firefox  PASS  https://shopease.example.com/
edge     PASS  https://shopease.example.com/

What Comes Next

Opening pages is only the start. Real tests must find elements (a text box, a button) and interact with them. That is what locators are for, in the next module.