Selenium is an open source software test automation tool. Here you will get all the Selenium interview Questions and Answers:
Q1. What do you know about Selenium?
Selenium is a set of different software tools each with a different approach to supporting test automation. The entire suite of tools results in a rich set of testing functions specifically geared to the needs of testing of web applications of all types. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior. One of Selenium’s key features is the support for executing one’s tests on multiple browser platforms.
Selenium Suite of projects includes:
Selenium IDE: For Record and Run
Selenium Core: more a component of selenium than a standalone project. Without going into the project history, Selenium was once just a collection of .js files that automated a browser. No one uses these directly; they’re just there for legacy reasons.
Selenium1: known as. Selenium RC or Remote Control now deprecated
Selenium2: Updated version of Selenium RC known as. Selenium Webdriver
Selenium-Grid: Selenium Grid allows you to run your tests in parallel, that is, different tests can be run at the same time on different remote machines.
For More Software QA Tutorials and Interview preparations please visit: www.tonmoyelearn.com
Q2. What is the difference between Selenium Remote Control and Selenium Server?
While discussing the core difference between Selenium RC and Selenium WebDriver we will focus on some related terms as well:
Selenium Core: more a component of selenium than a stand alone project. Without going into the project history, Selenium was once just a collection of .js files that automated a browser. No one uses these directly, they’re just there for legacy reasons.
Selenium IDE: a Firefox plugin for record/playback. You may want to start with this, to get used to the api, but you’ll outgrow it soon
Selenium RC and when you do outgrow it, you’ll use Selenium Remote Control. Selenium 1.x is a client-server architecture. You use the RC libraries to program tests that communicate with the server, and the server relays those commands to a browser.
Selenium Grid: a way to run Selenium testing on a distributed network of computers. Good for speeding things up once you’ve got a lot of tests.
Cubic Test: An eclipse-based tool that leverages selenium for testing. Not sure how popular it is.
Bromine: a web based script and test management tool. Uses selenium RC to run tests.
Then we get to the Selenium 2 beta. Selenium 2 is a major departure from the Selenium 1 model because it doesn’t require a Selenium server. I say ‘require’ because it’s optional to run the tests remotely on another computer. Selenium Server Standalone is the server you’d use for this. It’s compatible with Selenium-RC as well as Selenium 2 for remote purposes.
You may have seen Selenium 2 referred to as WebDriver. WebDriver was another project that was merged a couple years ago and became the basis for Selenium 2. That’s why Selenium 2 has a WebDriver interface, sometimes called the “WebDriver” api to distinguish from Selenium-RC.
Q3. What are the test types supported by Selenium?
Selenium could be used for testing the web based applications. The test types can be supported are:
- load testing
The automation tool could be implemented for post release validation with continuous integration tools like:
For More Software QA Tutorials and Interview preparations please visit: www.tonmoyelearn.com
Q4. What are the technical challenges with selenium?
As you know Selenium is a free ware open source testing tool. There are many challenges with Selenium.
- Selenium supports only web based applications
- It doesn’t support any non-web based (Like Win 32, Java Applet, Java Swing, .Net Client Server etc) applications
- When you compare selenium with QTP, Silk Test, Test Partner and RFT, there are many challenges in terms of maintainability of the test cases
- Since Selenium is a freeware tool, there is no direct support if one is in trouble with the support of applications
- There is no object repository concept in Selenium, so maintainability of the objects is very high
- There are many challenges if one have to interact with Win 32 windows even when you are working with Web based applications
- Bitmap comparison is not supported by Selenium
- Any reporting related capabilities, you need to depend on third party tools
- You need to learn any one of the native language like (.Net, Java, Perl, Python, PHP, Ruby) to work efficiently with the scripting side of selenium.
Q5. What is the Difference between Absolute path & Relative path?
Absolute path will start with root path (/) and Relative path will from current path (//)
Absolute xPath: /html/body/div/div/div/div/div/div/div/div/div/div/div/div[@id=
Relative xPath : //h3/a[text()=’Working on New Window’]
Q6.What are the features of TestNG?
TestNG is a testing framework designed to simplify a broad range of testing needs, from
unit testing (testing a class in isolation of the others) to integration testing (testing entire
systems made of several classes, several packages and even several external frameworks,
such as application servers). You can use test suite annotations, to automatically generate
test run report and much more.
Q7. Please tell me the difference between implicitly Wait and Explicit wait.
Implicit Wait sets internally a timeout that will be used for all consecutive Web Element searches. It will try lookup the element again and again for the specified amount of time before throwing a NoSuchElementException if the element could not have been found. It does only this and can’t be forced into anything else – it waits for elements to show up.
Explicit Wait or just Wait is a one-timer used by you for a particular search. It is more extendible in the means that you can set it up to wait for any condition you might like. Usually, you can use some of the prebuilt Expected Conditions to wait for elements to become clickable, visible, invisible, etc., or just write your own condition that suits your needs.
Q8. Tell me some TestNG Annotations.
@BeforeSuite: The annotated method will be run before all tests in this suite have run.
@AfterSuite: The annotated method will be run after all tests in this suite have run.
@BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run.
@AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run.
@BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
@AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.
@BeforeClass: The annotated method will be run before the first test method in the current class is invoked.
@AfterClass: The annotated method will be run after all the test methods in the current class have been run.
@BeforeMethod: The annotated method will be run before each test method.
@AfterMethod: The annotated method will be run after each test method.
Q8. What is Selenium IDE? Mention some disadvantage.
Selenium IDE is basic tool that is generally used for Record and Run Test for Learning purpose.
- Selenium IDE (Integrated Development Environment) is a Firefox add on which supports record/playback mechanism as some other commercial tools like QTP/UFT, TestComplete etc.
- By using selenium IDE user can record and playback test cases in Firefox browser.
- Tester can export the test cases from selenium IDE in any of the native language supported by selenium. These tests can then be modified according to the test case.
- Tester can insert breakpoints in IDE.
Disadvantages of Selenium IDE
- It does not supports looping or conditional statements. Tester has to use native languages to write logic in the test case.
- It does not supports test reporting, you have to use selenium WebDriver with some external reporting pligin like TestNG or JUint to get test execution report.
- Error handling is also not supported depending on the native language for this.
- Only support in Mozilla FireFox only. Its an Firefox add on.
Q9. What are the advantage and features of Selenium IDE?
- Intelligent field selection will use IDs, names, or XPath as needed
- It is a record & playback tool and the script format can be written in various languages including C#, Java, PERL, Python, PHP, HTML
- Auto complete for all common Selenium commands
- Debug and set breakpoints
- Option to automatically assert the title of every page
- Support for Selenium user-extensions.js file
Q10. Name some test automation tools apart from Selenium?
- HP Unified Functional Testing(UFT)/QTP (Commercial)
- IBM Rational Functional Tester (Commercial)
- TestComplete (By Smart Bear)
- HP WinRunner (Commercial)
- SilkTest (Commercial)
- HTTP Test Tool (Open Source)
- WATIR (Open Source)
- Maveryx (Open Source)
- eggPlant (Commercial)
Q11. What is WebDriver?
The primary new feature in Selenium 2.0 is the integration of the WebDriver API. WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.
Q13 What are the types of text patterns available in Selenium?
There are three types of patterns available in Selenium:
- regular expressions
Q14. What are globs? How does Selenium Support Globbing?
We used globs while searching files in DOS by using the command *.doc or US*.doc and so on. So let’s see how Selenium supports globbing.
Globbing in Selennium is possible with the following set of characters
- * (asterisk): It is used to match any number of characters. E.g. *.doc will indicate a.doc or arkansas.doc
- ? (question mark)
It is used to match a single character. E.g. Se?.doc will indicate Set.doc. It supports just a single character.
- [ ] (square brackets)
Typically a square bracket is used to denote a class of characters or set of characters.
- [a-z] means a set of lowercase alphabets
- [A-Z] means a set of uppercase alphabets
- [0-9] indicates a set of numeric values
Q15. How to use globs in Selenium?
Suppose we want to find/ search for the text “America” or “American”, then we could use it as Ame*
In Selenium, that would mean the following:
Q16. Comparative discussion Between UFT/QTP vs Selenium?
Only web applications can be tested using Selenium testing suite. However, UFT/QTP can be used for testing client server applications as well as Web Applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, UFT/QTP supports Internet Explorer/Chrome/Firefox on Windows.
QTP uses scripting language implemented on top of VB Script. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.