Skip to content

Instantly share code, notes, and snippets.

@andreidbr
Created March 15, 2018 18:56
Show Gist options
  • Save andreidbr/26d9ec15b01dc94dfcb81ef6b298d8fa to your computer and use it in GitHub Desktop.
Save andreidbr/26d9ec15b01dc94dfcb81ef6b298d8fa to your computer and use it in GitHub Desktop.
A Selenium test to compare two CSS styles of an element
@Test(testName = "02 Clock Functionality Test", description = "Check that the 02 Clock page functions correctly", groups = {"02Clock"})
public void verifyClockTest() throws InterruptedException {
driver.findElement(By.xpath("/html/body/div[2]/div[2]")).click();
String firstStyle = driver.findElement(By.xpath("/html/body/div/div/div[3]")).getAttribute("style");
Thread.sleep(2000);
String secondStyle = driver.findElement(By.xpath("/html/body/div/div/div[3]")).getAttribute("style");
Assert.assertNotEquals(firstStyle, secondStyle, "There are no differences in the two styles");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment