0
0
Selenium Pythontesting~10 mins

Python environment setup 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 import the Selenium WebDriver module.

Selenium Python
from selenium import [1]
Drag options to blanks, or click blank then click option'
Abrowser
Bdriver
Cwebdriver
Dselenium
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'driver' instead of 'webdriver' causes import errors.
Trying to import 'selenium' directly does not give access to WebDriver.
2fill in blank
medium

Complete the code to create a Chrome WebDriver instance.

Selenium Python
driver = webdriver.[1]()
Drag options to blanks, or click blank then click option'
AChrome
BFirefox
CSafari
DEdge
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Firefox' when intending to launch Chrome.
Misspelling the browser name causes runtime errors.
3fill in blank
hard

Fix the error in the code to open a webpage with Selenium.

Selenium Python
driver.get([1])
Drag options to blanks, or click blank then click option'
A'https://example.com'
Bhttps://example.com
C'example.com'
Dexample.com
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causes syntax errors.
Leaving out the protocol (https://) may cause navigation errors.
4fill in blank
hard

Fill both blanks to wait 5 seconds before closing the browser.

Selenium Python
import time

time.[1](5)
driver.[2]()
Drag options to blanks, or click blank then click option'
Asleep
Bwait
Cclose
Dquit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'wait' instead of 'sleep' causes attribute errors.
Using 'close()' only closes one tab, not the whole browser.
5fill in blank
hard

Fill all three blanks to find an element by its ID and click it.

Selenium Python
from selenium.webdriver.common.by import [1]
element = driver.find_element([2], [3])
element.click()
Drag options to blanks, or click blank then click option'
ABy
BBy.ID
C'submit-button'
D'submit'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the string 'By.ID' instead of the enum By.ID.
Providing wrong or incomplete ID strings.