Testing steps:
- Load the page using the given URL (Log in | Register (formsscasb.tk))
- Login using valid credentials → (Email: radhika.rakesh@jobinandjismi.com, Password: test@12345)
- Select the search icon
- Enter an item into the search field → (62-058 High Yield MICR Toner Cartridge: HP LaserJet M506x)
- Select the Go button
- View and select the product to view the PDP page
- Get the title of the page
- Put a condition in order to check whether the test is passed or not
Code:
public static void main(String[] args) throws Exception {
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments(“start-maximized”);
WebDriver driver = new ChromeDriver(options);
driver.get(“https://www.formsscasb.tk/Formsscasb/Formsscasb/checkout.ssp?is=login&loginParam=false&login=T&fragment=login-register#login-register“);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id(“login-email”)).sendKeys(“radhika.rakesh@jobinandjismi.com“);
driver.findElement(By.id(“login-password”)).sendKeys(“test@12345”);
driver.findElement(By.className(“login-register-login-submit”)).click();
Thread.sleep(5000);
driver.findElement(By.className(“site-search-button-link”)).click();
driver.findElement(By.xpath(“//input[@class=’itemssearcher-input typeahead tt-input’]”)).sendKeys(“62-058 High Yield MICR Toner Cartridge: HP LaserJet M506x”);
driver.findElement(By.className(“site-search-button-submit”)).click();
Thread.sleep(3000);
driver.findElement(By.xpath(“//span[@itemprop=’name’][contains(text(),’62-058′)]”)).click();
Thread.sleep(3000);
System.out.println(“Title of the page : “+driver.getTitle());
Thread.sleep(3000);
if (driver.getTitle().equals(“62-058 High Yield MICR Toner Cartridge: HP LaserJet M506x”)) {
System.out.println(“Test Passed”);
}
driver.quit();
}