elements / alerts

Single UI element

Alerts & Toasts

Static status banners, manual close buttons, timed countdown-dismiss alerts, and temporary toast notifications.

Static banners

#alert-static
ⓘ
Heads upThis build runs against the staging environment.
✓
SuccessYour changes were saved.
!
WarningSession expires in 5 minutes.
✕
ErrorCould not reach the server.
ids
alert-info, alert-success, alert-warn, alert-error
expected
Always present in the DOM with distinct role/colors.
Code snippets
Python (Selenium)
info = driver.find_element(By.ID, "alert-info")
assert "staging" in info.text
assert "info" in info.get_attribute("class")
TypeScript (Playwright)
expect(await page.textContent('#alert-info')).toContain('staging');
expect(await page.getAttribute('#alert-info', 'class')).toContain('info');

Dismissible alert

#alert-dismissible
ⓘ
New featureDark mode is now available across all pages.
id
alert-dismissible
close btn
#alert-dismiss-btn
expected
Clicking ✕ removes the alert element from the DOM tree.
Code snippets
Python (Selenium)
driver.find_element(By.ID, "alert-dismiss-btn").click()
assert len(driver.find_elements(By.ID, "alert-dismissible")) == 0
TypeScript (Playwright)
await page.click('#alert-dismiss-btn');
await expect(page.locator('#alert-dismissible')).toHaveCount(0);

Countdown auto-dismiss (5s)

#alert-countdown
⏳
Notice: This notification self-destructs in 5 seconds.
id
alert-countdown
countdown span
#countdown-num
expected
Disappears automatically after 5 seconds from page render.
Code snippets
Python (Selenium)
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# Wait until alert is removed from DOM
WebDriverWait(driver, 7).until(
    EC.invisibility_of_element_located((By.ID, "alert-countdown"))
)
TypeScript (Playwright)
// Wait until alert is detached from DOM
await page.waitForSelector('#alert-countdown', { state: 'detached', timeout: 7000 });

Toast notification

#btn-toast
trigger id
btn-toast
host
#toast-host
expected
A toast appears top-right and auto-dismisses after 3 seconds — good for practicing waits on transient elements.
Code snippets
Python (Selenium)
driver.find_element(By.ID, "btn-toast").click()
toast = WebDriverWait(driver, 2).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, "#toast-host .alert"))
)
assert "Done" in toast.text
TypeScript (Playwright)
await page.click('#btn-toast');
await page.waitForSelector('#toast-host .alert');
expect(await page.textContent('#toast-host .alert')).toContain('Done');