Table of Contents
*This post may contain affiliate links. As an Amazon Associate we earn from qualifying purchases.
Selenium is a powerful and portable framework popular for testing software written for web applications. With its playback/recording capabilities, Selenium can be used to create tests that are executed against multiple web browsers.
Selenium is an open source testing tool that offers its own test domain-specific language for writing tests in for a variety of languages that include C#, Perl, PHP, Java, Python, and others. Selenium?s language (Selenese) and test functions are cross-platform, capable of being deployed on Mac OS, Windows, and Linux environments.
One major draw of Selenium is that ? being open source ? you are free to download and use it for testing your web applications at no cost.
Selenium Tester Demand
There are many reasons the demand for Selenium testers are in high demand for testing web development:
- It?s open source ? free to use
- Cross-platform ? works with most popular web browsers and operating systems
- Supports a variety of programming languages
- DevOps lifecycle integration, and growth of DevOps architecture in business systems
- Provides a framework for Quality Assurance (QA) testing
Becoming proficient in Selenium will provide you with skills that are marketable and positioned for higher demand and earnings potential.
Part of obtaining the position you?re looking for is making a good impression in a job interview. To help you be successful in your job search, it will help to know the most likely questions that an interviewer or prospective manager will ask, and the best answers for each question.
Be prepared for more than just standard Selenium and web application development questions. There may also be some unexpected or tricky questions thrown your way, to verify the depth of your knowledge and experience.
Top Selenium Interview Questions and Answers
Armed with some advance knowledge of the top 20 Selenium interview questions and how to answer them, you can approach any interview with confidence and security in your responses.
What are the components of Selenium?
Selenium has some major components:
- Selenium WebDriver ? succeeding Selenium Remote Control (RC), WebDriver drives a web browser using collection of bindings (application programming interfaces ? APIs) that are language-specific. WebDriver works with most popular web browsers.
- Selenium Integrated Development Environment (IDE) ? IDE is a Firefox Add-on which has also now been made available on Chrome (new version is referred to as IDE!, which facilitates recording, running, editing, and debugging tests.
- Grid ? using grid functionality, you can test in distributed environments, running parallel tests on different machines to reduce the time needed for running your tests in different browsers. One server acts as the hub, which provides a list of servers to access WebDriver browsers, allowing tests to access those browsers.
What is Selenium 2.0, and how is it different? Same question for Selenium 3?
Selenium 2.0 consolidated RC and WebDriver into this single web testing tool. Selenium 2.0 also introduced a new Client API, based on WebDriver.
Selenium 3 was more recently released, correcting some bugs from Selenium 2.53, improving stability, and replacing the Selenium Core with an updated implementation based on WebDriver.
Selenium 2 still supported the original APIs for RC, although Selenium has advised users to migrate to the newer WebDriver APIs. With Selenium 3, the old APIs have been removed.
What is an element in Selenium, and how will you find it?
Selenium knows every control or object on a web page as an element. You can find elements through reference to the element by its locator type, such as (partial list):
- PartialLink Text
With Selenium commands, you can find these elements individually or in multiples through specifying ?find_element? or ?find_elements?, such as:
- find_element_by_ID or
What test types does Selenium support?
Selenium can be used for multiple types of tests of web-based applications:
Regression testing ? retesting web applications after system or software changes
Functional testing ? initial testing of new web applications or testing modifications
What is Selenese?
Selenese is the programming language native to Selenium used for writing test scripts in IDE.
What are the advantages of using a tool such as Selenium?
Automated testing saves time in recurring test plans
Automation results in fewer errors over manual tests
A large number of tests can be executed in far less time ? saving time and money
Test scripts are repeatable ? especially applicable to regression testing
What are the limitations or drawbacks of using Selenium?
Selenium is limited to web applications. It is not applicable for mobile apps or testing barcodes or Captcha values. Report generation is limited, typically requiring additional third-party solutions.
In Selenium, can you check whether a web page button is enabled or not? How?
Within your Selenium script, you can utilize the Enabled() method to test a returned value for true (enabled) or not.
The same is true for testing visibility of an element on the web page ? the Displayed() method will return a value of true if the element is visible. Otherwise, it is not.
How can you check the state/status of a radio or checkbox button?
Utilize the isSelected() function to test the state of radio/checkbox elements.
What types of drivers are available to you in Selenium WebDriver?
Drivers are available for Chrome, Internet Explorer, Firefox, Safari, iPhone, Android, Opera, HtmlUnit, and PhantomJS.
What is the difference between ?assert? commands and ?verify? commands in WebDriver?
This is important for you to know when conducting tests. Both commands will check for Boolean value conditions. The difference is that assert will halt the program when a false condition is returned, while verify does not halt the program but allows the next phase of execution to proceed.
There are additional questions you may be asked that reveal more to the interviewer about your experience with Selenium and the inherent capabilities of the system.
Can Selenium be used for testing distributed systems, and if so, how would you accomplish it?
Selenium Grid has the technology and functionality to tests on multiple machines in a distributed processing environment. This allows for parallel testing even on different operating systems utilizing different web browsers ? all with a single script. This reduces execution and testing time, and provides more expeditious results.
How can you analyze the results of Selenium IDE testing?
Selenium IDE test execution results can be displayed in Log Window.
What is the difference between the close() and quit() Selenium functions?
Close() ends only the current browser. Quit() will end all browsers running in WebDriver.
Explain the types of wait methods introduced in Selenium WebDriver and when and how each would be used
Selenium incorporates two methods of waiting: implicit and explicit.
Implicit wait is intended to be used for instances such as when WebDriver cannot locate a particular element in a document. The test will wait for the specified interval of time for the element to appear. The drawback to utilizing implicit waits is that it slows the execution of the test.
The explicit waiting method is a more advanced function that permits the developer to integrate custom code where applicable. An effective use for explicit wait is to stall a test until a desired condition is met, such as to wait for a web page load.
Selenium can instruct the test to wait until a specific element can be located on the page (is visible), and can result in a timeout condition after a specified period of time.
What are the four parameters you pass in Selenium?
The parameters you pass in Selenium are Port number, Browser, URL, and Host.
How would you verify that a web page has loaded with Selenium WebDriver?
The approach best utilized is to determine an element on the page and wait for it to become clickable.
What types of exceptions will you encounter that are provided by WebDriver?
There are multiple exceptions provided by WebDriver
Describe any technical issues or challenges that are inherent with Selenium
- Being open source and a free suite of functions, there is no vendor support
- Reliance on third-party reporting tools, as there are no integrated reporting capabilities
- Supports only web-based applications
What are Selenium Page Object Model and Page Factory?
Page Factory is utilized for initializing WebElement variables by means of references to elements on the web page. Those variables can be referenced as elements on a web page using ?locators?, providing use by Selenium annotations for identifying and looking up elements.
Page Object Model is a pattern for representing variables in a web page using classes. Test writers can then implement routines utilizing those references within scripts to drive behavior of the test case. This enhances the readability of the test cases for future use and maintenance of the script.
Can Selenium WebDriver perform actual drag and drop actions in testing routines?
Yes ? simply use the Advanced User Interactions API to perform these operations.
Acing Your Selenium Interview
Having some advanced preparation for your in-person or phone interview by knowing the top 20 Selenium interview questions and how to answer them will help you navigate the questions easily.
For more advanced information and additional questions, there are useful books and ebooks available to give you even more helpful interview questions and tips. Helpful videos can also be found on YouTube for your review.
If you?re new to Selenium and anxious to begin a career as a software testing engineer, consider video training courses available for Selenium training.