Selenium is a web application testing framework. It does not require scripts writing. It is easy to use. Selenium makes web testing faster. Hence, the skill to use selenium is given preference while selection of a web tester. In this article, we have covered a number of selenium interview questions with answers which would help you in preparing your job interview.
List of Selenium Interview Questions
Q # 1 What is selenium?
Selenium is a web application testing framework. It is an automated testing tool which requires no knowledge of scripting.
Q # 2 What are major parts of Selenium?
Selenium consists of three major components. These parts are:
- WebDriver and RC
- Selenium IDE
WebDriver and RC
WebDriver allows direct communication of web browser by using its native compatibility for automation. RC component provides APIs for different programming languages like .NET, PHP, Java, NodeJS etc. It is compatible with most of the browsers.
Selenium IDE is an integrated development environment tool to record and playback. It is a firefox plugin. Practically, I have used Selenium IDE on Firefox 50.0 version. However, support for the current version may vary.
You may download Selenium IDE FireFox extension here.
To distribute tests on multiple machines for running tests parallel to save time, grid can be used.
Q # 3 What are reasons to choose Selenium?
- It is open-source and free to use.
- It has a number of helping communities and material available on internet.
- It supports multiple browsers including Google Chrome and Firefox.
- It supports multiple programming languages including Java, PHP, .NET, Ruby.
- It supports distributed testing.
- It has fresh and regular repository developments.
Q # 4 How to find an element in Selenium?
It is not just an important selenium interview question, but a frequently used function.
A webpage is rendered as elements, sometimes called as HTML tags. There are different identifiers or locators based on which we can select and distinguish an element in web page. These locators or identifiers are:
- Xpath (Used rarely when you are unable to use other identifiers.)
- ID (It is commonly used identifier, even while writing CSS or JS code, we use ID to identify an element. )
- Attribute (We can use various attributes of an HTML tag to identify element.)
- Linktext (We can choose based on text.)
- Name (We can select based on name property of element.)
- CSS (We can select an element based on its CSS properties.)
- Tag (We can use tag names.)
- PartialLink Text (We can use partial link tet to select element.)
Q # 5 What kind of tests you can perform with selenium?
There are two kinds of tests which can be supported by selenium before release.
- Functional Testing
- Regression Testing
Q # 6 What is assertion in Selenium?
To verify a state of the application conforms to what is expected, assertion is used.
Q # 7 What kinds of assertions does Selenium support?
Selenium has three main kinds of assertions:
Q # 8 When Xpath is used?
Xpath is usually used when application is generating elements dynamically. Otherwise, it is easier to use other identifiers for testing.
Q # 9 What kind of testing is Selenium?
It is automated testing.
Q # 10 What is automated testing?
Automated testing means to create testing scripts and run them. They will keep testing the application. It does not require manual intervention.
Q # 11 Can you test mobile applications on Selenium?
No, Selenium supports testing web-based applications only. We can not test mobile applications on selenium.
Q # 12 Can you test barcode or captcha on Selenium?
No, it is not possible to test captcha or barcode with Selenium yet (until date of publishing this article).
Q # 13 Can we generate reports on Selenium?
No, we cannot generate reports on Selenium directly. However, we can use thrid party tools like JUnit or TestNG to generate reports.
Q # 14 Does Selenium support bitmap comparison?
No, selenium does not support bitmap comparison.
Q # 15 What is difference between / and // in X-Path?
Double slash is used to create relative path and starts selection matching everywhere in the document. Whereas single slash is used to create absolute path and starts selection from document node.
Q # 16 What is difference between type() and typeKeys()?
- type is used when you need to put some text in the input field. Just like a human enters value.
- typeKeys simulates each keystroke. It is used when a page has some action while you are typing like autosuggest in search fields.
Q # 17 What is difference between assert and verify?
- Verify checks whether the element is on-page or not. Test will not be terminated even element is not present.
- Assert will find an element on-page. If not found, it will stop executing.
Q # 18 How you can submit a form in Selenium?
To submit a form, use click or element.submit().
Q # 19 How you can click on particular area of screen using coordinates?
To click on particular area on screen clickAt (locator, coordinateString) can be used.
Q # 20 How to launch browser using WebDriver?
You may launch web browser using WebDriver as:
- WebDriver d = new InternetExplorerDriver();
- WebDriver d = new ChromeDriver();
- WebDriver d = new FirefoxDriver();
These selenium interview questions are very important from an interview preparation point of view. These selenium interview questions list covers commonly asked questions. While you are applying for web testing position, an interviewer never keeps asking questions about one tool. Therefore, along with selenium interview questions, you may have strong command in programming questions as well. You would like to read our article on Computer Science Interview Questions and PHP Interview Questions.