UI Element Automation Practice

Interact with and automate a full catalogue of UI elements โ€” inputs, buttons, checkboxes, radios, dropdowns, sliders, tables, modals, and more โ€” with Selenium, Cypress, or Playwright.

A hands-on playground for UI automation. Interact with each component below, watch its real-time output, and practice locating and driving it with Selenium, Cypress, or Playwright โ€” every element exposes a stable id and data-testid.

Basic Elements

Clicked 0 times
Unchecked
Checked:
No option selected
No option selected
No options selected

Interactive Elements

Click Me
Click the link
Placeholder
Click the image
IDNameAge
1Zui30
3Bob25
2Charlie35
5Ashley30
4Nat25
6Jim35
Click a table header to "sort"
Hover Me
Hover over "Hover Me"
Slider Value: 50
30%
Progress: 30%

Complex UI Components

Click "Show Modal"

(This is a basic input for demonstration. Integrate a datepicker library for full functionality)

No date selected (simulated)
No file selected
(Download simulated via alert)
Drag Me
Drop Here
Drag "Drag Me" to "Drop Here"
Iframe loaded

Advanced UI Elements

Initial Content
Click "Update Content" to see changes
Click "Show Notification"

Content of Tab 1

Content of Tab 2

Active Tab: tab1

Content of Accordion Item #1

Content of Accordion Item #2
Open an accordion item
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
Item 21
Item 22
Item 23
Item 24
Item 25
Item 26
Item 27
Item 28
Item 29
Item 30
Item 31
Item 32
Item 33
Item 34
Item 35
Item 36
Item 37
Item 38
Item 39
Item 40
Item 41
Item 42
Item 43
Item 44
Item 45
Item 46
Item 47
Item 48
Item 49
Item 50

Scroll to simulate virtual scrolling

Scroll Position: 0

How to Automate This UI Elements Page

A showcase of the common controls you will meet in real apps โ€” text fields, checkboxes, radios, single and multi-select dropdowns, a slider, a table you can sort, a modal, a file input, and more. Use it to practise the right interaction for each element type.

The same scenario written for two popular frameworks. These use the stable id and data-testid locators documented in the cheat sheet below.

import { test, expect } from '@playwright/test';

test('interact with the core UI element types', async ({ page }) => {
  await page.goto('https://www.qapractice.com/practice-different-ui-elements');

  // Text input + output mirror
  await page.getByTestId('ui-text-field').fill('automation');

  // Checkbox / radio
  await page.getByTestId('ui-single-checkbox').check();
  await page.getByTestId('ui-radio-Option 2').check();

  // Dropdowns
  await page.getByTestId('ui-single-dropdown').selectOption('India');
  await page.getByTestId('ui-multi-dropdown').selectOption(['Option A', 'Option B']);

  // Range slider (set via fill)
  await page.getByTestId('ui-slider').fill('70');

  // Sort the table by clicking a header
  await page.getByTestId('ui-th-name').click();

  // File upload
  await page.getByTestId('ui-file-upload').setInputFiles('fixtures/sample.pdf');

  // Button increments a counter
  await page.getByTestId('ui-click-button').click();
  await expect(page.getByText(/Clicked 1 times/)).toBeVisible();
});
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

public class UiElementsTest {
  public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.qapractice.com/practice-different-ui-elements");

    driver.findElement(By.id("textField")).sendKeys("automation");
    driver.findElement(By.id("ui-single-checkbox")).click();
    driver.findElement(By.cssSelector("[data-testid='ui-radio-Option 2']")).click();

    new Select(driver.findElement(By.id("singleDropdown"))).selectByVisibleText("India");
    Select multi = new Select(driver.findElement(By.id("multiDropdown")));
    multi.selectByVisibleText("Option A");
    multi.selectByVisibleText("Option B");

    // Sort table + upload a file
    driver.findElement(By.cssSelector("[data-testid='ui-th-name']")).click();
    driver.findElement(By.id("ui-file-upload")).sendKeys("/path/to/sample.pdf");

    driver.findElement(By.id("ui-click-button")).click();

    driver.quit();
  }
}

Every interactive element on this page exposes a stable id and/or data-testid so your scripts don't depend on brittle positions or styling.

Elementiddata-testidPlaywright locatorSelenium locator
Text fieldtextFieldui-text-fieldgetByTestId('ui-text-field').fill('hello')By.id("textField")
Text areatextAreaui-textareagetByTestId('ui-textarea').fill('lines')By.id("textArea")
Click buttonui-click-buttonui-click-buttongetByTestId('ui-click-button').click()By.id("ui-click-button")
Single checkboxui-single-checkboxui-single-checkboxgetByTestId('ui-single-checkbox').check()By.id("ui-single-checkbox")
Multi checkbox (1/2/3)ui-checkbox-option1ui-checkbox-option1getByTestId('ui-checkbox-option2').check()By.id("ui-checkbox-option2")
Radio optionui-radio-<option>ui-radio-<option>getByTestId('ui-radio-Option 2').check()By.cssSelector("[data-testid='ui-radio-Option 2']")
Single-select dropdownsingleDropdownui-single-dropdowngetByTestId('ui-single-dropdown').selectOption('India')new Select(driver.findElement(By.id("singleDropdown")))
Multi-select dropdownmultiDropdownui-multi-dropdowngetByTestId('ui-multi-dropdown').selectOption(['A','B'])new Select(driver.findElement(By.id("multiDropdown")))
Anchor linkui-linkui-linkgetByTestId('ui-link').click()By.id("ui-link")
Clickable imageui-imageui-imagegetByTestId('ui-image').click()By.id("ui-image")
Sortable table headerโ€”ui-th-id / ui-th-name / ui-th-agegetByTestId('ui-th-name').click()By.cssSelector("[data-testid='ui-th-name']")
Range sliderui-sliderui-slidergetByTestId('ui-slider').fill('70')By.id("ui-slider")
Progress increment buttonui-progress-incrementui-progress-incrementgetByTestId('ui-progress-increment').click()By.id("ui-progress-increment")
Open-modal buttonui-modal-openui-modal-opengetByTestId('ui-modal-open').click()By.id("ui-modal-open")
Date input (simulated)ui-datepickerui-datepickergetByTestId('ui-datepicker').fill('2026-08-01')By.id("ui-datepicker")
File uploadui-file-uploadui-file-uploadgetByTestId('ui-file-upload').setInputFiles('r.pdf')By.id("ui-file-upload")
Update dynamic contentui-update-contentui-update-contentgetByTestId('ui-update-content').click()By.id("ui-update-content")
Show notificationui-show-notificationui-show-notificationgetByTestId('ui-show-notification').click()By.id("ui-show-notification")

Use these as a checklist to build your automation suite. Download them as a Markdown file to keep alongside your test project.

IDScenarioStepsExpected Result
TC01Text field mirrors input
  1. Type into the Text Field
The Output box shows exactly what you typed.
TC02Button click counter
  1. Click the "Click Me" button three times
The output reads "Clicked 3 times".
TC03Single checkbox toggles
  1. Check, then uncheck the single checkbox
Output toggles between "Checked" and "Unchecked".
TC04Multiple checkboxes
  1. Check Option 1 and Option 3
Output lists "option1, option3".
TC05Radio group is exclusive
  1. Select a radio option, then another
Only the last selected option is active; output updates.
TC06Single-select dropdown
  1. Choose a country from the single dropdown
Output shows the selected country.
TC07Multi-select dropdown
  1. Select two or more options in the multi dropdown
Output lists all selected options.
TC08Slider value
  1. Drag/set the range slider
Output shows the current slider value (0โ€“100).
TC09Table sorting
  1. Click the Name column header
The table indicates it is sorted by "name".
TC10Modal open/close
  1. Click "Show Modal", then Close
The modal opens and then closes; output reflects the state.
TC11File selection
  1. Choose a file in the file input
The selected file name is displayed.
TC12Notification toast
  1. Click "Show Notification"
A success toast appears with "Operation completed successfully."