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. In the context of Selenium, desired capabilities / Options classes is best described as:
- A. Returns the first element matching the ID locator or throws NoSuchElementException.
- B. Reads the current value attribute of an element.
- C. Explicit wait that polls until an ExpectedCondition is satisfied.
- D. Configure browser-specific settings such as headless mode.correct
Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.
2. 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.
3. What is the purpose of driver.switchTo().alert() in Selenium?
- A. Interface used to capture screenshots during execution.
- B. Switches control to a JavaScript alert/confirm/prompt.correct
- C. Simulates the browser back button.
- D. Reads the current value attribute of an element.
Why: driver.switchTo().alert(): Switches control to a JavaScript alert/confirm/prompt.
4. In a QA certification mock exam: 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.).
5. Which of the following best describes window handles in Selenium?
- A. Returns the first element matching the ID locator or throws NoSuchElementException.
- B. Simulates the browser back button.
- C. Identifiers used to switch between browser tabs/windows.correct
- D. Explicit wait that polls until an ExpectedCondition is satisfied.
Why: window handles: Identifiers used to switch between browser tabs/windows.
6. What is the purpose of ExpectedConditions.elementToBeClickable in Selenium?
- A. Locator strategy using CSS selector syntax.
- B. Condition that waits until an element is visible and enabled.correct
- C. Configure browser-specific settings such as headless mode.
- D. Returns the first element matching the ID locator or throws NoSuchElementException.
Why: ExpectedConditions.elementToBeClickable: Condition that waits until an element is visible and enabled.
7. Which of the following best describes driver.findElement(By.id(...)) in Selenium?
- A. Returns the first element matching the ID locator or throws NoSuchElementException.correct
- B. Closes only the current window.
- C. Closes all windows and ends the WebDriver session.
- D. Configure browser-specific settings such as headless mode.
Why: driver.findElement(By.id(...)): Returns the first element matching the ID locator or throws NoSuchElementException.
8. In Selenium, what does driver.switchTo().alert() do or refer to?
- A. Reads the current value attribute of an element.
- B. Switches control to a JavaScript alert/confirm/prompt.correct
- C. Condition that waits until an element is visible and enabled.
- D. Closes only the current window.
Why: driver.switchTo().alert(): Switches control to a JavaScript alert/confirm/prompt.
9. What is the purpose of driver.findElement(By.id(...)) in Selenium?
- A. Simulates the browser back button.
- B. Closes all windows and ends the WebDriver session.
- C. Returns the first element matching the ID locator or throws NoSuchElementException.correct
- D. Condition that waits until an element is visible and enabled.
Why: driver.findElement(By.id(...)): Returns the first element matching the ID locator or throws NoSuchElementException.
10. What is the purpose of desired capabilities / Options classes in Selenium?
- A. Configure browser-specific settings such as headless mode.correct
- B. Returns the first element matching the ID locator or throws NoSuchElementException.
- C. Interface used to capture screenshots during execution.
- D. Closes only the current window.
Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.
11. 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.
12. Which of the following best describes driver.quit() in Selenium?
- A. Closes all windows and ends the WebDriver session.correct
- B. Reads the current value attribute of an element.
- C. Condition that waits until an element is visible and enabled.
- D. Identifiers used to switch between browser tabs/windows.
Why: driver.quit(): Closes all windows and ends the WebDriver session.
13. Which of the following best describes desired capabilities / Options classes in Selenium?
- A. Configure browser-specific settings such as headless mode.correct
- B. Identifiers used to switch between browser tabs/windows.
- C. Simulates the browser back button.
- D. Returns the first element matching the ID locator or throws NoSuchElementException.
Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.
14. 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.
15. In Selenium, what does desired capabilities / Options classes do or refer to?
- A. Identifiers used to switch between browser tabs/windows.
- B. Condition that waits until an element is visible and enabled.
- C. Interface used to capture screenshots during execution.
- D. Configure browser-specific settings such as headless mode.correct
Why: desired capabilities / Options classes: Configure browser-specific settings such as headless mode.
16. In Selenium, what does driver.quit() do or refer to?
- A. Reads the current value attribute of an element.
- B. Closes all windows and ends the WebDriver session.correct
- C. Returns the first element matching the ID locator or throws NoSuchElementException.
- D. Identifiers used to switch between browser tabs/windows.
Why: driver.quit(): Closes all windows and ends the WebDriver session.
17. What is the purpose of window handles in Selenium?
- A. Locator strategy using CSS selector syntax.
- B. Identifiers used to switch between browser tabs/windows.correct
- C. Returns the first element matching the ID locator or throws NoSuchElementException.
- D. Configure browser-specific settings such as headless mode.
Why: window handles: Identifiers used to switch between browser tabs/windows.
18. Which of the following best describes driver.close() in Selenium?
- A. Closes only the current window.correct
- B. Configure browser-specific settings such as headless mode.
- C. Locator strategy using CSS selector syntax.
- D. Interface used to capture screenshots during execution.
Why: driver.close(): Closes only the current window.
19. What is the purpose of WebDriverWait in Selenium?
- A. Locator strategy using CSS selector syntax.
- B. Switches control to a JavaScript alert/confirm/prompt.
- C. Configure browser-specific settings such as headless mode.
- D. Explicit wait that polls until an ExpectedCondition is satisfied.correct
Why: WebDriverWait: Explicit wait that polls until an ExpectedCondition is satisfied.
20. In Selenium, what does driver.navigate().back() do or refer to?
- A. Switches control to a JavaScript alert/confirm/prompt.
- B. Identifiers used to switch between browser tabs/windows.
- C. Closes all windows and ends the WebDriver session.
- D. Simulates the browser back button.correct
Why: driver.navigate().back(): Simulates the browser back button.