Skip to content

Instantly share code, notes, and snippets.

@ndmanvar
Created January 27, 2017 20:12
Show Gist options
  • Save ndmanvar/e397ec04ee90f00b04ffed4bb882e9b4 to your computer and use it in GitHub Desktop.
Save ndmanvar/e397ec04ee90f00b04ffed4bb882e9b4 to your computer and use it in GitHub Desktop.
@Test
public void verifyCommentInputTest() throws InvalidElementStateException {
long startTime = System.nanoTime();
for (int i = 1; i < 3; i++) {
WebElement x = driver.findElementByAccessibilityId("TextField1");
x.clear();
x.sendKeys("12");
x = driver.findElementByAccessibilityId("TextField2");
x.clear();
x.sendKeys(String.valueOf(i));
driver.findElementByAccessibilityId("ComputeSumButton").click();
String result = driver.findElementByClassName("UIAStaticText").getText();
Assert.assertEquals("calculation failed", String.valueOf(12 + i), result);
driver.findElementByAccessibilityId("show alert").click();
System.out.println(driver.getPageSource());
Assert.assertTrue(driver.findElementByAccessibilityId("this alert is so cool.").isDisplayed());
driver.findElementByXPath("//UIAButton[@name='OK']").click();
}
System.out.println("\n\nestimated time is ");
long elapsedTime = System.nanoTime() - startTime;
System.out.println((double)elapsedTime / 1000000000.0 );
System.out.println("\n\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment