Challenge - 5 Problems
Selenium Script Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Selenium script?
Consider this Selenium Python script that opens a webpage and prints the page title. What will be printed?
Selenium Python
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By service = Service('/path/to/chromedriver') driver = webdriver.Chrome(service=service) driver.get('https://example.com') print(driver.title) driver.quit()
Attempts:
2 left
💡 Hint
The title is the text inside the tag of the webpage.
✗ Incorrect
The script opens https://example.com and prints the page title, which is 'Example Domain'.
❓ locator
intermediate1:30remaining
Which locator correctly finds the login button by its ID?
You want to click a login button with the HTML: . Which Selenium locator is correct?
Attempts:
2 left
💡 Hint
ID is a unique attribute and should be accessed with By.ID.
✗ Incorrect
The button has an ID 'loginBtn', so By.ID with 'loginBtn' is the correct locator.
❓ assertion
advanced1:30remaining
Which assertion correctly verifies the page title is 'Dashboard'?
After logging in, you want to check the page title is exactly 'Dashboard'. Which assertion is correct?
Selenium Python
title = driver.title
Attempts:
2 left
💡 Hint
Use equality to check exact match.
✗ Incorrect
To verify the title is exactly 'Dashboard', use assert title == 'Dashboard'.
🔧 Debug
advanced2:00remaining
What error does this Selenium script raise?
This script tries to find an element but has a mistake. What error occurs?
Selenium Python
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By service = Service('/path/to/chromedriver') driver = webdriver.Chrome(service=service) driver.get('https://example.com') element = driver.find_element(By.ID, 'nonexistent') driver.quit()
Attempts:
2 left
💡 Hint
The element ID does not exist on the page.
✗ Incorrect
Trying to find an element that does not exist raises NoSuchElementException.
❓ framework
expert2:30remaining
Which code snippet correctly waits for an element to be clickable before clicking?
You want to wait up to 10 seconds for a button with ID 'submitBtn' to be clickable, then click it. Which code is correct?
Attempts:
2 left
💡 Hint
Use explicit wait for element to be clickable.
✗ Incorrect
Option D uses explicit wait with element_to_be_clickable condition, which waits until the button is ready to be clicked.