Challenge - 5 Problems
WebDriverManager Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of WebDriverManager setup code
What will be the output when running this Selenium Java code snippet using WebDriverManager?
Selenium Java
import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Test { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://example.com"); System.out.println(driver.getTitle()); driver.quit(); } }
Attempts:
2 left
💡 Hint
WebDriverManager automatically downloads and sets the driver executable path.
✗ Incorrect
WebDriverManager.chromedriver().setup() downloads the correct ChromeDriver and sets the system property. Then ChromeDriver launches the browser, navigates to the URL, and getTitle() returns the page title. No exceptions occur.
❓ assertion
intermediate1:30remaining
Correct assertion to verify page title with WebDriverManager
Which assertion correctly verifies that the page title is exactly "Example Domain" after navigating using WebDriverManager and Selenium?
Selenium Java
WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://example.com"); String title = driver.getTitle(); // Which assertion below is correct?
Attempts:
2 left
💡 Hint
Exact match is required, not just containment or non-null.
✗ Incorrect
assertEquals("Example Domain", title) checks that the title exactly matches the expected string. Other assertions are weaker or less precise.
🔧 Debug
advanced2:00remaining
Identify the error in WebDriverManager usage
What error will occur when running this code snippet?
Selenium Java
import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Test { public static void main(String[] args) { WebDriverManager.chromedriver(); WebDriver driver = new ChromeDriver(); driver.get("https://example.com"); System.out.println(driver.getTitle()); driver.quit(); } }
Attempts:
2 left
💡 Hint
Check if WebDriverManager setup() method is called.
✗ Incorrect
WebDriverManager.chromedriver() alone does not set up the driver. The setup() method must be called to download and set the driver path. Without it, ChromeDriver throws IllegalStateException.
🧠 Conceptual
advanced1:30remaining
Why use WebDriverManager in Selenium tests?
Which is the main advantage of using WebDriverManager for driver management in Selenium tests?
Attempts:
2 left
💡 Hint
Think about driver executable management.
✗ Incorrect
WebDriverManager automates downloading and setting the correct driver executable version, avoiding manual setup and version mismatch errors.
❓ framework
expert2:30remaining
Best practice for integrating WebDriverManager in JUnit 5 tests
Which code snippet correctly integrates WebDriverManager setup in a JUnit 5 test class to ensure the driver is ready before tests run?
Selenium Java
import io.github.bonigarcia.wdm.WebDriverManager; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumTest { static WebDriver driver; // Where to put WebDriverManager setup? @Test public void testTitle() { driver = new ChromeDriver(); driver.get("https://example.com"); System.out.println(driver.getTitle()); driver.quit(); } }
Attempts:
2 left
💡 Hint
Setup should run once before all tests.
✗ Incorrect
Using @BeforeAll static method ensures WebDriverManager sets up the driver once before any tests run, avoiding repeated setup or errors.