Top 45+ selenium interview questions 2023

Safalta Expert Published by: Vanshika Jakhar Updated Sun, 27 Nov 2022 12:46 AM IST

A critical stage of the software development life cycle (SDLC) is testing. In particular, manual testing involves physically running test cases against the applications to find bugs and errors. However, manual testing presented many difficulties, so an approach to automate the testing procedure was required. 

Here are the top 45 Selenium interview questions for both experienced and novice candidates if you're looking forward to a Selenium interview.

Free Demo Classes

Register here for Free Demo Classes


Boost your Skills by learning: Digital Marketing


1. What is the primary distinction between drivers? close() and driver. quit()?
  • The current window of the browser is closed by the driver.close() command. If more than one window is open, the one that is currently in focus will close.
  • When the driver instance's quit() method is called while one or more browser windows are open, all open browser windows are closed.

2. Why is Selenium a testing tool that is so widely used? cite arguments.
  • Selenium is simple to use because it was primarily created in JavaScript.
  • Selenium can test web applications using a variety of web browsers, including Firefox, Opera, Chrome, and Safari.
  • Different programming languages, including Java, Perl, Python, and PHP, can be used to create the test code.
  • Platform-independent, Selenium can be installed on a variety of operating systems, including Windows.

3. How do I use Selenium to click on a hyperlink?

By.linkText("Today's Deals"), driver.findElement

The command click() locates the element using the link text, clicks on it, and then directs the user to the corresponding page.

driver.findElement(By.partialLinkText(“Service”)).

click();- The partial link text() function finds the web element because the aforementioned command locates the element based on the substring of the link provided in the parenthesis.


4. What elements make up the Selenium suite?
  • To expedite the development of automation scripts, the Selenium IDE Chrome plug-in was created.
  • A server called Selenium Remote Control (RC) enables users to create application tests using a variety of programming languages.
  • Selenium WebDriver is a programming interface that facilitates the creation and execution of test cases.

5. What are the Selenium testing's restrictions?
  • Lack of technical support: Because Selenium is an open-source tool, it lacks a dedicated tech support team to address user issues.
  • Selenium only tests web applications; to test desktop and mobile applications, integration with third-party tools like Appium is required.
  • programming language knowledge may be necessary: Selenium WebDriver assumes that the user has a foundational understanding of programming.

6. What types of testing does Selenium support?
  • Regression testing and functional testing are supported by Selenium.
  • Regression testing is the process of re-running a full or partial selection of previously executed test cases to make sure that all functionalities are still in place.
  • Functional testing entails confirming that each application function adheres to the necessary specifications.

Download these Free EBooks:
1. Introduction to digital marketing
2. Website Planning and Creation


7. What distinguishes Selenium 2.0 from Selenium 3.0?
The tool Selenium 2.0 facilitates the creation of automated tests for web applications. It symbolizes the union of the WebDriver project and the original Selenium project.
The upgraded version of Selenium 2.0 is called Selenium 3.0. It is Selenium RC-free and is inherently backward compatible. The new version included numerous bug fixes and better stability.

8. What does the same-origin policy entail?
A feature called the Same Origin policy was implemented for security reasons. This policy states that as long as both pages share the same origin, a web browser will permit scripts from one webpage to access the content of another webpage.

9. Describe Selenese.
Selenium known as Selenese is used to test the web application. Using Selenese, the tester can test broken links, the existence of specific UI objects, Ajax functionality, alerts, windows, list options, and much more.

10. Why is Selenium a testing tool that is so widely used?
  • Selenium is simple to use because it was primarily created in JavaScript.
  • Selenium can test web applications using a variety of web browsers, including Firefox, Opera, Chrome, and Safari.
  • Selenium can be used on a variety of operating systems, including Windows, Linux, and Macintosh, as it is platform-independent.

11. Is Captcha automatable?
No, Captcha cannot be automated with Selenium. Selenium cannot automate it because the whole point of Captcha is to make sure that bots and automated programs don't access sensitive information.

12. How does Selenium deal with pop-up windows?
Selenium does not include native support for Windows-based features. To handle pop-ups, Selenium can be integrated with outside tools.

13. How does Selenium WebDriver choose a value from a dropdown?
The WebDriver Select class is used to select and deselect options in dropdown menus. The dropdown webElement can be passed as a parameter to the function of objects of the Select type to initialize them.

14. In the Selenium IDE, what does a pause on an exception mean?
By selecting the pause icon in the IDE's upper right corner, the user can use this feature to manage exceptions. The script pauses at that specific statement and switches into debug mode when it encounters an exception. Since the entire test case passes, the user can fix the mistake right away.

15. What is automation testing or test automation?
The process of controlling test execution and comparing the outcomes to expectations using specialized software is known as test automation. By automating repetitive tasks and freeing testers to concentrate on more important test cases, automation testing can help reduce the time, money, and effort needed to test software applications.

16. What benefits do automation tests offer?
Testing by automation has many benefits. The most obvious benefit is probably that you can save a tonne of time and effort. By automating repetitive tasks, such as running the same test cases repeatedly or across different browsers, automation testing can aid in accelerating the testing process.

17. List a few of the typical functional automation testing tools that are employed.
RFT, Silk Test, QTP, and Test Complete.

18. List a few of the typical non-functional automation testing tools that are used.
Neoload, Silk Performer, WebLoad, WebLoad, LoadRunner, and JMeter.

19. Name a few automation tools that Selenium could be integrated with to enable continuous testing.
To achieve continuous testing, several automation tools could be combined with Selenium, including:
Jenkins.
AWS CodePipeline, Azure DevOps, and Travis CI.

20. What does the statement in Selenium mean, exactly?
A method of determining whether a specific condition is true or false is to make an assertion. Assertions are used in Selenium to check the status of elements on a page or the outcomes of an action. 

21. Describe the distinctions between the commands assert and verify.
The assert command is used to determine whether or not the specified condition is true. The program's execution will continue if the condition is true. The program's execution will halt if the condition is false.

The verify command is used to determine whether or not the specified condition is true. The program's execution will continue if the condition is true. The program will continue to run even if the condition is false.

22. What do you mean by XPath?
Parts of an XML document can be addressed using the language XPath. It is a method used by XSLT and other XML-related technologies to access data in XML documents. An XML document's elements and attributes can be explored using XPath.

23. Explain XPath Absolute.
The two primary expression types in XPath are absolute and relative. The root element of the document is always indicated by the forward slash (/) at the beginning of an absolute expression. Expressions that are relative to the current context do not begin with a forward slash.

24 What makes "/" and "//" different in XPath?
In XPath, the distinction between "/" and "//" is that the former selects an element based on its absolute location, while the latter does so based on its relative location.

25. What kinds of annotations are there that are used in Selenium?
Selenium employs a variety of annotation types, including:
  • The annotation used to identify a method as a test method is called "test."
  • To run a method before each test method, use the BeforeMethod annotation.
  • Using the annotation "AfterMethod," a method is run following each test method.
  • A method can be run before the first test method using the beforeClass annotation.

26. What are WebDriver-supported Mobile Testing Drivers?
There are four primary mobile testing drivers that WebDriver supports:
  • Android applications are tested using AndroidDriver. It can be applied to actual hardware or emulators.
  • Applications for iOS are tested using IPhoneDriver. It can only be applied to actual hardware.
  • Mobile web application testing is done with RemoteWebDriver. Several browsers, including Safari, Chrome, and Firefox, can use it.
  • Android apps are tested using Selendroid. It can be applied to actual hardware or emulators.

27. What distinguishes type commands from type keys?
In computer programming, there is a distinction between type keys and type commands. Type commands are instructions given to the computer, whereas type keys are specific characters you type on the keyboard.

28. What distinguishes the commands "type" and "typeAndWait"?
Text can be entered into a field on a web page using the "type" command. The "typeAndWait" command enters text into a field as well, but it holds off on the next command until the page has loaded.

29. What is implicit waiting's main drawback?
Implicit wait's main drawback is that it can make your tests take longer to complete. This is so because the implicit wait time is always set to zero by default. As a result, your test will continue looking for an element for the duration of the implicit wait time if it is not found right away.

30. In Selenium WebDriver, how do we launch various browsers?
Through a variety of techniques, Selenium WebDriver allows us to launch various browsers. To specify the location of the executable file for the browser, for instance, we can use the setWebDriver() method. As an alternative, we can add a unique profile preference to the browser using the addCustomProfilePreference() method.

31. How can a web page be refreshed using WebDriver's various methods?
A web page can be refreshed in WebDriver in a few different ways. The "Refresh" button in the browser toolbar is the most widely used technique. As an alternative, you can also use the F5 key on your keyboard to perform a refresh. Furthermore, you can right-click the page and choose "Refresh" from the context menu by doing so. All of these techniques will force the page to reload, wiping out any modifications that had been made.

32. How does WebDriver invoke an application?
When using WebDriver, you can start programs either by using the "navigate" method or by calling the "get" method on the driver instance. However, to do so, you must first have the application's launch URL in hand. Simply pass in the application's URL as a string when utilizing the "get" method.

33. What advantages do automation tests offer?
The software testing process can be accelerated by using automation testing. You can avoid wasting time and resources on manual testing by automating some of the tests.

34. Does.NET support HTMLUnitDriver?
Yes.

35. How do you route a browser's browsing through a proxy?
The use of a web proxy is one option. Utilizing a Virtual Private Network (VPN) is another method of redirecting browsing. Finally, you can reroute your traffic by using a browser extension.

36. How do drag and drop actions work in WebDriver?
Drag and drop operations can be carried out with the help of WebDriver's Actions class. There are several methods in this class that can be used to carry out different tasks. The Actions class must first be instantiated with a WebDriver instance before it can be used. Once you have an Actions instance, you can drag and drop items using the drag and drop() method.

37. The number of languages does Selenium support?
Numerous programming languages, including C#, Java, PHP, Ruby, Python, Perl, JavaScript, etc., are supported by Selenium.

38. How can an element be located in various ways?
The various ways to find an element are as follows:
Title, CSS, Link text, PartialLink Text, and X-path are all options.

39. Explicit or implicit waiting—which is preferable?
Explicit waits are preferable to implicit ones. In contrast to an implicit wait, you can create your custom code or conditions for a wait before continuing the code.

40. What are browsers with increased privileges?
Similar to proxy injection, browsers with increased privileges allow websites to perform actions that are not typically permitted.

41. What is an object repository?
An essential component of any UI automation is an object repository, which enables a tester to keep all the objects they'll use in the scripts in one or more centralized locations rather than dispersed throughout the test scripts.

42. What Java API is necessary to generate PDF reports?
IText API.

43. What do Breakpoints and Start points in Selenium mean?
A breakpoint is set up to halt execution while testing whether the code is currently functioning as expected.

A starting point designates the starting point of the execution.

44. What makes Selenium a good test tool?
A lot of people use Selenium, a free and open-source tool. It supports all browsers and benefits communities. Additionally, it has excellent cross-platform compatibility.

45. Can we perform performance testing using the Selenium grid?
Yes, but Loadrunner, a specific performance testing tool, is more efficient.

46. Explain Page Factory.
With its excellent memory usage and object-oriented implementation, Page Factory offers an optimized way to implement the Page Object Model. These are the Selenium interview questions and responses that are most frequently asked. We hope that these Selenium interview questions will help you land the position of your dreams.

Is there hope for selenium's future?

The testing industry is constantly in need of talented testers who can assist with the quick release of new versions and the maintenance of the software. Automation testing is a cutting-edge field.

In 2022, will selenium be used?

Software testing optimization is expected to help organizations modernize their software development strategies. Due to this, the selenium framework will be crucial in 2022.

How much does selenium make?

A Selenium Automation Tester's annual salary in India is 7.0 lakhs, with salaries ranging from 4.0 lakhs to 15.0 lakhs.

Selenium: Is it becoming dated?

Selenium automation is still relevant today. It is becoming more important than ever.

Related Article

CTET Answer Key 2024: दिसंबर सत्र की सीटेट परीक्षा की उत्तर कुंजी जल्द होगी जारी, जानें कैसे कर सकेंगे डाउनलोड

Read More

CLAT 2025: दिल्ली उच्च न्यायालय ने एनएलयू को दिया क्लैट परीक्षा के नतीजों में संशोधन का आदेश, जानें पूरा मामला

Read More

UP Police: यूपी पुलिस भर्ती का आवेदन पत्र डाउनलोड करने का एक और मौका, यूपीपीआरपीबी ने फिर से सक्रिया किया लिंक

Read More

JEE Advanced 2025: जेईई एडवांस्ड के लिए 23 अप्रैल से शुरू होगा आवेदन, जानें कौन कर सकता है पंजीकरण

Read More

UPSC CSE Mains 2024 Interview Schedule out now; Personality tests from 7 January, Check full timetable here

Read More

Common Admission Test (CAT) 2024 Result out; 14 Students Score 100 Percentile, Read here

Read More

CAT Result: कैट परीक्षा के परिणाम जारी, इतने उम्मीदवारों ने 100 पर्सेंटाइल स्कोर किए हासिल; चेक करें रिजल्ट

Read More

CBSE: डमी प्रवेश रोकने के लिए सीबीएसई का सख्त कदम, 18 स्कूलों को जारी किया कारण बताओ नोटिस

Read More

Jharkhand Board Exam Dates 2025 released; Exams from 11 February, Check the full schedule here

Read More