0
0
Selenium Javatesting~10 mins

Why CI integration enables continuous testing in Selenium Java - Test Your Understanding

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

Complete the code to start a Selenium WebDriver for Chrome.

Selenium Java
WebDriver driver = new [1]();
Drag options to blanks, or click blank then click option'
AFirefoxDriver
BChromeDriver
CEdgeDriver
DSafariDriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxDriver when ChromeDriver is needed.
Forgetting to import the correct driver class.
2fill in blank
medium

Complete the code to assert the page title is 'Home Page' after loading.

Selenium Java
assertEquals("Home Page", driver.[1]());
Drag options to blanks, or click blank then click option'
AgetTitle
BgetCurrentUrl
CgetPageSource
DgetWindowHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Using getCurrentUrl() which returns the URL, not the title.
Using getPageSource() which returns the HTML source.
3fill in blank
hard

Fix the error in the test annotation to enable JUnit 5 test execution.

Selenium Java
@[1]
public void testLogin() {
    // test code
}
Drag options to blanks, or click blank then click option'
AAfterAll
BBeforeEach
CTest
DTestMethod
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@TestMethod' which is not a valid JUnit 5 annotation.
Confusing test annotations with setup or teardown annotations.
4fill in blank
hard

Fill both blanks to wait up to 10 seconds for an element with id 'submit' to be clickable.

Selenium Java
WebDriverWait wait = new WebDriverWait(driver, Duration.[1](10));
wait.until(ExpectedConditions.[2](By.id("submit")));
Drag options to blanks, or click blank then click option'
AofSeconds
BvisibilityOfElementLocated
CelementToBeClickable
DofMinutes
Attempts:
3 left
💡 Hint
Common Mistakes
Using ofMinutes instead of ofSeconds for duration.
Using visibilityOfElementLocated which waits only for visibility.
5fill in blank
hard

Fill all three blanks to create a map of test names to their pass status, filtering only passed tests.

Selenium Java
Map<String, Boolean> passedTests = testResults.entrySet().stream()
    .filter(e -> e.getValue() [1] true)
    .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue() [2] true));

System.out.println(passedTests.[3]());
Drag options to blanks, or click blank then click option'
A==
Csize
Dequals
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'equals' to compare primitive booleans.
Using 'count()' instead of 'size()' on a Map.