Challenge - 5 Problems
Docker Selenium Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Selenium test inside Docker container
Consider this Selenium Java test code running inside a Docker container with ChromeDriver. What will be the output printed to the console?
Selenium Java
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class DockerSeleniumTest { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"); WebDriver driver = new ChromeDriver(); driver.get("https://example.com"); String title = driver.getTitle(); System.out.println(title); driver.quit(); } }
Attempts:
2 left
💡 Hint
Think about what the test does after opening the page inside Docker with ChromeDriver.
✗ Incorrect
The test opens https://example.com inside the Docker container using ChromeDriver and prints the page title. Since the container has Chrome and ChromeDriver properly installed, the output is the page title 'Example Domain'.
❓ assertion
intermediate1:30remaining
Correct assertion for page title in Docker Selenium test
Which assertion correctly verifies the page title is 'Welcome' in a Selenium Java test running inside Docker?
Selenium Java
String actualTitle = driver.getTitle();
Attempts:
2 left
💡 Hint
Use the correct JUnit assertion method for string equality.
✗ Incorrect
assertEquals("Welcome", actualTitle) correctly compares the expected string with the actual title. Using '==' compares references, which is incorrect for strings.
❓ locator
advanced1:30remaining
Best locator strategy for dynamic element in Docker Selenium test
Inside a Docker Selenium test, which locator is best to find a button with changing id but fixed visible text 'Submit'?
Attempts:
2 left
💡 Hint
Choose a locator that relies on stable visible text rather than dynamic attributes.
✗ Incorrect
Using XPath with the button's visible text is reliable when the id changes dynamically. Locators by id or name may fail if those attributes change.
🔧 Debug
advanced2:00remaining
Identify cause of WebDriver timeout in Docker Selenium test
A Selenium test running inside Docker fails with a timeout waiting for element located by By.id("login"). What is the most likely cause?
Attempts:
2 left
💡 Hint
Consider what happens if the element is not present on the page.
✗ Incorrect
Timeout waiting for element usually means the element is not present or visible. Network or version issues cause different errors. Syntax errors cause compile or runtime exceptions.
❓ framework
expert2:30remaining
Best practice for parallel Selenium tests in Docker environment
Which approach is best to run multiple Selenium tests in parallel inside Docker containers to avoid session conflicts?
Attempts:
2 left
💡 Hint
Think about isolation and scalability for parallel tests.
✗ Incorrect
Selenium Grid with multiple containers allows isolated browser sessions for parallel tests. Sharing one instance causes conflicts. Sequential runs do not achieve parallelism.