Created
March 18, 2018 16:31
-
-
Save andreidbr/f5e6e20d3d651c4336933b02febefeef to your computer and use it in GitHub Desktop.
A simple for loop with Selenium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(testName = "Check all sounds", description = "Check that, when clicking every key, a sound is played", groups = {"01Drums"}) | |
public void soundsPlayTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click(); | |
List<WebElement> keyList = driver.findElements(By.className("key")); | |
List<WebElement> audioList = driver.findElements(By.tagName("audio")); | |
Actions builder = new Actions(driver); | |
for (int i = 0; i < keyList.size(); i++) { | |
Action sendKey = builder.moveToElement(keyList.get(i)).sendKeys(String.valueOf(keyList.get(i).getText().charAt(0))).build(); | |
sendKey.perform(); | |
Thread.sleep(1000); | |
Assert.assertNotEquals(audioList.get(i).getAttribute("currentTime"), "0"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment