0
0
Selenium Pythontesting~10 mins

Why browser control is the foundation 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 open a browser using Selenium.

Selenium Python
from selenium import webdriver

browser = webdriver.[1]()
browser.get('https://example.com')
Drag options to blanks, or click blank then click option'
AFirefox
BChrome
CSafari
DEdge
Attempts:
3 left
💡 Hint
Common Mistakes
Using a browser name not supported or misspelled.
2fill in blank
medium

Complete the code to find an element by its ID.

Selenium Python
element = browser.find_element_by_[1]('submit-button')
Drag options to blanks, or click blank then click option'
Aname
Bid
Cclass_name
Dtag_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or 'class_name' when the element's ID is needed.
3fill in blank
hard

Fix the error in the code to click a button.

Selenium Python
button = browser.find_element_by_id('login')
button.[1]()
Drag options to blanks, or click blank then click option'
Asend_keys
Bsubmit
Cclick
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'submit' on a button element instead of 'click'.
4fill in blank
hard

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

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(browser, 10)
element = wait.until(EC.[1]((By.[2], 'submit')))
element.click()
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.
5fill in blank
hard

Fill all three blanks to write a test that opens a browser, navigates, and asserts the page title.

Selenium Python
from selenium import webdriver

browser = webdriver.[1]()
browser.get('https://example.com')
assert browser.title [2] 'Example Domain'
browser.[3]()
Drag options to blanks, or click blank then click option'
AChrome
B==
Cquit
DFirefox
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' in assertion.
Forgetting to close the browser.