- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to obtain the page title using Selenium webdriver?
We can obtain the page title using Selenium webdriver. The method getTitle() is used to obtain the present page title and then we can get the result in the console.
Syntax
t = driver.getTitle();
Let us find the title of the current page. We shall get About Careers at Tutorials Point – Tutorialspoint as output.
Example
Code Implementation.
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class PageTitle{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); WebDriver driver = new ChromeDriver(); //application launch driver.get("https://www.tutorialspoint.com/about/about_careers.htm"); // getTitle() to obtain page title System.out.println("Page title is : " + driver.getTitle()); driver.close(); } }
Output
- Related Articles
- Get page title with Selenium WebDriver using Java.
- How to set Page Load Timeout using C# using Selenium WebDriver?
- How to know the exact time to load a page using Selenium WebDriver?
- How to scroll the Page up or down in Selenium WebDriver using java?
- How to scroll down the page till page end in the Selenium WebDriver?
- Getting the URL of the current page using Selenium WebDriver.
- How to obtain the tagname of the parent element in Selenium webdriver?
- How can I scroll a web page using selenium webdriver in python?
- How to scroll a Web Page using coordinates of a WebElement in Selenium WebDriver?
- How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?
- How to Scroll Down or UP a Page in Selenium Webdriver?
- How to get the title and URL of the page in Selenium with python?
- How to navigate back to current page from Frame in selenium webdriver?
- How to Verify Tooltip using Selenium WebDriver?
- How to upload files using Selenium Webdriver?

Advertisements