Switch to v2 to see which selectors break.
Add to Chrome

Selenium practice website

Every element on one page, each built well and built to break, with Selenium WebDriver code for each group. Switch to v2 and see which locators survive.

Starter test in Java and Python (Selenium WebDriver)

Java

WebDriver driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
try {
  driver.get("https://corlabs.dev/practice/shop/sign-in");
  driver.findElement(By.id("email")).sendKeys("[email protected]");
  driver.findElement(By.id("password")).sendKeys("practice123");
  driver.findElement(By.cssSelector("[data-testid='sign-in']")).click();
  wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("h1"), "Order history"));

  driver.findElement(By.cssSelector("[data-testid='shop-search']")).sendKeys("Pocket");
  wait.until(ExpectedConditions.elementToBeClickable(
      By.xpath("//li[@role='option'][normalize-space()='Pocket Speaker']"))).click();
  wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-testid='add-to-cart']"))).click();
  driver.findElement(By.cssSelector("[data-testid='cart-link']")).click();
  wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-testid='checkout']"))).click();

  wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("address"))).sendKeys("1 Main St");
  driver.findElement(By.cssSelector("input[placeholder='City']")).sendKeys("Springfield");
  driver.findElement(By.cssSelector("input[placeholder='Postcode']")).sendKeys("12345");

  wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe[title='Card details']")));
  wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-testid='card-number']")))
      .sendKeys("4242 4242 4242 4242");
  driver.findElement(By.cssSelector("[data-testid='card-expiry']")).sendKeys("12/30");
  driver.findElement(By.cssSelector("[data-testid='card-cvc']")).sendKeys("123");
  driver.switchTo().defaultContent();

  driver.findElement(By.cssSelector("[data-testid='place-order']")).click();
  wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-testid='row-KG-2101']")));
} finally {
  driver.quit();
}

Python

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()
wait = WebDriverWait(driver, 5)
try:
    driver.get("https://corlabs.dev/practice/shop/sign-in")
    driver.find_element(By.ID, "email").send_keys("[email protected]")
    driver.find_element(By.ID, "password").send_keys("practice123")
    driver.find_element(By.CSS_SELECTOR, "[data-testid='sign-in']").click()
    wait.until(EC.text_to_be_present_in_element((By.TAG_NAME, "h1"), "Order history"))

    driver.find_element(By.CSS_SELECTOR, "[data-testid='shop-search']").send_keys("Pocket")
    wait.until(EC.element_to_be_clickable(
        (By.XPATH, "//li[@role='option'][normalize-space()='Pocket Speaker']"))).click()
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "[data-testid='add-to-cart']"))).click()
    driver.find_element(By.CSS_SELECTOR, "[data-testid='cart-link']").click()
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "[data-testid='checkout']"))).click()

    wait.until(EC.visibility_of_element_located((By.ID, "address"))).send_keys("1 Main St")
    driver.find_element(By.CSS_SELECTOR, "input[placeholder='City']").send_keys("Springfield")
    driver.find_element(By.CSS_SELECTOR, "input[placeholder='Postcode']").send_keys("12345")

    wait.until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe[title='Card details']")))
    wait.until(EC.visibility_of_element_located(
        (By.CSS_SELECTOR, "[data-testid='card-number']"))).send_keys("4242 4242 4242 4242")
    driver.find_element(By.CSS_SELECTOR, "[data-testid='card-expiry']").send_keys("12/30")
    driver.find_element(By.CSS_SELECTOR, "[data-testid='card-cvc']").send_keys("123")
    driver.switch_to.default_content()

    driver.find_element(By.CSS_SELECTOR, "[data-testid='place-order']").click()
    wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "[data-testid='row-KG-2101']")))
finally:
    driver.quit()

Shadow DOMMore Shadow DOM practice

Coupon fieldAn input and a button inside a shadow root.

Built well

Built to break

Two roots deepA button inside a root that sits inside another root.

Built well

Built to break

Date pickerThe same picker the admin product editor uses.

Built well

Available from

Built to break

Available from

Iframe inside a shadow rootCross the root, then switch into the frame.

Built well

Built to break

Design-system buttonThe label is slotted in from outside; the button lives in the root.

Built well

Checkout

Built to break

Pay now

Selenium (Java) code for this section
SearchContext coupon = driver
    .findElement(By.cssSelector("[data-testid='coupon-widget']")).getShadowRoot();
coupon.findElement(By.cssSelector("[data-testid='coupon-input']")).sendKeys("SAVE10");
coupon.findElement(By.cssSelector("[data-testid='coupon-apply']")).click();

// One getShadowRoot() per host. Shadow roots accept CSS, not XPath.
SearchContext outer = driver
    .findElement(By.cssSelector("[data-testid='wishlist-outer']")).getShadowRoot();
SearchContext inner = outer
    .findElement(By.cssSelector("[data-testid='wishlist-inner']")).getShadowRoot();
inner.findElement(By.cssSelector("[data-testid='wishlist-add']")).click();

// Slotted label: plain page DOM, even when the root is closed
driver.findElement(By.xpath("//span[@slot='label'][normalize-space()='Pay now']")).click();

IframesMore Iframes practice

Card formUse the test card 4242 4242 4242 4242, any future expiry and any CVC.

Built well

Built to break

Nested framesA chat frame inside a help-center frame.

Built well

Built to break

Shadow root inside an iframeSwitch into the frame, then cross the root.

Built well

Built to break

Selenium (Java) code for this section
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(
    By.cssSelector("iframe[title='Card details']")));
wait.until(ExpectedConditions.visibilityOfElementLocated(
    By.cssSelector("[data-testid='card-number']"))).sendKeys("4242 4242 4242 4242");
driver.findElement(By.cssSelector("[data-testid='card-expiry']")).sendKeys("12/30");
driver.findElement(By.cssSelector("[data-testid='card-cvc']")).sendKeys("123");
driver.switchTo().defaultContent(); // back to the page

// Nested: one switch per level
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(
    By.cssSelector("iframe[title='Help center']")));
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(
    By.cssSelector("iframe[title='Chat']")));
driver.findElement(By.cssSelector("[data-testid='chat-input']")).sendKeys("Hi");
driver.switchTo().defaultContent();

DropdownsMore Dropdowns practice

Native selectA real <select> element.

Built well

Built to break

Sort by

Searchable comboboxType to filter, then pick a suggestion.

Built well

Built to break

Search products

Multi-selectChoose several options; remove them from the chips.

Built well

Brands

Built to break

Brands
Choose

Menu that closes when you inspect itIt closes when the page loses focus. In DevTools, turn on "Emulate a focused page" to inspect it.

Built well

Built to break

Account
Selenium (Java) code for this section
new Select(driver.findElement(By.id("native-select"))).selectByValue("phones");

driver.findElement(By.cssSelector("[data-testid='combobox']")).sendKeys("cam");
new WebDriverWait(driver, Duration.ofSeconds(5))
    .until(ExpectedConditions.elementToBeClickable(
        By.xpath("//li[@role='option'][normalize-space()='Cameras']")))
    .click();

driver.findElement(By.cssSelector("[data-testid='multi-select']")).click();
driver.findElement(By.xpath("//li[@role='option'][normalize-space()='Audio']")).click();

Web tablesMore Web tables practice

Sortable, editable tableSort by any column. Edit a customer name with the pencil.

Built well

Recent orders
ORD-1001Ada ParkPaid$19.50
ORD-1002Bo ChenRefunded$56.50
ORD-1003Cal DiazPending$93.50
ORD-1004Dee EvansShipped$130.50
ORD-1005Eli FoxPaid$167.50
ORD-1006Fay GoldRefunded$204.50
ORD-1007Gus HalePending$241.50
ORD-1008Ivy ItoShipped$278.50
ORD-1009Jon KerrPaid$315.50
ORD-1010Kai LundRefunded$352.50
ORD-1011Lia MossPending$389.50
ORD-1012Max NoriShipped$26.50

Built to break

Order
Customer
Status
Total
ORD-1001
Ada Park
✎
Paid
$19.50
ORD-1002
Bo Chen
✎
Refunded
$56.50
ORD-1003
Cal Diaz
✎
Pending
$93.50
ORD-1004
Dee Evans
✎
Shipped
$130.50
ORD-1005
Eli Fox
✎
Paid
$167.50
ORD-1006
Fay Gold
✎
Refunded
$204.50
ORD-1007
Gus Hale
✎
Pending
$241.50
ORD-1008
Ivy Ito
✎
Shipped
$278.50
ORD-1009
Jon Kerr
✎
Paid
$315.50
ORD-1010
Kai Lund
✎
Refunded
$352.50
ORD-1011
Lia Moss
✎
Pending
$389.50
ORD-1012
Max Nori
✎
Shipped
$26.50

Virtualized table500 orders, but only the rows in view are in the DOM.

Built well

ORD-1001Ada ParkPaid
ORD-1002Bo ChenRefunded
ORD-1003Cal DiazPending
ORD-1004Dee EvansShipped
ORD-1005Eli FoxPaid
ORD-1006Fay GoldRefunded
ORD-1007Gus HalePending
ORD-1008Ivy ItoShipped
ORD-1009Jon KerrPaid
ORD-1010Kai LundRefunded
ORD-1011Lia MossPending
ORD-1012Max NoriShipped
ORD-1013Ada ParkPaid
ORD-1014Bo ChenRefunded

Built to break

ORD-1001Ada ParkPaid
ORD-1002Bo ChenRefunded
ORD-1003Cal DiazPending
ORD-1004Dee EvansShipped
ORD-1005Eli FoxPaid
ORD-1006Fay GoldRefunded
ORD-1007Gus HalePending
ORD-1008Ivy ItoShipped
ORD-1009Jon KerrPaid
ORD-1010Kai LundRefunded
ORD-1011Lia MossPending
ORD-1012Max NoriShipped
ORD-1013Ada ParkPaid
ORD-1014Bo ChenRefunded

Paginated tableFind INV-1010: it is not on the first page.

Built well

Invoices
OrderCustomerStatusTotal
INV-1001Ada ParkPaid$19.50
INV-1002Bo ChenRefunded$56.50
INV-1003Cal DiazPending$93.50
INV-1004Dee EvansShipped$130.50

Built to break

Order
Customer
Status
Total
INV-1001
Ada Park
Paid
$19.50
INV-1002
Bo Chen
Refunded
$56.50
INV-1003
Cal Diaz
Pending
$93.50
INV-1004
Dee Evans
Shipped
$130.50
‹
1/3
›

Table of duplicate valuesFind the run on Firefox in Austin. Most cells repeat.

Built well

RunOSBrowserCityCountry
DUP-1WindowsChromePuneIndia
DUP-2WindowsFirefoxPuneIndia
DUP-3macOSChromePuneIndia
DUP-4WindowsChromeAustinUSA
DUP-5LinuxFirefoxPuneIndia
DUP-6WindowsChromePuneIndia
DUP-7macOSSafariAustinUSA
DUP-8WindowsFirefoxAustinUSA

Built to break

Windows
Chrome
Pune
India
Windows
Firefox
Pune
India
macOS
Chrome
Pune
India
Windows
Chrome
Austin
USA
Linux
Firefox
Pune
India
Windows
Chrome
Pune
India
macOS
Safari
Austin
USA
Windows
Firefox
Austin
USA
Selenium (Java) code for this section
WebElement row = driver.findElement(By.cssSelector("[data-testid='row-ORD-1003']"));
row.findElement(By.cssSelector("button[aria-label='Edit customer for ORD-1003']")).click();
WebElement input = driver.findElement(By.cssSelector("input[aria-label='Customer for ORD-1003']"));
// clear() can skip React's change event; select all and type over instead
input.sendKeys(Keys.chord(Keys.CONTROL, "a"), "Zed Young"); // Keys.COMMAND on macOS
row.findElement(By.xpath(".//button[normalize-space()='Save']")).click();

// Virtualized: scroll the container, then wait for the row
WebElement grid = driver.findElement(By.cssSelector("[data-testid='virtual-table']"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollTop = 40 * 300", grid);
new WebDriverWait(driver, Duration.ofSeconds(5)).until(
    ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-testid='vrow-ORD-1301']")));

XPathMore XPath practice

Value in a table rowGet the total for Bo Chen, wherever the row sits.

Built well

CustomerStatusTotal
Ada ParkPaid$149.00
Bo ChenShipped$56.00
Cal DiazRefunded$899.00
Dee EvansPaid$249.00

Built to break

Ada Park
Paid
$149.00
Bo Chen
Shipped
$56.00
Cal Diaz
Refunded
$899.00
Dee Evans
Paid
$249.00

Id that changes every build

Built well

Built to break

Text with stray spaces

Built well

Built to break

Save draft

Repeated Edit linksEdit Bo Chen, not "the second one".

Built well

  • Ada Park
  • Bo Chen
  • Cal Diaz

Built to break

  • Ada ParkEdit
  • Bo ChenEdit
  • Cal DiazEdit

Inputs that differ by one attribute

Built well

Built to break

Email me
Text me

Text in other scriptsHindi, Chinese and accents are fine; a non-breaking space or curly quotes are not.

Built well

Built to break

Pay now
“Gift” card
Selenium (Java) code for this section
WebElement total = driver.findElement(
    By.xpath("//table[@data-testid='xp-table']//tr[td[normalize-space()='Bo Chen']]/td[3]"));

driver.findElement(By.xpath("//input[starts-with(@id, 'search-')]")).sendKeys("headphones");
driver.findElement(By.xpath("//div[span][normalize-space()='Save draft']")).click();
driver.findElement(By.xpath("//ul[@data-testid='xp-people']/li[span[normalize-space()='Bo Chen']]/button")).click();
driver.findElement(By.xpath("//label[normalize-space()='Text me']/input[@name='notify' and @value='sms']")).click();

Form controlsMore Form controls practice

Input with validationType something that is not an email, then leave the field.

Built well

Built to break

Radio buttons

Built well

Plan

Built to break

Plan
•Free
Pro
Team

Checkbox

Built well

Built to break

Subscribe to the newsletter

File uploadThe fragile one hides its real input.

Built well

Built to break

Product image
Drop files here or browse

Slider and date

Built well

Built to break

Stock level: 40
Delivery date
Selenium (Java) code for this section
WebElement email = driver.findElement(By.id("work-email"));
email.sendKeys("not-an-email");
email.sendKeys(Keys.TAB); // leave the field to trigger validation
assertEquals("true", email.getAttribute("aria-invalid"));

driver.findElement(By.xpath("//fieldset[@data-testid='plan-group']//label[normalize-space()='Pro']/input")).click();
driver.findElement(By.cssSelector("[data-testid='newsletter']")).click();
driver.findElement(By.id("file-upload")).sendKeys("/absolute/path/to/shoe.png");
driver.findElement(By.id("slider")).sendKeys(Keys.ARROW_RIGHT);
// Native date inputs take keystrokes in the browser's locale order (US: MM DD YYYY)
driver.findElement(By.id("date-field")).sendKeys("12242026");

Alerts and modalsMore Alerts and modals practice

Modal dialog

Built well

Built to break

Delete product

ToastGone after three seconds.

Built well

Built to break

Save changes

TooltipHover the icon.

Built well

Built to break

Browser alert, confirm and promptNative dialogs have no DOM.

Built well

Built to break

Show alert
Open
Show prompt
Selenium (Java) code for this section
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
driver.findElement(By.cssSelector("[data-testid='open-dialog']")).click();
WebElement dialog = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[role='dialog']")));
dialog.findElement(By.xpath(".//button[normalize-space()='Cancel']")).click();
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("[role='dialog']")));

driver.findElement(By.cssSelector("[data-testid='save-changes']")).click();
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("[data-testid='toast']"), "Changes saved"));

new Actions(driver).moveToElement(driver.findElement(By.cssSelector("button[aria-label='Shipping info']"))).perform();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[role='tooltip']")));

driver.findElement(By.cssSelector("[data-testid='confirm-button']")).click();
wait.until(ExpectedConditions.alertIsPresent()).accept();

Mouse hoverMore Mouse hover practice

Nested hover menuAccount → Security → Two-factor.

Built well

Built to break

Account
Orders
Help

Right-click menu

Built well

Order KG-2041 · right-click for actions

Built to break

Order KG-2041 · right-click for actions

Selenium (Java) code for this section
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
Actions actions = new Actions(driver);
actions.moveToElement(driver.findElement(
    By.xpath("//*[@role='menuitem'][starts-with(normalize-space(),'Account')]"))).perform();
actions.moveToElement(wait.until(ExpectedConditions.visibilityOfElementLocated(
    By.xpath("//*[@role='menuitem'][starts-with(normalize-space(),'Security')]")))).perform();
wait.until(ExpectedConditions.elementToBeClickable(
    By.xpath("//*[@role='menuitem'][normalize-space()='Two-factor']"))).click();

actions.contextClick(driver.findElement(By.cssSelector("[data-testid='context-area']"))).perform();
driver.findElement(By.xpath(
    "//*[@role='menu'][@aria-label='Row actions']//*[@role='menuitem'][normalize-space()='Delete']")).click();

Drag and dropMore Drag and drop practice

Drag to reorderDrag a row onto another. The good list also has move buttons.

Built well

Summer sale banner
New arrivals
Best sellers
Gift guide

Built to break

Summer sale banner
New arrivals
Best sellers
Gift guide

TabsThe fragile tabs change order on v2.

Built well

Soft cotton, cut for everyday wear.

Built to break

Description
Specs
Reviews
Soft cotton, cut for everyday wear.

Accordion

Built well

Built to break

Shipping+
Returns+
Warranty+
Selenium (Java) code for this section
// Actions.dragAndDrop sends mouse events, which native drag and drop ignores in Chrome.
// Use the app's keyboard or button alternative, or dispatch drag events from JavaScript.
driver.findElement(By.cssSelector("button[aria-label='Move Best sellers up']")).click();

driver.findElement(By.xpath("//*[@role='tab'][normalize-space()='Specs']")).click();
String panel = driver.findElement(By.cssSelector("[role='tabpanel']")).getText();

driver.findElement(By.xpath("//button[@aria-expanded][starts-with(normalize-space(),'Returns')]")).click();
new WebDriverWait(driver, Duration.ofSeconds(5)).until(
    ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[role='region'][aria-label='Returns']")));

WaitsMore Waits practice

Content that arrives lateTwo seconds after the page loads, or after Reload.

Built well

Loading recommendations…

Built to break

Spinner

Built well

Built to break

Load orders

Stacked toastsEach hides after 3 seconds. Two can show at once.

Built well

Built to break

List that loads as you scroll

Built well

  • Product 1
  • Product 2
  • Product 3
  • Product 4
  • Product 5
  • Product 6
  • Product 7
  • Product 8
  • Product 9
  • Product 10

Built to break

Product 1
Product 2
Product 3
Product 4
Product 5
Product 6
Product 7
Product 8
Product 9
Product 10
Load more
Selenium (Java) code for this section
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(6));
wait.until(ExpectedConditions.attributeToBe(
    By.cssSelector("[data-testid='delayed-content']"), "aria-busy", "false"));

driver.findElement(By.cssSelector("[data-testid='load-orders']")).click();
wait.until(ExpectedConditions.invisibilityOfElementLocated(
    By.cssSelector("[role='progressbar'][aria-label='Loading orders']")));
wait.until(ExpectedConditions.textToBePresentInElementLocated(
    By.cssSelector("[data-testid='orders-result']"), "3 orders found."));

driver.findElement(By.xpath("//button[normalize-space()='Load more']")).click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-testid='lazy-item-20']")));

driver.findElement(By.xpath("//button[normalize-space()='Both at once']")).click();
wait.until(ExpectedConditions.textToBe(By.cssSelector("[data-testid='toast-shipped']"), "Order KG-2101 shipped."));
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("[data-testid='toast-shipped']")));

Windows and tabsMore Windows and tabs practice

New tab

Built to break

Open

Pop-up windowType a reply in the pop-up and send it back.

Built well

Built to break

Open help window
Selenium (Java) code for this section
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
String main = driver.getWindowHandle();
driver.findElement(By.cssSelector("[data-testid='popup-button']")).click();
wait.until(ExpectedConditions.numberOfWindowsToBe(2));
for (String handle : driver.getWindowHandles()) {
  if (!handle.equals(main)) driver.switchTo().window(handle);
}
driver.findElement(By.id("popup-message")).sendKeys("All good");
driver.findElement(By.cssSelector("[data-testid='popup-send']")).click();

driver.switchTo().window(main);
wait.until(ExpectedConditions.textToBePresentInElementLocated(
    By.cssSelector("[data-testid='popup-reply']"), "All good"));

SVG and canvasMore SVG and canvas practice

SVG icon button

Built well

Built to break

SVG bar chartClick Wednesday’s bar.

Built well

Mon: 12 ordersTue: 19 ordersWed: 7 ordersThu: 15 ordersFri: 22 orders

Built to break

CanvasClick the green tile.

Built well

Built to break

SVG inside a shadow root

Built well

Built to break

Selenium (Java) code for this section
driver.findElement(By.cssSelector("button[aria-label='Delete item']")).click();

// XPath: SVG elements need name() or local-name()
driver.findElement(By.xpath(
    "//*[name()='svg'][@data-testid='sales-chart']/*[name()='rect'][@data-testid='bar-wed']")).click();

// Canvas: Selenium 4 offsets are from the element's centre (115, 40 on this 230×80 canvas)
WebElement canvas = driver.findElement(By.cssSelector("[data-testid='tiles-canvas']"));
new Actions(driver).moveToElement(canvas, -5, 0).click().perform();

Hidden elementsMore Hidden elements practice

Hidden until you open it

Built well

Built to break

Edit

Covered by a bannerClick Subscribe, then accept the cookies first.

Built well

Built to break

Subscribe

We use cookies.
OK

Disabled until enabled

Built well

Built to break

✎

Invisible real inputThe checkbox you see is a span; the real one is invisible.

Built well

Built to break

Alerts

Text drawn by CSS

Built well

Aero HeadphonesSale

Built to break

Aero Headphones
Selenium (Java) code for this section
driver.findElement(By.cssSelector("[data-testid='edit-nickname']")).click();
driver.findElement(By.cssSelector("[data-testid='nickname']")).sendKeys("Sam");

driver.findElement(By.xpath(
    "//*[@role='dialog'][@aria-label='Cookie consent']//button[normalize-space()='Accept cookies']")).click();
driver.findElement(By.cssSelector("[data-testid='subscribe']")).click(); // intercepted if the banner is still up

driver.findElement(By.cssSelector("[data-testid='enable-editing']")).click();
new WebDriverWait(driver, Duration.ofSeconds(5))
    .until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-testid='company-name']")))
    .sendKeys("Kestrel");

// Clicking the invisible input throws ElementNotInteractableException; click the label
driver.findElement(By.xpath("//label[normalize-space()='Email alerts']")).click();

String sale = (String) ((JavascriptExecutor) driver).executeScript(
    "return getComputedStyle(arguments[0], '::before').content",
    driver.findElement(By.cssSelector(".pr-pseudo-sale")));

Find the broken linksTwo of these five links answer 404.

Link with no text

Built well

Built to break

Link padded with spaces

Built well

Built to break

File download

Built to break

Selenium (Java) code for this section
for (WebElement link : driver.findElements(By.cssSelector("[data-testid='link-list'] a"))) {
  String href = link.getAttribute("href");
  HttpURLConnection conn = (HttpURLConnection) URI.create(href).toURL().openConnection();
  conn.setRequestMethod("HEAD");
  int status = conn.getResponseCode();
  if (status >= 400) System.out.println("Broken: " + href + " (" + status + ")");
}

driver.findElement(By.cssSelector("a[aria-label='Open cart']")).click();
driver.navigate().back();
driver.findElement(By.xpath("//a[normalize-space()='Track my order']")).click();

Virtualized listsMore Virtualized lists practice

1,000-row virtualized listScroll to ORD-742 (Rosa Quinn). Rows outside the view are removed, not hidden.

Built well

ORD-1Ada ParkPaid
ORD-2Bo ChenRefunded
ORD-3Cal DiazPending
ORD-4Dee EvansShipped
ORD-5Eli FoxPaid
ORD-6Fay GoldRefunded
ORD-7Gus HalePending
ORD-8Ivy ItoShipped
ORD-9Jon KerrPaid
ORD-10Kai LundRefunded
ORD-11Lia MossPending
ORD-12Max NoriShipped
ORD-13Ada ParkPaid
ORD-14Bo ChenRefunded

Built to break

ORD-1Ada ParkPaid
ORD-2Bo ChenRefunded
ORD-3Cal DiazPending
ORD-4Dee EvansShipped
ORD-5Eli FoxPaid
ORD-6Fay GoldRefunded
ORD-7Gus HalePending
ORD-8Ivy ItoShipped
ORD-9Jon KerrPaid
ORD-10Kai LundRefunded
ORD-11Lia MossPending
ORD-12Max NoriShipped
ORD-13Ada ParkPaid
ORD-14Bo ChenRefunded
Selenium (Java) code for this section
WebElement list = driver.findElement(By.cssSelector("[data-testid='order-list']"));
By row = By.cssSelector("[data-customer='Rosa Quinn']");
JavascriptExecutor js = (JavascriptExecutor) driver;

while (driver.findElements(row).isEmpty()) {
  js.executeScript("arguments[0].scrollBy(0, arguments[0].clientHeight)", list);
}
assertTrue(driver.findElement(row).getText().contains("ORD-742"));

Generated idsMore Generated ids practice

Profile formSame form twice. Switch to v2 and watch the ids on the right change.

Built well

Built to break

Save

Selenium (Java) code for this section
driver.findElement(By.cssSelector("[data-testid='gen-name']")).sendKeys("Ada Park");
driver.findElement(By.cssSelector("[data-testid='gen-email']")).sendKeys("[email protected]");
driver.findElement(By.cssSelector("[data-testid='gen-save']")).click();

// Survives renumbering, but not a second billing-email field:
// By.xpath("//input[starts-with(@id, 'billing-email')]")

Localized textMore Localized text practice

Checkout in two languagesUse the Language switch above. The same build serves both.

Built well

Checkout

Total: $149.00

Built to break

Checkout

Total: $149.00

Place order

Selenium (Java) code for this section
for (String lang : List.of("en", "de")) {
  driver.get(BASE + "/practice/localized-text?lang=" + lang);
  driver.findElement(By.cssSelector("[data-testid='l10n-email']")).sendKeys("[email protected]");
  driver.findElement(By.cssSelector("[data-testid='l10n-place-order']")).click();
}

// English only: By.xpath("//button[normalize-space()='Place order']")

A/B variantsMore A/B variants practice

Newsletter sign-up, A/B testedv1 shows variant A, v2 variant B.

Built well

Get release notes by email

Built to break

Get release notes by email

Subscribe

Selenium (Java) code for this section
WebElement form = driver.findElement(By.cssSelector("[data-testid='ab-signup']"));
form.findElement(By.cssSelector("[data-testid='ab-email']")).sendKeys("[email protected]");
form.findElement(By.cssSelector("[data-testid='ab-subscribe']")).click();

// Variant A only: By.xpath("//button[text()='Subscribe']")