0
0
Selenium Pythontesting~10 mins

Why CI integration enables continuous testing 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 a Selenium WebDriver for Chrome.

Selenium Python
driver = webdriver.[1]()
Drag options to blanks, or click blank then click option'
AFirefox
BEdge
CSafari
DChrome
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firefox instead of Chrome when Chrome is required.
2fill in blank
medium

Complete the code to check if the page title contains the word 'Home'.

Selenium Python
assert 'Home' [1] driver.title
Drag options to blanks, or click blank then click option'
Anot in
Bin
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which checks for exact match instead of containment.
3fill in blank
hard

Fix the error in the code to wait until an element with id 'submit' is clickable.

Selenium Python
WebDriverWait(driver, 10).until(EC.[1]((By.ID, 'submit')))
Drag options to blanks, or click blank then click option'
Apresence_of_element_located
Bvisibility_of_element_located
Celement_to_be_clickable
Dalert_is_present
Attempts:
3 left
💡 Hint
Common Mistakes
Using presence_of_element_located which only checks if element is in DOM.
4fill in blank
hard

Fill both blanks to create a test function that uses pytest and asserts page title.

Selenium Python
def test_title(driver):
    driver.get('http://example.com')
    assert [1] [2] 'Example Domain'
Drag options to blanks, or click blank then click option'
Adriver.title
B==
Cin
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'in' instead of '==' when exact match is needed.
5fill in blank
hard

Fill all three blanks to define a pytest fixture that initializes and quits the WebDriver.

Selenium Python
import pytest

@pytest.fixture
 def driver():
    driver = webdriver.[1]()
    yield [2]
    [3].quit()
Drag options to blanks, or click blank then click option'
AChrome
Bdriver
DFirefox
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.