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 Selenium Interview Questions – Advanced
- 2.1 Question 16: How would you retrieve certain element properties from CSS to Selenium?
- 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 in 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 of Advice
- 4 Conclusions
Introduction – Basic QuestionsTo 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.
Before we Start – What is Selenium?Selenium is an open-source, free web application testing framework. Any and all 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?”. 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.
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?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’?
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 actually 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 really 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 a freedom to express one’s opinion, but this is one of them.
Question 14: What are the main advantages of POM (Page Object Model)?
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.
Selenium Interview Questions – AdvancedSo – 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
Question 18: How would you take a screenshot with Selenium Webdriver?Yet another one of the Selenium Webdriver 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
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 the input and file tags.
element = driver.find_element_by_id(”uploaded_file")
Question 20: What’s Junit?Even though it’s classified as one of the more advanced Selenium interview questions, the answer is pretty simple and straightforward. It is considered to be advanced mainly because not a lot of people know about it.
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.
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 <a>, and for each <a> 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.
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 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