Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How is Selenium different from QTP?

Answer»
S.noSeleniumQTP
1.Open sourceLicense required
2.Free of costHigh price
3.Supports Windows, LINUX, MacSupports only Windows
4.Extensive LANGUAGE SUPPORT Support only VB SCRIPT
2.

How is TestNG better than Junit?

Answer»

TESTNG is an advanced framework that helps both developers and testers LEVERAGE the benefits. An open source framework, it is distributed under the APACHE Software License.

These features MAKE TestNG better than Junit:

  • Tests to confirm the code is multithread safe
  • Supports data-driven testing
  • Supports parameters
  • Includes a variety of tools and plug-ins
  • Flexible test configuration
  • Possible to set test case dependencies
3.

Explain Junit. What are annotations?

Answer»

It is a unit testing framework, which was introduced by Apache. This framework is based on JAVA.

 

FOLLOWING are JUnit Annotations:

  • @Test: This annotation tells the system that any method that is annotated as @Test is test method. You can have multiple test methods in one SCRIPT.
  • @Before: This SHOWS the system that this method will be executed every time before the test method.
  • @After: This method tells the system that this method will GET performed every time after the test method.
  • @BeforeClass: This method determines the system that this method will get performed once before any of the test methods.
  • @AfterClass: This method determines the system that this method will get performed once after the test method.
  • @Ignore: It shows the system that this method will not be implemented.
4.

How are web-based pop-ups handled in Selenium?

Answer»

WebDriver offers an efficient way to HANDLE web-based pop-ups USING the Alert interface. Developers can use the below mentioned four METHODS, along with the Alert interface, for treating web-based pop-ups:

  • void dismiss(): Accept() way clicks “Cancel” when window pop-ups appear.
  • void accept(): Accept() method clicks “Ok” button when window pop-ups appear.
  • String getText(): GetText() method returns the text SHOWN on alert box.
  • void sendKeys(String stringToSend): SendKeys() method enters specified string pattern into alert box.
5.

Is Selenium capable of handling Windows pop-ups?

Answer»

No. Selenium is an automation TESTING tool that only supports web APPLICATION testing. It cannot HANDLE Windows pop-ups.

This is one of the frequently ASKED Selenium INTERVIEW Questions.

6.

How is driver.close()command different from driver.quit command?

Answer»
S.noclose()quit()
1.Closes the browser window currently being used or accessed by WebDriverCloses down all the WINDOWS that were OPENED by the program
2.Neither requires PARAMETERS nor RETURNS values.Neither requires parameters nor returns values.
7.

What are the uses of findElement() and findElements()?

Answer»

findElement(): This is used to find the first ELEMENT on the EXISTING web page matching the specified locator value. You must REMEMBER that only first matching element will be fetched.

findElements(): This is used to find all of the elements in the existing web page matching the specified locator value. You must remember that all of the matching elements will be fetched and SAVED in the WebElements list.

8.

Name the different types of waits in WebDriver.

Answer»

Two TYPES of waits are available in WebDriver - Implicit Wait and Explicit Wait.

Implicit waits provide default waiting time between each consecutive test step across the test script. Therefore, subsequent test steps will execute only when the waiting time has elapsed after the previous test step.

Explicit waits HALT the execution till the time a given condition is met or the MAXIMUM wait time has elapsed. UNLIKE Implicit wait, the explicit wait can be applied only in PARTICULAR instances.

9.

What are Selenium 1 and Selenium 2?

Answer»

Selenium RC and WEBDRIVER, when combined, are KNOWN as Selenium 2. Selenium RC is ALSO known as Selenium 1.

10.

What is the use of Selenium Grid?

Answer»

SELENIUM Grid is used for executing TEST scripts on MULTIPLE platforms and cross-browsers simultaneously to ACHIEVE distributed test execution under different environments, thus saving program execution time.

11.

How are Selenium IDE, WebDriver and Selenium RC different from each other?

Answer»
Selenium IDESelenium RCWebDriver
Only supports FIREFOXSupports a RANGE of browsers like Firefox, Chrome, IE, and OperaSupports Firefox, Chrome, IE, Opera, and HtmlUnitDriver.
Supports playback and record featuresDoes not SUPPORT record and playbackDoes not support record and playback
Does not require server before executing test scriptsNeeds server before executing test scriptsDoes not require server before executing test scripts
Javascript-based frameworkJavaScript-based frameworkUses browser's NATIVE compatibility for automation
Not object-orientedSemi object-orientedCompletely object-oriented

 

You are expected to KNOW this information during Selenium Interview Questions With Answers.

12.

Explain XPath.

Answer»

XPath can help the developers locate web elements based on their XML path. The logic BEHIND establishing HTML elements using XPath is the crossing between different parts across the page, which enables a USER to find the item through the reference to ANOTHER ASPECT.

 

If you are PREPARING for Selenium interviews, you can have a look at our Advanced Selenium Interview Questions for better insight.

13.

How is Assert command different from Verify command?

Answer»
S.noAssert commandVerify command
1.Sees if a given condition is TRUE or FALSE.Sees if the condition is true or false
2.If the condition is true, PROGRAM CONTROL will execute the next test step.Irrespective the conditions are true or false; the program does not stop.
3.If the condition is not true, execution will stop, and no test will be EXECUTED.All of the test steps get executed.
14.

How many types of locators are there in Selenium?

Answer»

The LOCATOR is an address that identifies a WEB element within the page. DIFFERENT types of locators are USED to identify different web ELEMENTS accurately in Selenium:

  • ID
  • ClassName
  • Name
  • TagName
  • LinkText
  • PartialLinkText
  • Xpath
  • CSS Selector
  • DOM
15.

What do you mean by Selenese?

Answer»

It is the LANGUAGE for WRITING TEST scripts in SELENIUM IDE.

16.

What is the purpose of Selenium IDE?

Answer»

It is the EASIEST and simplest tool in the Selenium PACKAGE. Two features - record and playback - make this tool very EASY to learn with minimum knowledge of other programming languages. Selenium IDE is the best tool for NEW USERS.

17.

What are testing types supported by Selenium?

Answer»

SELENIUM SUPPORTS TWO TYPES of testing - Functional Testing and Regression Testing.

18.

What are the different components in Selenium?

Answer»

The Selenium suite includes 4 set of tools:

 

1. Selenium Integrated Development Environment (IDE): It is a RECORD and playback tool, which is distributed as a Firefox Plugin.

2. Selenium Remote Control (RC): It is a server that allows users to create test scripts in the programming language of their choice. It also allows developers to execute test scripts cross browsers.

3. Selenium WebDriver: This tool communicates directly with the browser and uses native COMPATIBILITY to automate.

4. Selenium Grid: It is used to distribute test EXECUTION on multiple platforms and environments

19.

What are the advantages of Selenium as a test tool?

Answer»
  • It is free and open source
  • Has LARGE user base and online communities
  • Cross-browser compatibility
  • Platform compatibility
  • Supports most of the PROGRAMMING LANGUAGES