Lecture

Coding Quiz

This coding quiz involves writing a program to extract h1 tags (main titles) from a web page using the selenium library.

Complete the solution function in the code editor to extract the title of the web page from the given URL.

Coding Quiz Template
from selenium import webdriver def solution(url): # Create Chrome WebDriver driver = webdriver.Chrome() # Write your code here

Hints

  • You can open the web page using driver.get(url).

  • You can extract the title of the web page using page_title = driver.title.

  • You can close the web driver using the driver.quit() function.


Click the view solution button at the bottom right for an example of the function.

Based on what you've learned so far, write a program to extract the title from a web page and check if it passes the test.




Input and Output Examples

Example 1


Example 2

Mission
0 / 1

You can extract the contents of an h1 tag from a web page using requests and BeautifulSoup.

True
False

Lecture

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help