0
0
Selenium Pythontesting~10 mins

Why test frameworks structure execution in Selenium Python - Test Your Understanding

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

Complete the code to start the Selenium WebDriver for Chrome.

Selenium Python
from selenium import webdriver

driver = webdriver.[1]()
Drag options to blanks, or click blank then click option'
ASafari
BFirefox
CChrome
DEdge
Attempts:
3 left
💡 Hint
Common Mistakes
Using a browser name that is not installed or supported.
Forgetting to capitalize the browser name.
2fill in blank
medium

Complete the code to open a webpage using Selenium WebDriver.

Selenium Python
driver = webdriver.Chrome()
driver.[1]('https://example.com')
Drag options to blanks, or click blank then click option'
Aget
Bopen
Cnavigate
Dvisit
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that do not exist in Selenium WebDriver.
Confusing Selenium with other web automation tools.
3fill in blank
hard

Fix the error in the assertion to check the page title.

Selenium Python
assert driver.title [1] 'Example Domain'
Drag options to blanks, or click blank then click option'
A!=
B==
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using inequality operator instead of equality.
Using comparison operators like > or < which do not apply to strings here.
4fill in blank
hard

Fill both blanks to wait until an element is visible before interacting.

Selenium Python
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, 10)
element = wait.until(EC.[1]((By.[2], 'submit-button')))
Drag options to blanks, or click blank then click option'
Avisibility_of_element_located
Bpresence_of_element_located
CID
DCLASS_NAME
Attempts:
3 left
💡 Hint
Common Mistakes
Using presence_of_element_located which does not guarantee visibility.
Using wrong locator type like CLASS_NAME when the element has an id.
5fill in blank
hard

Fill all three blanks to create a test function that opens a page, checks title, and closes the browser.

Selenium Python
def test_open_page():
    driver = webdriver.Chrome()
    driver.[1]('https://example.com')
    assert driver.title [2] 'Example Domain'
    driver.[3]()
Drag options to blanks, or click blank then click option'
Aget
B==
Cquit
Dclose
Attempts:
3 left
💡 Hint
Common Mistakes
Using close which only closes one window but does not end session.
Using wrong assertion operators.