Skip to content

Selenium interview questions — Easy

251 easy-level Selenium questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.

What this covers

Selenium appears throughout Automation Testing interviews. At easy level, interviewers are typically checking that you know the fundamentals and can describe them precisely — definitions, defaults, and the basic mechanics. Work through these, then explain your answer out loud; the second part is what interviews actually test.

20 example questions

  1. 1. Which of the following best describes desired capabilities / Options classes in Selenium?

    • A. Switches control to a JavaScript alert/confirm/prompt.
    • B. Simulates the browser back button.
    • C. Configure browser-specific settings such as headless mode.correct
    • D. Interface used to capture screenshots during execution.

    Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.

  2. 2. What is the purpose of driver.findElement(By.id(...)) in Selenium?

    • A. Closes only the current window.
    • B. Simulates the browser back button.
    • C. Returns the first element matching the ID locator or throws NoSuchElementException.correct
    • D. Explicit wait that polls until an ExpectedCondition is satisfied.

    Why: driver.findElement(By.id(...)): Returns the first element matching the ID locator or throws NoSuchElementException.

  3. 3. In the context of Selenium, driver.quit() is best described as:

    • A. Returns the first element matching the ID locator or throws NoSuchElementException.
    • B. Configure browser-specific settings such as headless mode.
    • C. Closes all windows and ends the WebDriver session.correct
    • D. Identifiers used to switch between browser tabs/windows.

    Why: driver.quit(): Closes all windows and ends the WebDriver session.

  4. 4. In Selenium, what does driver.switchTo().alert() do or refer to?

    • A. Switches control to a JavaScript alert/confirm/prompt.correct
    • B. Explicit wait that polls until an ExpectedCondition is satisfied.
    • C. Condition that waits until an element is visible and enabled.
    • D. Locator strategy using CSS selector syntax.

    Why: driver.switchTo().alert(): Switches control to a JavaScript alert/confirm/prompt.

  5. 5. In Selenium, what does ExpectedConditions.elementToBeClickable do or refer to?

    • A. Explicit wait that polls until an ExpectedCondition is satisfied.
    • B. Switches control to a JavaScript alert/confirm/prompt.
    • C. Closes only the current window.
    • D. Condition that waits until an element is visible and enabled.correct

    Why: ExpectedConditions.elementToBeClickable: Condition that waits until an element is visible and enabled.

  6. 6. What is the purpose of desired capabilities / Options classes in Selenium?

    • A. Configure browser-specific settings such as headless mode.correct
    • B. Explicit wait that polls until an ExpectedCondition is satisfied.
    • C. Closes only the current window.
    • D. Locator strategy using CSS selector syntax.

    Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.

  7. 7. What is the purpose of driver.switchTo().alert() in Selenium?

    • A. Closes all windows and ends the WebDriver session.
    • B. Switches control to a JavaScript alert/confirm/prompt.correct
    • C. Reads the current value attribute of an element.
    • D. Closes only the current window.

    Why: driver.switchTo().alert(): Switches control to a JavaScript alert/confirm/prompt.

  8. 8. Which of the following best describes getAttribute("value") in Selenium?

    • A. Identifiers used to switch between browser tabs/windows.
    • B. Interface used to capture screenshots during execution.
    • C. Locator strategy using CSS selector syntax.
    • D. Reads the current value attribute of an element.correct

    Why: getAttribute("value"): Reads the current value attribute of an element.

  9. 9. Which of the following best describes driver.findElement(By.id(...)) in Selenium?

    • A. Closes all windows and ends the WebDriver session.
    • B. Returns the first element matching the ID locator or throws NoSuchElementException.correct
    • C. Configure browser-specific settings such as headless mode.
    • D. Explicit wait that polls until an ExpectedCondition is satisfied.

    Why: driver.findElement(By.id(...)): Returns the first element matching the ID locator or throws NoSuchElementException.

  10. 10. Which of the following best describes driver.switchTo().alert() in Selenium?

    • A. Explicit wait that polls until an ExpectedCondition is satisfied.
    • B. Condition that waits until an element is visible and enabled.
    • C. Closes all windows and ends the WebDriver session.
    • D. Switches control to a JavaScript alert/confirm/prompt.correct

    Why: driver.switchTo().alert(): Switches control to a JavaScript alert/confirm/prompt.

  11. 11. What is the purpose of ExpectedConditions.elementToBeClickable in Selenium?

    • A. Returns the first element matching the ID locator or throws NoSuchElementException.
    • B. Simulates the browser back button.
    • C. Condition that waits until an element is visible and enabled.correct
    • D. Closes all windows and ends the WebDriver session.

    Why: ExpectedConditions.elementToBeClickable: Condition that waits until an element is visible and enabled.

  12. 12. Which of the following best describes WebDriverWait in Selenium?

    • A. Locator strategy using CSS selector syntax.
    • B. Configure browser-specific settings such as headless mode.
    • C. Simulates the browser back button.
    • D. Explicit wait that polls until an ExpectedCondition is satisfied.correct

    Why: WebDriverWait: Explicit wait that polls until an ExpectedCondition is satisfied.

  13. 13. In Selenium, what does driver.findElement(By.id(...)) do or refer to?

    • A. Reads the current value attribute of an element.
    • B. Explicit wait that polls until an ExpectedCondition is satisfied.
    • C. Returns the first element matching the ID locator or throws NoSuchElementException.correct
    • D. Identifiers used to switch between browser tabs/windows.

    Why: driver.findElement(By.id(...)): Returns the first element matching the ID locator or throws NoSuchElementException.

  14. 14. Which of the following best describes ExpectedConditions.elementToBeClickable in Selenium?

    • A. Identifiers used to switch between browser tabs/windows.
    • B. Interface used to capture screenshots during execution.
    • C. Condition that waits until an element is visible and enabled.correct
    • D. Explicit wait that polls until an ExpectedCondition is satisfied.

    Why: ExpectedConditions.elementToBeClickable: Condition that waits until an element is visible and enabled.

  15. 15. In Selenium, what does driver.quit() do or refer to?

    • A. Explicit wait that polls until an ExpectedCondition is satisfied.
    • B. Configure browser-specific settings such as headless mode.
    • C. Closes all windows and ends the WebDriver session.correct
    • D. Simulates the browser back button.

    Why: driver.quit(): Closes all windows and ends the WebDriver session.

  16. 16. Which of the following best describes driver.close() in Selenium?

    • A. Returns the first element matching the ID locator or throws NoSuchElementException.
    • B. Closes only the current window.correct
    • C. Locator strategy using CSS selector syntax.
    • D. Simulates the browser back button.

    Why: driver.close(): Closes only the current window.

  17. 17. In Selenium, what does window handles do or refer to?

    • A. Simulates the browser back button.
    • B. Interface used to capture screenshots during execution.
    • C. Reads the current value attribute of an element.
    • D. Identifiers used to switch between browser tabs/windows.correct

    Why: window handles: Identifiers used to switch between browser tabs/windows.

  18. 18. Selenium 4 replaced DesiredCapabilities with:

    • A. Browser-specific Options classes.correct
    • B. A global XML config.
    • C. Hard-coded JSON.
    • D. Nothing.

    Why: Selenium 4 uses W3C-compliant Options classes (ChromeOptions, etc.).

  19. 19. What is the purpose of WebDriverWait in Selenium?

    • A. Reads the current value attribute of an element.
    • B. Configure browser-specific settings such as headless mode.
    • C. Condition that waits until an element is visible and enabled.
    • D. Explicit wait that polls until an ExpectedCondition is satisfied.correct

    Why: WebDriverWait: Explicit wait that polls until an ExpectedCondition is satisfied.

  20. 20. In Selenium, what does getAttribute("value") do or refer to?

    • A. Returns the first element matching the ID locator or throws NoSuchElementException.
    • B. Identifiers used to switch between browser tabs/windows.
    • C. Locator strategy using CSS selector syntax.
    • D. Reads the current value attribute of an element.correct

    Why: getAttribute("value"): Reads the current value attribute of an element.

Related Automation Testing topics