elements / buttons
Single UI element
Buttons
Six button states covering click tracking, styling variants, disabled validation, clipboard operations, and async loading timeouts.
Simple button
#btn-simple- id
- btn-simple
- output
- #btn-simple-out
- expected
- Click count increments in the output span.
Code snippets
Python (Selenium)
btn = driver.find_element(By.ID, "btn-simple")
btn.click()
out = driver.find_element(By.ID, "btn-simple-out")
assert "clicked 1 time" in out.textTypeScript (Playwright)
await page.click('#btn-simple');
expect(await page.textContent('#btn-simple-out')).toContain('clicked 1 time');Secondary, ghost & danger
#btn-variants- ids
- btn-secondary, btn-ghost, btn-danger
- expected
- Visual variants with standard button behavior.
Code snippets
Python (Selenium)
driver.find_element(By.ID, "btn-danger").click()TypeScript (Playwright)
await page.click('#btn-danger');Disabled button
#btn-disabled- id
- btn-disabled
- expected
- Not clickable, not part of tab order.
Code snippets
Python (Selenium)
btn = driver.find_element(By.ID, "btn-disabled")
assert not btn.is_enabled()TypeScript (Playwright)
await expect(page.locator('#btn-disabled')).toBeDisabled();Copy to clipboard
#btn-copy
API-TOKEN-99482X
- id
- btn-copy
- target text
- #copy-target-text
- status
- #btn-copy-out
- expected
- Copies text to navigator clipboard and reveals "copied!" status tag.
Code snippets
Python (Selenium)
driver.find_element(By.ID, "btn-copy").click()
clip = driver.execute_script("return navigator.clipboard.readText()")
assert clip == "API-TOKEN-99482X"TypeScript (Playwright)
await page.click('#btn-copy');
const status = await page.textContent('#btn-copy-out');
expect(status).toContain('copied');Async / loading button
#btn-async
pending
- id
- btn-async
- status
- #btn-async-status
- expected
- Button disables, label changes to "Saving…" for ~1.5s, then resolves to "saved".
Code snippets
Python (Selenium)
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver.find_element(By.ID, "btn-async").click()
WebDriverWait(driver, 3).until(
EC.text_to_be_present_in_element((By.ID, "btn-async-status"), "saved")
)TypeScript (Playwright)
await page.click('#btn-async');
await page.waitForSelector('#btn-async-status:has-text("saved")', { timeout: 3000 });