Skip to content

Instantly share code, notes, and snippets.

@andreidbr
Created March 15, 2018 18:43
Show Gist options
  • Save andreidbr/10d6ca7325ea5a3b1c183f3ec94fa8ee to your computer and use it in GitHub Desktop.
Save andreidbr/10d6ca7325ea5a3b1c183f3ec94fa8ee to your computer and use it in GitHub Desktop.
A Selenium Webdriver test that compares CSS classes
@Test(testName = "Click 'A' Test", description = "Check that you can click the 'A' key and the correct response triggers", groups = {"01Drums"})
public void aKeyTest() {
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click();
WebElement aKey = driver.findElement(By.xpath("/html/body/div/div[1]"));
Actions builder = new Actions(driver);
Action sendAKey = builder.moveToElement(aKey).sendKeys("A").build();
sendAKey.perform();
Assert.assertEquals(aKey.getAttribute("class"), "key playing");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment