elements / data table
Advanced element
Data Table — CRUD Operations
A fully interactive live table simulating real admin interfaces: dynamically add rows, inline edit cell contents, and delete rows with immediate DOM updates.
Add New Record
#add-row-form- inputs
- #new-name, #new-role, #new-status
- trigger
- #btn-add-row
- expected
- Appends a new tr to #crud-table tbody with editable actions.
Live Records
3 records| Name | Role | Status | Actions |
|---|---|---|---|
| Vikram Sen | Automation SDET | active | |
| Chloe Bennett | QA Analyst | pending | |
| Rajesh Kumar | Test Lead | inactive |
- table
- #crud-table
- tbody
- #crud-tbody
- actions
- .btn-edit, .btn-delete
- expected
- Clicking Edit makes cells editable; Save locks cells; Delete removes row.
Code snippets
Python (Selenium)
# Add new row
driver.find_element(By.ID, "new-name").send_keys("Karan Rao")
driver.find_element(By.ID, "new-role").send_keys("SDET II")
driver.find_element(By.ID, "btn-add-row").click()
# Assert row added
rows = driver.find_elements(By.CSS_SELECTOR, "#crud-tbody tr")
assert any("Karan Rao" in r.text for r in rows)
# Delete first row
driver.find_elements(By.CSS_SELECTOR, ".btn-delete")[0].click()TypeScript (Playwright)
// Add new row
await page.fill('#new-name', 'Karan Rao');
await page.fill('#new-role', 'SDET II');
await page.click('#btn-add-row');
await expect(page.locator('#crud-tbody tr:has-text("Karan Rao")')).toHaveCount(1);
// Delete first row
await page.locator('.btn-delete').first().click();