FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 652   



getTitle() :

It is one of the WebDriver method. It gets title of the current page.

Example:

package com.selenium.practise;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class VerficationTitle {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "E:\\Soft Wares\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.google.com/");
        String title=driver.getTitle();
        if("Google".equals(title)){
           System.out.println("Verification is success" );    //verifying the page title
           System.out.println("page title is:" + title );
        }
        else{
            System.out.println("Verification is failed ");
        }
        driver.close();
    }
}

output :
Verification is success
page title is:Google





On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News