Selenium Interview Questions and Answers Set 3

21. How to get typed text from a textbox?

Use get Attribute (“value”) method by passing arg as value.
String typedText = driver.findElement (By.xpath (“xpath of box”)).get Attribute (“value”)); 

22. What are the different exceptions you got when working with WebDriver?

• ElementNotVisibleException
• ElementNotSelectableException
• NoAlertPresentException
• NoSuchAttributeException
• NoSuchWindowException
• TimeoutException
• WebDriverException 

23. What are the languages supported by WebDriver?

Python, Ruby, C# and Java are all supported directly by the development team. There are also WebDriver implementations for PHP and Perl. 

24. How do you clear the contents of a textbox in selenium?

Use clear () method.

driver.findElement (By.xpath (“xpath of box”)).clear (); 

25. What is a Framework?

A framework is set of automation guidelines which help in Maintaining consistency of Testing, Improves test structuring, Minimum usage of code, Less Maintenance of code, Improve reusability, Non Technical testers can be involved in code, a Training period of using the tool can be reduced, Involves Data wherever appropriate.

There are five types of the framework used in software automation testing:

• Data Driven Automation Framework
• Method Driven Automation Framework
• Modular Automation Framework
• Keyword Driven Automation Framework
• Hybrid Automation Framework, it‟s basically a combination of different frameworks. (1+2+3). 

26. What are the prerequisites to run selenium WebDriver?

JDK, Eclipse, WebDriver (selenium standalone jar file), browser, application to be tested. 

27. What are the advantages of selenium WebDriver?

a) It supports with most of the browsers like Firefox, IE, Chrome, Safari, Opera etc. b) It supports with most of the language like Java, Python, Ruby, C# etc.

b) Doesn‟t require to start the server before executing the test script.
c) It has actual core API which has binding in a range of languages. d) It supports of moving mouse cursors.
e) It supports to test iphone/Android applications. 

28. What is WebDriverBackedSelenium?

WebDriverBackedSelenium is a kind of class name where we can create an object for it as below:

Selenium WebDriver= new WebDriverBackedSelenium

(WebDriver object name, “URL path of website”)

The main use of this is when we want to write code using both WebDriver and Selenium RC, we must use above-created object to use selenium commands. 

29. How to invoke an application in WebDriver?

driver. get (“url”); or driver. Navigate ().to (“url”); 

30. What is Selenium Grid?

Selenium Grid allows you to run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines, different browsers, and operating systems.
Essentially, Selenium Grid support distributed test execution. It allows for running your tests in a distributed test execution environment.