Skip to content

Making Headlines Problem


Fetch the headline of Selenium Playground's home page. Specifically, retrieve the text outlined in red, below.

Homepage Header Image

Remember you can use the Inspect tool in your browser to view the source code for any HTML element!

Starter code

from selenium import webdriver

# Instantiate a WebDriver
driver = webdriver.Chrome()
driver.get("https://seleniumplayground.practiceprobs.com/")

# Your Code here
Hint
  1. Fetch the target HTML element using the WebDriver.find_element() method.
  2. Use the WebElement.get_attribute() method to extract the text.

See the solution