Selenium Interview Questions and Answers Set 10

91. What is the main difference between the close() and quit() methods?

close() – it closes the currently active browser window.
quit()- it will close all of the opened browser windows and the browser itself. 

92. How to configure selenium web driver in eclipse?

In Eclipse, I created Java projects and added JUnit or TestNG classes. In the project reference, I added JUnit or TestNG jar file. In the test class, I used webdriver in setup, test and teardown methods. Sometimes, I used webdriver in beforeclass, beforemethod, aftermethod, afterclass sections. 

93. What is webdriver backed selenium?

WebDriver backed Selenium is API that enables running Selenium 1.0 tests in web driver. 

94. Why should testers opt for Selenium and not QTP?

Selenium is more popular than QTP as
• Selenium is an open source whereas QTP is a commercial tool
• Selenium is used especially for testing web-based applications while QTP can be used for testing client-server application also
• Selenium supports Firefox, IE, Opera, Safari operating systems like Windows, Mac, Linux etc. however QTP is limited to Internet Explorer on Windows.
• Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script 

95. What is the difference between setSpeed() and sleep() methods?

Both will delay the speed of execution.
Thread.sleep (): It will stop the current (java) thread for the specified period of time. Its done only once
• It takes a single argument in integer format
Ex: thread.sleep(2000)- It will wait for 2 seconds

• It waits only once at the command given at sleep
SetSpeed (): For a specific amount of time it will stop the execution for every selenium command.

• It takes a single argument in integer format
Ex: selenium.setSpeed(“2000”)- It will wait for 2 seconds

• Runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed
This command is useful for demonstration purpose or if you are using a slow web application 

96. What is the Selenese command to show the value of a variable in the log file?

echo() is the Selenese command to show the value of a variable. 

97. How to conduct Database Testing with Selenium WebDriver?

With the help of programming features, we can connect to any Database Management System (Ex: Oracle, MS SQL Server, MySQL etc…) and conduct Database Testing. 

98. What is actions class in WebDriver

The user-facing API for emulating complex user gestures. Use this class rather than using the Keyboard or Mouse directly. 

99. What are the Testing Frameworks used in Selenium?

• JNuit, TestNG etc … Testing frameworks used in Selenium.
• JNunit will help to execute Test Batches and generate Test Reports.
• TestNG framework is used to group Test cases, Execute Test suites, and generate Test Reports. 

100. What are the Drawbacks of Selenium IDE

• It supports Mozilla Firefox Browser only.
• Data Driven Testing (executing tests using multiple sets of test data) is not possible.
• Test Results are not generated using Selenium IDE (It generates summary only).
• Random Test Cases execution is not possible
• Selenium IDE doesn’t support Flow control Statements.
• It doesn’t support programming (Conditional statements, loop statements etc…) for enhancing Test cases.
• It is not suitable for complex Test case design.
• It doesn’t support random Test case execution.