Unit 3: Selenium Locators - Subjective Questions

CSE377 — Web Automation Testing • Practice Questions with Detailed Answers

20 questions

1

Define locators in Selenium WebDriver. Explain why locators are important in automated web testing and describe the commonly used locator strategies.

2

Explain the difference between findElement() and findElements() in Selenium WebDriver with suitable examples.

3

Describe the Selenium WebElement interface and explain the commonly used methods for interacting with form elements.

4

Explain how to automate a form in Selenium WebDriver. Include the steps for locating fields, entering data, selecting controls, and submitting the form.

5

Explain how to click an image in Selenium WebDriver. What conditions must be satisfied for the click operation to work reliably?

6

Describe the method for selecting and validating checkboxes in Selenium WebDriver. How can a test avoid accidentally unchecking an already selected checkbox?

7

Explain how radio buttons are handled in Selenium WebDriver. Compare radio buttons with checkboxes in terms of behavior and automation.

8

Explain how to select a value from a standard HTML drop-down using Selenium WebDriver's Select class. Describe its main selection methods.

9

Compare locating elements by link text and partial link text in Selenium WebDriver. State their advantages, limitations, and appropriate use cases.

10

Explain the purpose of the Selenium Actions class. Describe how it can be used for mouse and keyboard interactions with examples.

11

Explain XPath in Selenium WebDriver. Distinguish between absolute XPath and relative XPath, and describe functions that make XPath useful for dynamic elements.

12

Develop a reliable strategy for creating XPath expressions for dynamic web elements. Include examples using contains(), starts-with(), text matching, and multiple attributes.

13

Explain how alerts are handled in Selenium WebDriver. Describe the operations required for simple alerts, confirmation alerts, and prompt alerts.

14

Explain how to handle popup windows or multiple browser windows in Selenium WebDriver. Describe the use of window handles.

15

Differentiate between a JavaScript alert, a browser window popup, and an HTML modal popup in Selenium WebDriver. Explain how each is handled.

16

Describe the process of finding broken links using Selenium WebDriver. Explain how HTTP response codes are used to identify broken links.

17

Write and explain a Selenium WebDriver approach for validating all links on a page, including handling null URLs, redirects, exceptions, and resource cleanup.

18

Explain how explicit waits improve the reliability of Selenium locator operations. Discuss why an element may be located successfully but still fail during interaction.

19

Compare different Selenium locator strategies in terms of speed, stability, readability, and maintainability. Recommend a locator priority order for a test project.

20

Explain the common exceptions related to Selenium locators and interactions. State the likely causes and suitable remedies for each exception.