Write a script to open google.com and verify that title is Google and also verify that it is redirected to google.com

public class Test
{
public static void main(String[] args) {
System.setProperty("webdriver.firefox.marionette","E:\\Selenium\\geckodriver-v0.23.0-win32\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("https://www.google.com/");
String Title=driver.getTitle();
String getCurrentUrl = driver.getCurrentUrl();
if(Title.equalsIgnoreCase("google"))
{
System.out.println("Title is " + Title);
}
else
{
System.out.println(Title + "Title Not Matched");
}
if (getCurrentUrl.contains("https://www.google.com/"))
{
System.out.println("The Current URL is  "+ getCurrentUrl);
}
else

{
System.out.println("The Current URL is not matched  "+ getCurrentUrl);
}
driver.close();
}
}

Comments