Skip to content

Instantly share code, notes, and snippets.

@nadvolod
Created September 8, 2020 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadvolod/dd59c18b23dc42a60ae4294be789b044 to your computer and use it in GitHub Desktop.
Save nadvolod/dd59c18b23dc42a60ae4294be789b044 to your computer and use it in GitHub Desktop.
An optimized radio button clicking test
@Test
public void optimizedTest() throws AssertionError {
driver.navigate().to("https://www.techlistic.com/p/selenium-practice-form.html");
var male = driver.findElement(By.id("sex-0"));
var actions = new Actions(driver);
actions.moveToElement(male).click().perform();
assertTrue(male.isSelected());
var female = driver.findElement(By.id("sex-1"));
female.click();
assertTrue(female.isSelected());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment