Get Title
To get the title of the webpage using Selenium for Python, read the title property of WebDriver object.
driver.title
Example
- Initialise Chrome Web Driver object as
driver
. - Get the URL
https://pythonexamples.org/
using webdriver
object. - Read title property of the web
driver
object tomy_title
variable. - Print the title to console.
Python Program
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
# Setup chrome driver
service = ChromeService(executable_path="/usr/local/bin/chromedriver")
driver = webdriver.Chrome(service=service)
driver.get('https://pythonexamples.org/')
my_title = driver.title
print(my_title)
# Minimize the browser window
driver.quit()
Output
Python Examples – Learn Python Programming - Python Examples
![](https://pythonexamples.org/wp-content/uploads/2022/06/python-selenium-get-title-1.png)
Summary
In this Python Selenium Tutorial, we learned how to get the title of the webpage using WebDriver object.