@Test(priority=1) public void AddUsers1() throws Exception {
String invalidusername=admin.getData(8, 1);
String validusername=admin.getData(9, 1);
String firstname=admin.getData(10, 1);
String lastname=admin.getData(11, 1);
String invalidpwd=admin.getData(12, 1);
String validpwd=admin.getData(13, 1);
String invalidemail=admin.getData(14, 1);
String validemail=admin.getData(15, 1);
String phone=admin.getData(16, 1);
//driver.findElement(By.cssSelector("#expiretxt > button.btn.btn-default")).click();
Thread.sleep(1000);;
driver.findElement(By.linkText("ADMIN")).click();
driver.findElement(By.linkText("Users")).click();
WebDriverWait wait = new WebDriverWait(driver, 50);// 1 minute
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@href='http://test.com]"))).click();
WebDriverWait wait1 = new WebDriverWait(driver, 40);// 1 minute
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username"))).click();
//Submitting without giving user name
driver.findElement(By.id("submit-1")).click();
String expectedTitle = "Username is empty.";
String actualTitle = "";
actualTitle = driver.switchTo().alert().getText();
if (actualTitle.contentEquals(expectedTitle)){
System.out.println("1.Test Passed!-By submitting without user name alert displayed as [User name is empty]"); ----->
This result should write in existing excel sheet