When engineers create software, they need to test it. Testing is the most crucial part of the life cycle of software which is called a software development life cycle (SDLC).
Selenium is a popular automated testing tool. This open-source, automated testing tool is used to test web applications across different browsers.
The reasons for the popularity of Selenium as a testing tool are as follows:
As anresult, any software company asks the applicants a few questions related tonSelenium. The knowledge of Selenium is of utmost importance for the softwarendevelopers and engineers.
A collection of questions that are asked about Selenium, along with their answers, is helpful for job applicants. The interview panel asks some questions to check the basic knowledge of Selenium. Interested candidates may check out the frequently asked questions and their answers given below:
1. What testing types does Selenium support? Explain them
Selenium supports two types of Testing. They are:
Regression Testing
Functional Testing
a) Regression testing: A few test casesnare already executed. Sometimes, they need to be re-executed to check whethernthe existing functionalities are working fine. Regression testing refers to anfull or partial selection of the test cases that have already been executed.
b) Functional Testing: It involvesnverifying all the functions of the application with the specificationecessary.
2. How would you differentiate among Selenium 2.0 as well as Selenium 3.0?
Selenium 2.0 simplifies the development of automated tests for web applications. It represents the combination of the Selenium project with the Webdriver project.
Selenium 3.0 is an extended version of Selenium 2.0. It is more stable than its previous version. Some bug fixes are inbuilt.
3.What are the components of the Selenium suite? Explain them
The components of the Selenium suite are as follows:
Selenium Remote Control
Selenium Webdriver
Selenium Grid
Selenium IDE
a) Selenium Remote Control: This servernpermits the users to write application tests in various programming languages.nThis server accepts commands from the test script. Then, it sends the testnscripts to the browser as Selenium core Java script commands.
b) Selenium Webdriver: This programmingninterface helps the creation and ruing of test cases. It ensures provisionsnto work on web elements are present. Since it has the facility to act nativelynwith the web browsers, it doesn't require a new server.
c) Selenium Grid: It was designed tondistribute commands to a variety of machines simultaneously. So, it permitsntests to be executed on many browsers and operating systems parallelly.
d) Selenium IDE: This plug-in to Firefox and Chrome was developed to fasten up the creation of automatic scripts. It is useful for recording the actions of the user on the web browser. Then, it exports the works as a reusable script.
4. Is Selenium testing limited in some way?
Selenium testing has its limitations like:
a) Basic knowledge of programming languages isecessary: Selenium Web Drivernexpects the users to have basic knowledge of programming language.
b) It only tests web applications:nSelenium tests only web applications. It is not compatible with mobile orndesktop apps. It has to be integrated with third-party tools like Appium tontest mobile applications and desktop applications.
c) Itngives limited support to image testing.
d) Absence of dependable technical support:nSelenium is an open-sourced tool. So, it does not have dedicated technicalnsupport for resolving the queries of users.
5. What do you mean by the same-origin policy? How do you handle it?
We may explain the same-origin policy as a feature adopted for security reasons. As per this policy, a web browser lets scripts of webpage access the contents of another webpage. However, both the webpages need to have the same origin.
The same Origin policy also prevents a malicious Script of a webpage from accessing the sensitive data of another webpage.
6. What types of waits does Web driver support? Explain them
Web driver supports three types of wait:
Implicit Wait
Explicit Wait
Fluent Wait
a) Implicit Wait: It commands Selenium tonwait for some time before displaying a "No such command" exception.
b) Explicit Wait: This command tells thenWeb driver to wait for some conditions before posting the "Element notnVisible" exception.
c) Fluent wait: It shows the Web driver to wait for a state and the frequency with which we need to check status before displaying the "Element not visible" exception.
7. What do you mean by Selenese? How can you classify it?
A set of Selenium commands used to test a particular web application is known as Selenese. A tester tests whether Ajax is functional, whether some object exists on the UI, and broken links through Selenese.
Selenesenis classified into three parts:
a) Activities: It comprises commands thatninteract directly with an application.
b) Accessors: It allows users to storensome values to a user-defined variable.
c) Assertions: It verifies the presentncondition of a claim with the help of an expected state.
8. What do you mean by web locators?
A command that tells the Selenium IDE which GUI elements (like checkboxes and text boxes) need to work upon is known as a locator. In other words, a locator specifies the string of action.
9. How would you differentiate between driver.close and driver.quit?
Driver.close is a command that closes the current window of a browser. If many windows are simultaneously open, it will close the current window of focus.
Driver.quit is a command which closes all the windows of a browser that are open.
10. What is the use of X-path?
X-path is used to locate the WebElement in the web pages. It also helps in the identification of dynamic elements.
11. How would you differentiate between Verify commands and assert commands?
The Assert command allows us to check whether a particular element is on the page. If the asserted part is not found, the check automatically stops. As soon as the check is not found, the test Is terminated.
ThenVerify command will be executed even if a particular element is not available.nAlso, if any test fails, it is guaranteed that all the commands will run.
12. Why should testers opt for Selenium instead of QTP?
Selenium has certain advantages over QTP. They are as follows:
a) QTPnis a commercial tool. On the other hand, Selenium is an open-source tool.
b)nSelenium supports different web browsers like Firefox and Internet Explorer ooperating systems like Windows and MAC. QTP is restricted to Internet Explorernon Windows.
c)nSelenium is mainly used for testing web-based applications. QTP is used to testnclient-server applications.
d) Selenium supports multiple programming languages like Ruby and Python. QTP only supports the VB script.
13.Which four parameters do you need to pass in Selenium?
The four parameters that we need to pass in Selenium are as follows?
a) Portumber
b) Host
c)nBrowser
d)URL
14. What do you mean by the data-driven framework and keyword driven framework?
In a data-driven framework, the test data is kept separate. It is held outside the Test scripts and is read using external files, like Excel files.
In ankeyword-driven framework, the data tables and keywords need to be developednindependently of any test automation.
15. What are the differences between Selenium and Borland Silk?
The differences between Selenium and Borland Silk are as follows:
a)nSelenium is a free test automation tool. Borland Silk is not a free testingntool.
b) Silkntest uses script testing language. Selenium uses multiple programming languagesnlike Java and Perl.
c)nSelenium supports many browsers like Firefox, Internet Explorer, and Safari.nBorland Silk only supports Firefox and Internet Explorer.
d)nSelenium is used only for web applications. On the other hand, Borland Silk is usednfor client-server applications.
16.What do you mean by object repository?
An object repository permits a tester to store all the objects used in the scripts in a central location. It is integral to all the UI automatons. It doesn't allow the purposes used for writings to be scattered indiscriminately throughout the test script.
17. What are "listeners" In Selenium Web driver?
Certain events are defined in the Selenium script. The function of "listeners" in Selenium Web Driver is to listen to those events and act accordingly. Two main types of listeners are as follows:
a)Web Driver listeners
b)nTestNG listeners.
Itnallows the relevant departments to TestNG reports.
18. Why is session handling necessary while working with Selenium?
When a tester executes a test, the Selenium Web driver needs to interact with the browser. This way, it ensures the commands are executed.
Someonenelse may execute a different script in the same machine before the currentnexecution is over. Session handle makes it easier to deal with such situations.
19. What is IntelliJ?
IntelliJ is an IDE. It helps people write a faster code for Selenium. The code written by IntelliJ is of good quality too.
20. What is meant by the desired Capability? How is it helpful in Selenium?
A series of value pairs are used to store the properties of a browser. The features include a browser name, the browser driver's path followed in the system, and the version of the browser. This string of value pairs is known as the desired Capability. It stores these properties of the browser to consider the behavior at the time of the run.
Let us discuss how the desired Capability is helpful for Selenium:
a)nSomeone may want to run the test cases on different browsers having differentnversions and different operating systems. Desired Capability comes in handynthen.
b) Desired Capability may be used for configuring the driver instance of Selenium Web driver.
21. What is meant by regular expressions? How can you proper widows be used in Selenium?
A regular expression is a unique string of texts used to describe a search pattern. A regular expression may be used in Selenium IDE through a keyword "regexp" as a prefix to the value. Models also need to be included to derive the expected benefits.
22. How do you explain the core extension?
Selenium Function Library provides some default functions. If someone wants to extend these default functions, he or she needs to create a core extension. A core extension is also known as a user extension. Readymade core extensions, which Selenium enthusiasts have created, can also be downloaded.
1. What do you mean by POM?
POM stands for Page Object Model. It is a design pattern that helps to create object repositories for web elements. The object repository allows many test cases to run on it. Pom improves the readability and reusability of the code.
2. Is It possible to automate Captcha?
No, Selenium does allow Captcha to be automated. The purpose of Captcha is to prevent automated programs and bots from accessing sensitive information. So, the whole purpose of Captcha is defeated, if Selenium allows it to be automated. An automation testing engineer needs to type the Captcha manually. All the other fields may be filled automatically.
3. How can Selenium handle pop-ups that are based on Windows?
Selenium is not a native supporter of the features of Windows. It was designed for handling web applications. Selenium should be combined with third-party tools like Robots to manage Windows-based functions.
4.Why will a Selenium IDE test fail?
A Selenium IDE test fails for the reasons mentioned below:
Thenelement which Selenium IDE tried to access had not been created.
When a locator changed, and Selenium IDE caot locate the element.
Thenelement which Selenium IDE was trying to access did not appear on the webpage.nIn the meantime, the operation timed out.
5. Why is it better to choose Python over Java in Selenium?
a) Selenium accepts different programming languages like Java and Python. However, Java is preferable to Python. The reasons behind it are as follows:
b)nPython programs run faster than Java programs.
c)nPython may employ dynamic typing. On the other hand, Java uses static typing.
d)nPython is more straightforward than Java.
6. What type of Java API is necessary to generate PDF reports?
Java API IText is needed to generate PDF reports.
7. Why is it challenging to handle Ajax calls in Selenium Web drivers?
People face multiple challenges while handling Ajax calls in Selenium Web drivers. They are as follows:
a) Thendevelopers have full liberty to make changes to the Ajax application. It makesnthe testing process complicated.
b) Manyna time, the pause command is used to handle an Ajax call. The Pause commandnmakes the Ajax call incredibly slow. So, the testing time takes a very longnperiod.
c) Itnis difficult to gauge how risky specific Ajax applications may be.
TestingnTools like Ajax often use different techniques of coding for submitting POSTndata. So, it gets difficult for testing tools like Ajax to create automatedntest request data.
8. How is it advantageous to use GIT Hub for Selenium?
The advantages of using GIT HUB for Selenium are discussed below:
Many people working on the same project may update relevant product details and let the other team members know at the same time. It makes keeping a track of the progress easier.
9.How can a tester use multiple windows simultaneously, in Selenium?
The user may use a command named "select window" to toggle between windows. This command uses a title called "Windows" to identify which window he or she needs to switch
10. Could you mention anyone technical limitation while using Selenium RC?
Selenium is not authorized to access anything outside the browser. It is a technical challenge many people face while they use Selenium RC.
Do you have any Selenium Interview questions that are not answered here? Please visit Vinsys and fill up the inquiry form we will try to answer all.
We have an industry expert who illustrates certain pieces of code while explaining how to answer the questions. If you wish to embark on your journey as a test automation engineer, then here’s a certification course that will come in handy. Check out the Vinsys Selenium training course. This training is designed to train developers and manual testers to learn how to automate web applications with a robust framework, and integrate it within the DevOps processes of an organization, and help you master important concepts such as TestNG, Selenium IDE, and Selenium Grid.
Vinsys is a globally recognized provider of a wide array of professional services designed to meet the diverse needs of organizations across the globe. We specialize in Technical & Business Training, IT Development & Software Solutions, Foreign Language Services, Digital Learning, Resourcing & Recruitment, and Consulting. Our unwavering commitment to excellence is evident through our ISO 9001, 27001, and CMMIDEV/3 certifications, which validate our exceptional standards. With a successful track record spanning over two decades, we have effectively served more than 4,000 organizations across the globe.