111
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Usablackcaviar {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
/* System.setProperty("webdriver.gecko.driver", "C:\\Work\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();*/
/* System.setProperty("webdriver.ie.driver", "C:\\Work\\msedgedriver.exe");
WebDriver driver = new InternetExplorerDriver();*/
String siteName = "http://usablackcaviar.com";
driver.get(siteName);
System.out.println(driver.getTitle());
/* try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
driver.manage().window().maximize();
driver.get(siteName);
driver.findElement(By.linkText("My Account")).click();
driver.findElement(By.linkText("Login")).click();
driver.findElement(By.id("input-email")).clear();
driver.findElement(By.id("input-email")).sendKeys("testmax@gmail.com");
driver.findElement(By.id("input-password")).clear();
driver.findElement(By.id("input-password")).sendKeys("testmax");
driver.findElement(By.xpath("/html[1]/body[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[1]/form[1]/input[1]")).click();
/*System.out.println(driver.findElement(By.xpath("/html[1]/body[1]/div[2]/div[1]/div[1]/h2[1]")).getText());*/
System.out.println(driver.findElement(By.cssSelector("h2:nth-child(1)")).getText());
if (driver.getTitle().equals("My Account")) {
System.out.println("Test Passed!");
} else {
System.out.println("Test Failed");
}
driver.findElement(By.linkText("My Account")).click();
driver.findElement(By.xpath("/html[1]/body[1]/nav[1]/div[1]/div[2]/ul[1]/li[2]/ul[1]/li[5]/a[1]")).click();
/*driver.quit();*/
}
}