Recall & Review
beginner
What Selenium WebDriver method is used to get the current page title?
The
driver.title property returns the current page title as a string.Click to reveal answer
beginner
How do you retrieve the current URL of the page in Selenium WebDriver using Python?
Use the
driver.current_url property to get the URL of the current page as a string.Click to reveal answer
beginner
Why is it useful to check the page title and URL during automated testing?
Checking the page title and URL helps verify that the browser has navigated to the correct page, ensuring the test is on the right track.
Click to reveal answer
beginner
Write a simple Python Selenium code snippet to print the page title and URL.
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://example.com')
print(f"Title: {driver.title}")
print(f"URL: {driver.current_url}")
driver.quit()Click to reveal answer
intermediate
What will
driver.title return if the page has no title tag?It will return an empty string
'' if the page does not have a title tag.Click to reveal answer
Which Selenium WebDriver property gives you the current page URL?
✗ Incorrect
The correct property is
driver.current_url. The others do not exist in Selenium WebDriver.What does
driver.title return?✗ Incorrect
driver.title returns the current page's title as a string.Why might you check the page title in a test?
✗ Incorrect
Checking the page title helps confirm the test navigated to the correct page.
Which of these is the correct way to get the page title in Selenium Python?
✗ Incorrect
driver.title is the correct property to get the page title.What will
driver.current_url return after navigating to 'https://example.com'?✗ Incorrect
driver.current_url returns the full URL of the current page.Explain how to retrieve and verify the page title and URL using Selenium WebDriver in Python.
Think about properties of the driver object that hold page info.
You got /4 concepts.
Describe why checking the page title and URL is important in automated web testing.
Consider what could go wrong if you don't check these.
You got /4 concepts.