0
0
Selenium Javatesting~10 mins

Why framework design enables scalability 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 initialize the WebDriver for Chrome browser.

Selenium Java
WebDriver driver = new [1]();
Drag options to blanks, or click blank then click option'
AEdgeDriver
BFirefoxDriver
CSafariDriver
DChromeDriver
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 wait explicitly for an element to be visible.

Selenium Java
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.[1](ExpectedConditions.visibilityOfElementLocated(By.id("submitBtn")));
Drag options to blanks, or click blank then click option'
Auntil
BwaitFor
Ccheck
Dfind
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like waitFor or check.
Not using explicit waits causing flaky tests.
3fill in blank
hard

Fix the error in the test method annotation to enable test execution.

Selenium Java
@[1]
public void testLogin() {
    // test steps
}
Drag options to blanks, or click blank then click option'
ATest
Btest
CTestCase
DTestMethod
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase '@test' which is invalid.
Using '@TestCase' or '@TestMethod' which do not exist.
4fill in blank
hard

Fill both blanks to create a Page Object method that clicks a button by locator.

Selenium Java
public void clickButton() {
    driver.findElement([1]).[2]();
}
Drag options to blanks, or click blank then click option'
ABy.id("submitBtn")
Bclick
Csubmit
DBy.name("submit")
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'submit' instead of 'click' for the action.
Using wrong locator types or missing parentheses.
5fill in blank
hard

Fill all three blanks to create a test that asserts page title equals expected.

Selenium Java
String title = driver.[1]();
String expected = "Home Page";
assert[2](expected, title, "Title should match");
System.out.println("Page title is: " + [3]);
Drag options to blanks, or click blank then click option'
AgetTitle
BEquals
Ctitle
DassertEquals
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Equals' instead of 'assertEquals' for assertion.
Printing 'expected' instead of 'title'.