Selenium Interview QnA




1. What is Selenium?

Selenium is one of the most powerful open source automation tool for web application testing (even we can say acceptance testing for the web application) which lets you automate operations like type, click, the selection from a drop down etc of a web page. Primarily developed in Java Script and browser technologies such as DHTML and Frames and hence supports all the major browsers on all the platforms.


2. Who developed Selenium Tool and Why? 
Jason Huggins and team developed this tool in 2004 when they were working for Thought work (IT outsourcing company). They created this tool for the testing of an internal time & expenses application written in (python).


3. What is Selenium IDE? 
Selenium IDE is a Firefox plug-in which is (by and large) used to record and replay test is Firefox browser. Selenium IDE can be used only with Firefox browser.


4. Which language is used in Selenium IDE? 
Selenium IDE uses html sort of language called Selenese. Though other languages (Java, c#, php etc) cannot be used with Selenium IDE, Selenium IDE lets you convert test in these languages so that they could be used with Selenium 1.0 or Selenium 2.0


5. There is id, name, XPath, CSS locator, which one should I use? 
If there are constant name/id available than they should be used instead of XPath and CSS locators. If not then CSS locators should be given preference as their evaluation is faster than XPath in most modern browsers.


6. I want to generate random numbers, dates as my test data, how do I do this in Selenium IDE? This can be achieved by executing javascript in Selenium. Javascript can be executed using the following syntax 1 Type – css=input#s– javascript{Math.random()}


7. What is Automation Testing? 
Automation testing is the process of testing a software or application using an automation testing tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools. It is required when we have huge amount of regression test cases. Some most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc


8. What type of tests have you automated? 
Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.


9. How many test cases you have automated per day? 
Actually it depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high.


10. Is Selenium 2.0 different from Selenium 3.0?
If so, how? Selenium RC is called Selenium 2.0, and the integration of Selenium RC and WebDriver as a single tool has formed Selenium 3.0.


11. Mention some of the popular tools used for Automation Testing. 
a. Selenium 
b. Rational Robot 
c. HP Unified Functional Testing (UFT) 
d. IBM Rational Functional Tester



12. What is an object repository? 
An object repository allows testers to accumulate web elements of the application under test (AUT), along with their locator values, in one or more centralized locations as restricted to hardcoding them within the test scripts.


13. What are the four elements that you have to pass in Selenium? 
Four parameters that need to be passed in Selenium are: 
a. Host 
b. Port number 
c. Browser 
d. URL


14. What is an ‘element’?
Every single object that is present on the webpage is called an element.


15. What operating systems support Selenium?
All three of the main operating systems – Windows, Apple and Linux.


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


17. Name the different types of locators in Selenium. 
There are many different locators used within the Selenium training framework, but just to name a few of the main ones: ID, Name, Xpath, LinkText, DOM, etc.


18. How would you scroll down the page using JavaScript?
To do so, you would have to execute the window.scrollBy() function. 

Example: ((JavascriptExecutor) driver).executeScript("window.scrollBy(0,750)"); 


19. How would you take a screenshot with Selenium Webdriver? 
Yet another one of the Selenium 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 getScreenshotAs() command.

Example: from selenium import 
                webdriver browser = webdriver.Firefox();
                browser.get('http://www.bitdegree.org/');
                browser.save_screenshot('courses.png');
                browser.quit()


20. 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 input and file tags. 
element = driver.find_element_by_id(”uploaded_file") element.send_keys("C:\pictures.png")


21. What’s Junit? 
Even though it’s classified as one of the more advanced questions, the answer is pretty simple and straightforward. It is considered to be advanced mainly because not a lot of people know about it.
Junit is a Java-based framework designed for unit testing.


22. What is Selenese? 
Selenese is the language which is used to write test scripts in Selenium IDE.  




2 comments:

How to install Java on EC2

***************************************** How to install Java on EC2 ***************************************** To be continued, In this post...

All Time Popular Post