Selenium Interview Questions and answers

Question.1   What is Selenium IDE?

Answer:   Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back. Selenium-IDE also offers full editing of test cases for more precision and control.

Question.2  Can Selenium test a application on iPhone’s Mobile Safari browser?

Answer:   Selenium can handle Mobile Safari browser. There is experimental Selenium IPhone Driver for running tests on Mobile with Safari on the iPhone and iPad and iPod Touch.

Question.3   Can Selenium test an application on Android browser?

Answer:   Selenium can handle Android browser.

Question.4  What tests can selenium do?

Answer:  Selenium could do functional, regression, and load of web based applications.

Question.5  What are the disadvantages of Selenium?

Answer:  Disadvantages of Selenium:

• Limitation in terms of browser support (It runs only in Mozilla).Scripts written using Selenium IDE can be used for other browsers only if it is used with Selenium RC or Selenium Core.

• We can’t run recorded script if it is converted to Java, C#, Ruby etc.

• Not allowed to write manual scripts like conditions and Loops for Data Driven Testing

• There is no option to verify images.

Question.6  What are the technical challenges with selenium?

Answer:   As you know Selenium is a free ware open source testing tool. There are many challenges with Selenium.

1. Selenium supports only web based applications.

2. It doesn’t support any non web based (Like Win 32, Java Applet, Java Swing, .Net Client Server etc) applications.

3. When you compare selenium with QTP, Silk Test, Test Partner and RFT, there are many challenges in terms of maintainability of the test cases.

4. Since Selenium is a freeware tool, there is no direct support if one is in trouble with the support of applications.

5. There is no object repository concept in Selenium, so maintainability of the objects is very high

6. There are many challenges if one have to interact with Win 32 windows even when you are working with Web based applications.

7. Bitmap comparison is not supported by Selenium.

8. Any reporting related capabilities, you need to depend on third party tools.

9. 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.

Question.7  How to run test case recorded using Selenium IDE in other browsers?

Answer:   Running test case recorded with the help of Selenium -Remote Control.

Question.8  What is the selenium’s recording language?

Answer:  Selenium’s recording language is “HTML”.

Question.9   What are the steps to run automation using selenium?

Answer:  The very basic steps are:

1. Record the test steps using selenium-IDE.

2. Modify the script according to the testing needs. Add validation points, Java Scripts, Time-out etc.

3. Run the test.

4. View the result after test run complete analyze.

Question.10   What are the capabilities of Selenium IDE?

Answer:  Selenium IDE (Integrated Development Environment) works similar to commercial tools like QTP, Silk Test and Test Partner etc.

The below points describes well about Selenium IDE.

1. Selenium IDE is a Firefox add-on.

2. Selenium IDE can support recording the clicks, typing, and other actions to make a test cases.

3. Using Selenium IDE, a tester can play back the test cases in the Firefox browser.

4. Selenium IDE supports exporting the test cases and suites to Selenium RC.

5. Debugging of the test cases with step-by-step can be done.

6. Breakpoint insertion is possible.

7. Page abstraction functionality is supported by Selenium IDE.

8. Selenium IDE can supports an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE.

Question.11  What is WebDriver?

Answer:  WebDriver is a tool for writing automated tests of websites. It aims to mimic the behavior of a real user, and as such interacts with the HTML of the application.

Question.12   So, is it like Selenium? Or Sahi?

Answer:   The aim is the same (to allow you to test your web app), but the implementation is different. Rather than running as a Javascript application within the browser (with the limitations this brings, such as the “same origin” problem), WebDriver controls the browser itself. This means that it can take advantage of any facilities offered by the native platform.

Question.13   What is Selenium 2.0?

Answer:   Selenium 2 is the latest version of the Selenium project, and includes the IDE, Server and WebDriver.

Question.14   How do I migrate from using the original Selenium APIs to the new WebDriver APIs?

Answer:  A common question when adopting Selenium 2 is what’s the correct thing to do when adding new tests to an existing set of tests? Users who are new to the framework can begin by using the new WebDriver APIs for writing their tests. But what of users who already have suites of existing tests? This guide is designed to demonstrate how to migrate your existing tests to the new APIs, allowing all new tests to be written using the new features offered by WebDriver.

Question.15   Which browsers does WebDriver support?

Answer:   The existing drivers are the ChromeDriver, InternetExplorerDriver, FirefoxDriver, OperaDriver and HtmlUnitDriver. For more information about each of these, including their relative strengths and weaknesses, please follow the links to the relevant pages. There is also support for mobile testing via the AndroidDriver, OperaMobileDriver and IPhoneDriver.

Question.16  What does it mean to be “developer focused”?

Answer:  We believe that within a software application’s development team, the people who are best placed to build the tools that everyone else can use are the developers. Although it should be easy to use WebDriver directly, it should also be easy to use it as a building block for more sophisticated tools. Because of this, WebDriver has a small API that’s easy to explore by hitting the “autocomplete” button in your favorite IDE, and aims to work consistently no matter which browser implementation you use.

Question.17   How do I execute Javascript directly?

Answer:  We believe that most of the time there is a requirement to execute Javascript there is a failing in the tool being used: it hasn’t emitted the correct events, has not interacted with a page correctly, or has failed to react when an XmlHttpRequest returns. We would rather fix WebDriver to work consistently and correctly than rely on testers working out which Javascript method to call.

We also realise that there will be times when this is a limitation. As a result, for those browsers that support it, you can execute Javascript by casting the WebDriver instance to a JavascriptExecutor. In Java, this looks like:

WebDriver driver; // Assigned elsewhere

JavascriptExecutor js = (JavascriptExecutor) driver;

js.executeScript(“return document.title”);

Other language bindings will follow a similar approach. Take a look at the Using Javascript page for more information.

Question.18   Why is my Javascript execution always returning null?

Answer:   You need to return from your javascript snippet to return a value, so:


will return null, but:

js.executeScript(“return document.title”);

will return the title of the document.

Question.19   My XPath finds elements in one browser, but not in others. Why is this?

Answer:   The short answer is that each supported browser handles XPath slightly differently, and you’re probably running into one of these differences. The long answer is on the XpathInWebDriver page.

Visit Here for Selenium Online Training   from Industry Experts.