0
0
Selenium Javatesting~20 mins

WebDriverManager for automatic driver management in Selenium Java - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
WebDriverManager Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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();
    }
}
APrints an empty string and keeps the browser open
BThrows IllegalStateException because driver executable path is not set
CThrows NullPointerException when calling getTitle()
DPrints the title of https://example.com and closes the browser without errors
Attempts:
2 left
💡 Hint
WebDriverManager automatically downloads and sets the driver executable path.
assertion
intermediate
1: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?
AassertNotNull(title);
BassertTrue(title.contains("Example Domain"));
CassertEquals("Example Domain", title);
DassertFalse(title.isEmpty());
Attempts:
2 left
💡 Hint
Exact match is required, not just containment or non-null.
🔧 Debug
advanced
2: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();
    }
}
AIllegalStateException because driver executable path is not set
BNo error; code runs and prints the title
CNullPointerException when calling getTitle()
DCompilation error due to missing import
Attempts:
2 left
💡 Hint
Check if WebDriverManager setup() method is called.
🧠 Conceptual
advanced
1:30remaining
Why use WebDriverManager in Selenium tests?
Which is the main advantage of using WebDriverManager for driver management in Selenium tests?
AIt replaces the need for Selenium WebDriver API
BIt automatically downloads and configures the correct browser driver version
CIt provides a GUI to run Selenium tests
DIt speeds up browser rendering during tests
Attempts:
2 left
💡 Hint
Think about driver executable management.
framework
expert
2: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();
    }
}
A
@BeforeAll
public static void setup() {
    WebDriverManager.chromedriver().setup();
}
BInside testTitle() method before creating ChromeDriver instance
CIn a constructor of SeleniumTest class
DNo setup needed; WebDriverManager works automatically
Attempts:
2 left
💡 Hint
Setup should run once before all tests.