0
0
Testing Fundamentalstesting~10 mins

Transitioning to automation in Testing Fundamentals - Interactive Code Practice

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

Complete the code to start a simple automated test using Selenium WebDriver in Python.

Testing Fundamentals
from selenium import webdriver

driver = webdriver.Chrome()
driver.get([1])
driver.quit()
Drag options to blanks, or click blank then click option'
Aexample.com
B'https://example.com'
Chttps://example.com
Dhttp://example
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the URL string.
Using an incomplete or invalid URL.
2fill in blank
medium

Complete the code to assert that the page title contains the word 'Example'.

Testing Fundamentals
assert 'Example' [1] driver.title
Drag options to blanks, or click blank then click option'
Ain
B==
Cnot in
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which checks for exact equality, not substring.
Using '!=' which checks for inequality.
3fill in blank
hard

Fix the error in the Selenium test code to correctly find an element by its ID.

Testing Fundamentals
element = driver.find_element_by_[1]('submit-button')
Drag options to blanks, or click blank then click option'
Aname
Bclass_name
Cid
Dtag_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or 'class_name' when the element's ID is needed.
Using deprecated or incorrect locator types.
4fill in blank
hard

Complete the code to create a dictionary comprehension that maps test names to their pass status if the status is True.

Testing Fundamentals
passed_tests = {test: status for test, status in test_results.items() if status [1] True}
Drag options to blanks, or click blank then click option'
A:
B==
C!=
D,
Attempts:
3 left
💡 Hint
Common Mistakes
Using ',' instead of ':' in the dictionary comprehension.
Using '!=' instead of '==' in the if condition.
5fill in blank
hard

Fill all three blanks to create a filtered dictionary of tests with duration greater than 5 seconds.

Testing Fundamentals
slow_tests = { [1] : [2] for [3], [2] in tests.items() if [2] > 5 }
Drag options to blanks, or click blank then click option'
Atest_name
Bduration
Ctest
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names causing syntax errors.
Using wrong variable names that do not match the loop variables.