This is used to know the exact location of the product .
package Testng;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("https://zovi.com/");
driver.findElement(By.id("logo")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(By.linkText("Casual Shirts")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String bcName=driver.findElement(By.xpath("//div[@id='breadcrumbs']")).getText();
if(bcName.contains("Home/Men/Shirts/Casuals"))
{
System.out.println("Pass");
}
else
{
System.out.println("Fail");
}
driver.close();
}
To know FAQ's on Selenium Please ClickHere
To know SQL's Queries Required For Testers Please ClickHere
No comments:
Post a Comment