import java.io.IOException; import java.util.concurrent.TimeUnit;  import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver;   public class login {  	@Test 	 	public void login1() throws InterruptedException 	{ 		WebDriver driver = new HtmlUnitDriver(); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		driver.get("https://ignite.where2stageit.com/login.html"); 		driver.findElement(By.xpath("//*[@id='loginid']")).sendKeys("qa_tester"); 		driver.findElement(By.xpath("//*[@id='password']")).sendKeys("Where2getit!"); 		Thread.sleep(3000L); 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		driver.close(); 		 	} 	@Ignore 	@Test  	public void logout() throws InterruptedException 	{ 		WebDriver driver = new HtmlUnitDriver(); 		//driver.manage().window().maximize(); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		driver.get("https://ignite.where2stageit.com"); 		 		driver.findElement(By.xpath("//*[@id='loginid']")).sendKeys("qa_tester"); 		driver.findElement(By.xpath("//*[@id='password']")).sendKeys("Where2getit!"); 		Thread.sleep(3000L); 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		Thread.sleep(3000L); 		 		driver.findElement(By.xpath("//*[@id='logout-button']")).click(); 		Thread.sleep(5000L); 		//File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); 		//FileUtils.copyFile(scrFile, new File("E://logout.jpg"),true); 		driver.close();  	} 	@Ignore 	@Test  	public void forgot_password() throws InterruptedException 	{ 		WebDriver driver = new HtmlUnitDriver(); 		driver.get("https://ignite.where2stageit.com"); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		driver.findElement(By.xpath("//*[@id='authenticate']/p/a")).click(); 		Thread.sleep(3000L); 		String s1 = driver.findElement(By.xpath("//*[@id='authenticate']/div[1]/p[1]")).getText(); 		System.out.println(s1); 		 		driver.findElement(By.xpath("//*[@id='username']")).sendKeys("qa_tester"); 		 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		Thread.sleep(5000L); 		String s2 = driver.findElement(By.xpath("//*[@id='authenticate']/div")).getText(); 		System.out.println(s2); 		driver.close(); 		 	} 	@Ignore 	@Test  	public void forgot_passwordwithAlert() throws InterruptedException 	{ 		WebDriver driver = new HtmlUnitDriver(); 		driver.get("https://ignite.where2stageit.com"); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		driver.findElement(By.xpath("//*[@id='authenticate']/p/a")).click(); 		Thread.sleep(3000L); 		String s1 = driver.findElement(By.xpath("//*[@id='authenticate']/div[1]/p[1]")).getText(); 		System.out.println(s1); 		 		driver.findElement(By.xpath("//*[@id='username']")).sendKeys(""); 		Thread.sleep(5000L); 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		Thread.sleep(3000L); 		 		Alert alert = driver.switchTo().alert(); 		alert.getText(); 		Thread.sleep(3000L); 		alert.accept(); 		         driver.findElement(By.xpath("//*[@id='username']")).sendKeys("qa_tester"); 		 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		Thread.sleep(3000L); 		String s2 = driver.findElement(By.xpath("//*[@id='authenticate']/div")).getText(); 		System.out.println(s2); 		driver.close();  	} 	@Ignore 	@Test  	public void select_account() throws IOException, InterruptedException 	{ 		WebDriver driver = new HtmlUnitDriver(); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		//driver.manage().window().maximize(); 		driver.get("https://ignite.where2stageit.com"); 		driver.manage().timeouts().implicitlyWait(30L, TimeUnit.SECONDS); 		driver.findElement(By.xpath("//*[@id='loginid']")).sendKeys("qa_tester"); 		driver.findElement(By.xpath("//*[@id='password']")).sendKeys("Where2getit!"); 		Thread.sleep(3000L); 		driver.findElement(By.xpath("//*[@id='submit']")).click(); 		Thread.sleep(3000L); 		 		driver.findElement(By.xpath("//*[@id='accounts_chzn']/a/span")).sendKeys("chickfila"); 		Thread.sleep(3000L); 		driver.findElement(By.xpath("//*[@id='btn-select-account']")).click(); 		//Thread.sleep(10000L); 		 		//File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); 		//FileUtils.copyFile(scrFile, new File("E://account selection.jpg"),true); 		 		driver.close();  	 	} }