0
0
Selenium Pythontesting~10 mins

Page title and URL retrieval in Selenium Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the page title using Selenium WebDriver.

Selenium Python
title = driver.[1]
Drag options to blanks, or click blank then click option'
Aget_title()
Btitle
Cpage_source
Dcurrent_url
Attempts:
3 left
💡 Hint
Common Mistakes
Using driver.get_title() which is not a valid method.
Trying to get the URL instead of the title.
2fill in blank
medium

Complete the code to get the current URL of the page using Selenium WebDriver.

Selenium Python
url = driver.[1]
Drag options to blanks, or click blank then click option'
Acurrent_url
Burl
Cpage_source
Dget_url()
Attempts:
3 left
💡 Hint
Common Mistakes
Using driver.get_url() which is not a valid method.
Trying to get the page title instead of the URL.
3fill in blank
hard

Fix the error in the code to correctly print the page title.

Selenium Python
print(driver.[1])
Drag options to blanks, or click blank then click option'
Aget_title
Bcurrent_url
Ctitle
Dpage_source
Attempts:
3 left
💡 Hint
Common Mistakes
Calling driver.title() as if it were a method.
Using driver.get_title() which does not exist.
4fill in blank
hard

Fill both blanks to store the page title and URL in variables.

Selenium Python
page_title = driver.[1]
page_url = driver.[2]
Drag options to blanks, or click blank then click option'
Atitle
Bcurrent_url
Cpage_source
Durl
Attempts:
3 left
💡 Hint
Common Mistakes
Using url instead of current_url.
Trying to call these as methods with parentheses.
5fill in blank
hard

Fill all three blanks to print the page title and URL, then assert the URL contains 'example'.

Selenium Python
print('Title:', driver.[1])
print('URL:', driver.[2])
assert 'example' [3] driver.current_url
Drag options to blanks, or click blank then click option'
Atitle
Bcurrent_url
Cin
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of 'in' for substring check.
Calling title or current_url as methods.