Text Box
A simple form. Fill it in, submit it, and the values appear below – the classic first automation exercise.
Email is not valid
Practice tasks
- Fill every field with valid data, submit, and assert that the output box shows each value.
- Submit with an invalid email such as
abc@and assert that#email-errorbecomes visible. - Submit with all fields empty and assert that the output box stays empty.
- Type a very long address (500 characters) and check nothing is cut off in the output.
- Click Reset and assert that every field is empty again.
Sample automation code
WebDriver driver = new ChromeDriver();
driver.get("https://jstestingacademy.co.in/qa-demo/elements/text-box.html");
driver.findElement(By.id("userName")).sendKeys("Karthik Raj");
driver.findElement(By.id("userEmail")).sendKeys("karthik@example.com");
driver.findElement(By.id("currentAddress")).sendKeys("31/21 Adaikalanagar, Salem");
driver.findElement(By.id("submit")).click();
String name = driver.findElement(By.id("out-name")).getText();
Assert.assertEquals(name, "Karthik Raj");
await page.goto('https://jstestingacademy.co.in/qa-demo/elements/text-box.html');
await page.getByTestId('full-name').fill('Karthik Raj');
await page.getByTestId('email').fill('karthik@example.com');
await page.getByTestId('current-address').fill('31/21 Adaikalanagar, Salem');
await page.getByTestId('submit').click();
await expect(page.locator('#out-name')).toHaveText('Karthik Raj');