Handling various WebElement using WebDriver
Common Element Interactions
element.click();
element.sendKeys("text");
element.clear();
String text = element.getText();
boolean visible = element.isDisplayed();
Handling Dropdowns
Select dropdown = new Select(driver.findElement(By.id("country")));
dropdown.selectByVisibleText("India");
Handling Checkboxes and Radio Buttons
These are interacted with using click(), and their state can be checked with isSelected() before deciding whether to click.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.