Verify Title Of The Page using selenium WebDriver - Java HTML

Java examples for HTML:selenium

Description

Verify Title Of The Page using selenium WebDriver

Demo Code



import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Myfirstjava {

  public static void main(String[] args) throws InterruptedException {
    /*www. ja  va 2 s  . co  m*/

    WebDriver driver = new FirefoxDriver();

    driver.get("http://your server.com/");

    System.out.println(driver.getTitle());

    if (driver.getTitle().contentEquals("Welcome")) {
      System.out.println("Test Passed!");

    } else {
      System.out.println("Test failed");
    }

    Thread.sleep(5000);
    driver.close();

    System.exit(0);

  }

}

Related Tutorials