← Back to Selenium Practice

Textbox Handling

Practice UI

Selenium Java Example

WebElement name =
driver.findElement(
By.id("fullname"));

name.sendKeys("John");

WebElement email =
driver.findElement(
By.id("email"));

email.sendKeys("john@test.com");

XPath Examples

//input[@id='fullname']

//input[@type='email']

//textarea[@id='address']

Interview Questions

Difference between sendKeys and getText?

sendKeys enters data. getText reads visible text.

How to clear textbox?

Use clear() method.

Real World Scenario

Automate customer registration form for an e-commerce application.

Challenge Task

Fill all fields and verify entered values.

Expected Output