Sunday, September 13, 2009

Selenium Interview Questions and Answers

Sharing Selenium interview questions being asked (to me at various interviews) for Mid-level to Senior-level Test Engineering positions at well-established companies.

Describe some problems that you had with Selenium tool ?
Solution: The one big limitation in Selenium - Select a file in a File Input field for sake of uploading.
XPaths makes tests slow
Having Ids for elements make tests faster but the UI code might not have Ids for all elements
XPaths are brittle - ie flaky because if the UI developer changes anything like adding or removing a DIV, then the XPath becomes invalid and has to be updated in the tests.
*Also look at my blog above which talks more about File Upload issue with Selenium *

What are the limitations of using Selenium with Flex based UIs ?
Solution: There is a relatively new open source project called FlexUISelenium located here, which allows Flex based UIs to be tested by Selenium. FlexUISelenium is an extension to the Selenium RC client driver that enables the Selenium RC client drivers to interact (and test) the Flex UI components and methods of the Flex application. FlexUISelenium works on the same lines as the Selenium Flash UI testing concept make calls to the ActionScript via JavaScript from Selenium.

  • With FlexUISelenium the developers do not need to expose every method to be tested by using the ExernalInterface technique.
  • Just adding the SeleniumFlexAPI.swc library to the Flex application while building automatically exposes all methods to be called from external JavaScript.


  • The FlexUISelenium project is quiet new and has some issues as reported on the project home page.
  • Its not production ready yet and hence not very reliable.
  • The developers have to include an external library which is otherwise not required for production builds.
  • How would you test Pop-up window using Selenium ?
  • Solution: First steps would be to determine whether this is an alert dialog -created using JavaScript's alert() or a bona-fide pop up window probably using open(). Since they both are treated differently its important to understand what kind of test case it is and what exactly interviewee asking.

What is difference between Borland Silk test and Selenium?
Solution: Selenium is completely free test automation tool, while Silk Test is not. Only web applications can be testing using Selenium testing suite. However, Silk Test can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Internet Explorer and Firefox. Silk Test uses 4Test scripting language. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.

What is Selenium RC (Remote Control)? 
Solution: Selenium RC allows the test automation expert to use a programming language for maximum flexibility and extensibility in developing test logic. For example, if the application under test returns a result set and the automated test program needs to run tests on each element in the result set, the iteration / loop support of programming language’s can be used to iterate through the result set, calling Selenium commands to run tests on each item. Selenium RC provides an API and library for each of its supported languages. This ability to use Selenium RC with a high level programming language to develop test cases also allows the automated testing to be integrated with the project’s automated build environment.
More info can be found here

How have you used Selenium for your own most recent project ?
Solution: Make sure you explain about whether you used standard Selenium API to automate tests, if extended Selenium as per your needs then how have you done that, besides that which test runner you used with Selenium, also explain about paradigm you followed for automation using Selenium.

No comments:

Post a Comment