.
Question : How to Get the web page title ?
Get title Method : getTitle();
To verify page title in selenium webdriver we use getTitle() method .it is one of the webdriver method which is used to get the current page title.
Here , the simple steps given to verify the title of page.
Step-1 Use getTitle() method.
Step-2 Store the value in string.
Step-3 Declare your expected title in String.
Step-4 Now compare actual to expected.
Code : To get the Web page title in selenium
{ System.setProperty("webdriver.chrome.driver", "C:\\Software\\chromedriver.exe");
}
How to verify the web page title ?
Code : To verify the page title in selenium
{
In this tutorial we learn how to verify page title in selenium webdriver with various types .Hope this tutorial helpful for you 😊
Thanks & Regards
Sandeep Yadav
Important Tags : how to get the page title in selenium , how to verify the page title in selenium wrbdriver , how to verify page title in selenium webdriver using java
How to verify page title in selenium ?
Get title Method : getTitle();
To verify page title in selenium webdriver we use getTitle() method .it is one of the webdriver method which is used to get the current page title.
Here , the simple steps given to verify the title of page.
Step-1 Use getTitle() method.
Step-2 Store the value in string.
Step-3 Declare your expected title in String.
Step-4 Now compare actual to expected.
Code : To get the Web page title in selenium
package firstpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetPageTitle
{
public static void main(String[] args) throws InterruptedException
{ System.setProperty("webdriver.chrome.driver", "C:\\Software\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
String at =driver.getTitle();
String at =driver.getTitle();
System.out.println(at);
driver.close();
}
}
How to verify the web page title ?
Code : To verify the page title in selenium
package firstpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetPageTitle
{
public static void main(String[] args) throws InterruptedException
{
// TODO Auto-generated
method stub
System.setProperty("webdriver.chrome.driver", "C:\\Software\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
String at =driver.getTitle();
String at =driver.getTitle();
String et="Facebook
– log in or sign up";
if(at.equalsIgnoreCase(et))
System.out.println("Title
Matched");
else
System.out.println("Title
didn't match");
driver.close()
}
}
In this tutorial we learn how to verify page title in selenium webdriver with various types .Hope this tutorial helpful for you 😊
Thanks & Regards
Sandeep Yadav
Important Tags : how to get the page title in selenium , how to verify the page title in selenium wrbdriver , how to verify page title in selenium webdriver using java
How to verify page title in selenium ?
0 Comments