If you’re into programming, chances are that you’ve probably heard about Selenium. Furthermore, if you’re looking at a tutorial for Selenium interview questions, you’re probably quite familiar with this framework. A lot of employers nowadays are looking for programmers and developers that would be well-versed and at least somewhat experienced with the webdriver. It’s not enough to simply know what Selenium is used for - you have to be able to demonstrate your skills, too.
We’ll start this tutorial from the very beginning and talk about some of the basic, introductory questions and answers. After that, I’ll give you examples of some of the more advanced questions that your interviewers might ask you. Finally, we’ll look over some general tips that you could use while practicing for your interview.
Don't forget to also check out some web developer courses, on a high-end MOOC provider such as Udemy!
Table of Contents
- 1. Introduction - Basic Questions
- 1.1. Before we Start - What is Selenium?
- 1.2. Question 1: What is automation testing?
- 1.3. Question 2: What are the two types of testing supported by Selenium?
- 1.4. Question 3: What is a Selenium webdriver?
- 1.5. Question 4: What are the three main versions of Selenium?
- 1.6. Question 5: What is ‘selenese’?
- 1.7. Question 6: What browsers does Selenium support?
- 1.8. Question 7: What is an ‘element’?
- 1.9. Question 8: Why would anyone use Selenium IDE when there are better versions of the framework?
- 1.10. Question 9: What is the ‘Selenium Grid’ used for?
- 1.11. Question 10: What operating systems support Selenium?
- 1.12. Question 11: What is the main difference between the ‘assert’ and ‘verify’ commands?
- 1.13. Question 12: What’s the difference between soft and hard asserts?
- 1.14. Question 13: In your opinion, what are the main negative points of Selenium?
- 1.15. Question 14: What are the main advantages of POM (Page Object Model)?
- 1.16. Question 15: Name the different types of locators in Selenium.
- 2. Advanced questions and answers
- 2.1. Question 16: How would you retrieve certain element properties from CSS to Selenium?
- 2.2. Question 17: How would you scroll down the page using JavaScript?
- 2.3. Question 18: How would you take a screenshot with Selenium Webdriver?
- 2.4. Question 19: How would you upload a file via Selenium Webdriver?
- 2.5. Question 20: What’s Junit?
- 2.6. Question 21: How many parameters do you have to meet for Selenium to pass a test? What are these parameters?
- 2.7. Question 22: How do you identify an object with Selenium?
- 2.8. Question 23: How would you find broken links on a webpage with the Webdriver?
- 2.9. Question 24: What’s the difference between “/” and “//”?
- 2.10. Question 25: What’s the difference between ‘Implicit wait’ and ‘Explicit wait’?
- 2.11. Question 26: How to skip a test method in TestNG?
- 2.12. Question 27: What are the automation limitations within Selenium?
- 2.13. Question 28: Name at least two file types that can be used as a source for a framework.
- 2.14. Question 29: What are the two types of how Selenium IDE can be opened?
- 2.15. Question 30: How can you insert a document into another document?
- 3. A Few Tips
- 3.1. Before
- 3.2. During
- 3.3. After
- 4. Conclusions
Introduction - Basic Questions
To start things off, I’ll provide you with some of the more basic Selenium interview questions that you might receive during your job interview. And when I say “basic”, I mean that this is the type of questions that your potential employers are likely to ask at the beginning of your meeting. They’ll want to test your general knowledge about the framework, and if they see that you’re quite knowledgeable, they’ll transition to some tougher stuff (that we’ll also cover later on). So, without further ado, let’s jump right into it.
Latest Deal Active Right Now:
30% OFF
Udacity Christmas Sale
Get 30% off on Udacity courses with this Holiday coupon. Elevate your skills and career at a discounted price. Don't miss out!
Before we Start - What is Selenium?
Selenium is an open-source, free web application testing framework. Any developers can download Selenium and make desired changes and tweaks to it - it is an all-around desirable and loved web software testing framework.
That also answers the question “what is Selenium used for?” and it might the one of the first Selenium interview questions you will get. It provides the user with full web app testing capabilities. One of the main features for its popularity, though, lies in the framework’s simplicity of use. Selenium does not require any knowledge of scripting languages to be able to use it. It also supports most of the popular programming languages out there (C#, Java, Python, PHP, etc.).
Question 1: What is automation testing?
Automation testing is a very popular subject, and it is also provided by Selenium.
Automation testing allows the programmer to test his coded software with an automated testing tool (like Selenium). This eliminates the need for manual testing - needless to say, it’s considered to be a huge advantage if you're able to use an automation testing program.
One of the most frequent follow-up Selenium interview questions might be - what are the benefits of automation testing? And, to be completely honest, there are many of them, but just to give you a few of the more notable example: is much more reliable than manual testing (no room for human error), saves a lot of time and even more money, is quite cheaper than manual testing, etc.
Question 2: What are the two types of testing supported by Selenium?
Functional and regression testing.
Question 3: What is a Selenium webdriver?
You are more than likely to get Selenium webdriver interview questions - it’s a significant part of Selenium.
The Selenium webdriver lets the programmer test various web applications both locally and remotely as a user - this is a big leap in the advancement of the framework.
Question 4: What are the three main versions of Selenium?
During Selenium interview questions you might get asked what are the versions of it. It is important to know that it is Selenium IDE, Selenium RC, and Selenium Webdriver.
Question 5: What is ‘selenese’?
Selenese is the language in which the scripts for Selenium IDE are written.
Question 6: What browsers does Selenium support?
It depends on which version of Selenium we’re talking about. Selenium IDE only supports a single browser - Firefox. Selenium RC supports Chrome, Explorer, Firefox and Opera, while Selenium Webdriver, on the other hand, supports most of the mainstream web browsers in the market.
Question 7: What is an ‘element’?
Every single object that is present on the webpage is called an element.
Question 8: Why would anyone use Selenium IDE when there are better versions of the framework?
Although it might seem like one of the stranger Selenium interview questions, there is a legitimate reason for using Selenium IDE - simplicity.
The IDE version of the framework is very easy to use and has an extremely low learning curve. It is perfectly suitable for people that are only getting into programming and don’t have a solid idea of what they're doing yet.
Question 9: What is the ‘Selenium Grid’ used for?
Selenium Grid allows you to test multiple web pages (web applications) at the same time and then compare the timeframes afterward. This can be indicative of just how well your website is performing maintenance-wise.
Question 10: What operating systems support Selenium?
All three of the main operating systems - Windows, Apple and Linux.
Question 11: What is the main difference between the ‘assert’ and ‘verify’ commands?
Assert will stop the testing process of the page if it finds that some elements are missing, while verify will continue the testing process no matter what.
Question 12: What’s the difference between soft and hard asserts?
A soft assert will run the test and not throw an exception if the assert failed, while a hard assert will throw the exception immediately, and then continue with the testing process.
Question 13: In your opinion, what are the main negative points of Selenium?
Answers to such Selenium interview questions are completely dependant on you as a person - some people might find the fact that Selenium supports only web apps a nuisance, others - the difficulty of maintaining objects. Not many of these Selenium framework interview questions allow the freedom to express one’s opinion, but this is one of them.
Question 14: What are the main advantages of POM (Page Object Model)?
There are two notable advantages - it improves the code’s readability and makes it reusable.
Question 15: Name the different types of locators in Selenium.
There are many different locators used within the Selenium framework, but just to name a few of the main ones: ID, Name, Xpath, LinkText, DOM, etc.
Advanced questions and answers
So - these were the 15 examples of the most basic of Selenium interview questions that there are. As I’ve mentioned, you can expect these and similar questions to be asked towards the beginning of the interview.
Now, let us transition to the more advanced interview questions on Selenium. Once your potential employer sees that you do know a thing or two about Selenium and how it works, they will probably want to test your skill level with the framework - this might involve extensive questions, coding tasks, etc.
Question 16: How would you retrieve certain element properties from CSS to Selenium?
You can retrieve element properties by using get()
.
Question 17: How would you scroll down the page using JavaScript?
To do so, you would have to execute the window.scrollBy()
function.
Example:
((JavascriptExecutor) driver).executeScript("window.scrollBy(0,750)");
Question 18: How would you take a screenshot with Selenium Webdriver?
Yet another one of the Selenium interview questions - you are more than likely to get quite a few of these.
To take a screenshot, you would have to use the TakeScreenshot function. After that, you can save the screenshot by using the getScreenshotAs()
command.
Example:
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://www.bitdegree.org/') browser.save_screenshot('courses.png') browser.quit()
Question 19: How would you upload a file via Selenium Webdriver?
An example of how you could do it is provided below. Keep in mind that you have to include input and file tags.
element = driver.find_element_by_id(”uploaded_file")
element.send_keys("C:\pictures.png")
Question 20: What’s Junit?
Even though it’s classified as one of the more advanced questions, the answer is pretty simple and straightforward. It is considered to be advanced mainly because not a lot of people know about it.
Junit is a Java-based framework designed for unit testing.
Question 21: How many parameters do you have to meet for Selenium to pass a test? What are these parameters?
This is what I meant when I said that advanced Selenium interview questions might have follow-ups - not only do you need to know the number of these parameters, but also be knowledgeable of what they are.
In total, there are four conditions (parameters) for Selenium to pass a test. These are as follows: URL, host, browser and port number.
Question 22: How do you identify an object with Selenium?
You would do so by utilizing the String Locator function.
Question 23: How would you find broken links on a webpage with the Webdriver?
One of the more tricky Selenium Webdriver interview questions - you interviewer might give you some random links and ask you to tell them which links are working properly, and which are broken.
To do so, you’ll have to use the driver.get()
function. You would have to imply the tags of , and for each that shows up, simply run the before mentioned function as a test. Any links that don’t come back as “200 - OK” are broken.
Question 24: What’s the difference between “/” and “//”?
Both “/” and “//” are used within XPath. “/” is used to create what is called an “absolute path” - selection begins from the very first node. “//” creates a “relative path”, where selection can begin from any given point in the document.
Question 25: What’s the difference between ‘Implicit wait’ and ‘Explicit wait’?
This is one of those Selenium interview questions that are best answered in as a simple manner as possible.
Implicit wait performs ongoing and repetitive searches for an element, while the explicit wait is a one-time-search kind of a thing.
Question 26: How to skip a test method in TestNG?
If you want to skip a certain test method within TestNG, you’ll have to set that test’s parameter to “false” in the annotation area.
Question 27: What are the automation limitations within Selenium?
This is one of the trickier interview questions on Selenium because you either know it or you don’t - there’s little room for creativity.
Luckily, the answer is pretty simple - captcha and barcodes are the two things that cannot be automated using Selenium.
Question 28: Name at least two file types that can be used as a source for a framework.
Excel and text files are the most common picks when it comes to such Selenium webdriver interview questions and answers.
Question 29: What are the two types of how Selenium IDE can be opened?
Selenium IDE can be opened in either a window mode or a sidebar mode.
Question 30: How can you insert a document into another document?
To do so, you would have to use the iframe
command.
A Few Tips
So - we have covered the basic Selenium interview questions and answers, and I’ve also shown you the more advanced versions of the interview questions on Selenium that a potential employer might ask you during a meeting for the job. Now, before I let you go, I’d like to offer some more general advice that you could utilize in a job interview, be it with Selenium or anything else.
Before
There’s a huge variety of things you could do before the actual interview to maximize your chances of performing well. Studying hard, getting some sleep, revising the possible questions - every single thing will help you get a better chance at landing the job. However, you probably know perfectly well what you should do… But do you know what you shouldn’t do?
You shouldn't overdo it. And by “it” I mean the preparation process leading up to the interview. Sure, you have to prepare so that you could give it your best, but if the interview is today and you haven’t slept in three days, what good will that bring anyone? Try to relax and be smart about it - develop a schedule, have some time off and try not to think about the Selenium interview questions and answers throughout that time.
During
During the interview, your main objective should be to show your potential employers what you’ve got and not let stress get in the way of smooth performance. Don’t just hand out one-word answers and expect that the interviewers to be satisfied - elaborate when you can, show that you are knowledgeable on the topic, stay humble and just let the time that you studied the Selenium framework interview questions and answers do the rest!
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- High-quality courses
- Nanodegree programs
- Student Career services
- Nanodegree programs
- Suitable for enterprises
- Paid certificates of completion
- A wide range of learning programs
- University-level courses
- Easy to navigate
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
After
After the interview is finished, you are most likely to feel a huge relief. Most companies get back to people in a couple of days - this period can be stressful, but it is definitely worth the wait. It is inadvisable (to say the least) to nag the company with messages and phone calls five times per day, asking “did I get the job already?!”. Stay patient and calm - they’ll get back to you (a lot of companies nowadays get back to people even if they aren’t planning to hire them, simply to inform and not keep the person waiting).
Did you know?
Have you ever wondered which online learning platforms are the best for your career?
Conclusions
At this point, you should not only know what is Selenium used for but also be aware of all of the different Selenium interview questions that you might get during that job meeting.
Remember - be confident, work hard, study web development, and believe in yourself! If you study hard, questions like “what is Selenium used for?” and “what are the automation limits in Selenium?” will seem equally easy.
I wish you all the best in your job interview!