0
0
Selenium Pythontesting~10 mins

Opening URLs (get) 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 open the URL 'https://example.com' using Selenium WebDriver.

Selenium Python
from selenium import webdriver

driver = webdriver.Chrome()
driver.[1]('https://example.com')
Drag options to blanks, or click blank then click option'
Aget
Bnavigate
Copen
Dvisit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'open' instead of 'get' causes an AttributeError.
Using 'navigate' or 'visit' are not valid WebDriver methods.
2fill in blank
medium

Complete the code to open the URL stored in the variable 'url' using Selenium WebDriver.

Selenium Python
from selenium import webdriver

url = 'https://openai.com'
driver = webdriver.Firefox()
driver.[1](url)
Drag options to blanks, or click blank then click option'
Aopen_url
Bget
Cnavigate_to
Dload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'navigate_to' or 'open_url' which are not Selenium methods.
Using 'load' which is not a valid WebDriver method.
3fill in blank
hard

Fix the error in the code to correctly open 'https://test.com' using Selenium WebDriver.

Selenium Python
from selenium import webdriver

driver = webdriver.Edge()
driver.[1]('https://test.com')
Drag options to blanks, or click blank then click option'
Aget
Bopen
Cgo_to
Dvisit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'open' causes AttributeError: 'WebDriver' object has no attribute 'open'.
Using 'go_to' or 'visit' are invalid method names.
4fill in blank
hard

Fill both blanks to open 'https://mysite.com' and then close the browser.

Selenium Python
from selenium import webdriver

driver = webdriver.Chrome()
driver.[1]('https://mysite.com')
driver.[2]()
Drag options to blanks, or click blank then click option'
Aget
Bstart
Cquit
Dclose
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'get' to open URL.
Using 'close' instead of 'quit' which only closes one window.
5fill in blank
hard

Fill all three blanks to open 'https://learn.com', wait 5 seconds, and then close the browser.

Selenium Python
from selenium import webdriver
import time

driver = webdriver.Firefox()
driver.[1]('https://learn.com')
time.[2](5)
driver.[3]()
Drag options to blanks, or click blank then click option'
Aget
Bsleep
Cquit
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'wait' instead of 'sleep' which causes AttributeError.
Using 'close' instead of 'quit' which only closes one window.