0% found this document useful (0 votes)
22 views3 pages

Selenium

The document discusses the differences between various Selenium concepts like Assert vs Verify statements, findElement() vs findElements(), driver.close() vs driver.quit(), and different locator types. It also discusses TestNG annotations, the testng.xml file, disabling tests, what Cucumber is and why it is used, the Gherkin language used by Cucumber, and the different file types used in Cucumber like feature files, step definition files, and test runners.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Selenium

The document discusses the differences between various Selenium concepts like Assert vs Verify statements, findElement() vs findElements(), driver.close() vs driver.quit(), and different locator types. It also discusses TestNG annotations, the testng.xml file, disabling tests, what Cucumber is and why it is used, the Gherkin language used by Cucumber, and the different file types used in Cucumber like feature files, step definition files, and test runners.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. What is the difference between Assert and Verify statements in Selenium?

Assert:

We can check whether an element is on the page or not.

The test fails and gets terminated whenever there is a fail in the check. That is the

program control flow stops.

Verify:

It’s only to specify whether the given condition is true or false.

The program control flow does not stop due to this.

2. What is the difference between the Absolute path and the Relative Path?

Absolute Path:
 This path starts from the root node and ends with the desired elements node.
 It starts with a single slash (/)

Relative Path:
 This path starts from any node in between and to the desired elements node.
 It starts with a double slash (//)

3. What is the difference between findElement() and findElements()?

findElement() :

It uses the given locating mechanism to find the first element within the current page

and return a single web element.

findElements():

It also uses the given locating mechanism to find all the elements within the current

page and return the list of all web elements.


4. What is the major difference between driver.close() and driver.quit()?

driver.close():

It’s a command by which the current window can be closed.

driver.quit():

This command closes all the browser windows which are open

5. Can Selenium handle windows-based pop-up?

As we already know that Selenium is an automation testing tool that can work with only

web applications. Therefore, the pop-up in windows cannot be handled by Selenium. But,

by integrating with the third-party tools we can overcome this problem.

6. Different types of locators?


 ID
 Name
 Class
 Partial Link
 XPath
 CSS Selector
 Link Text

7. What are the annotations available in TestNG?


@BeforeTest
@AfterTest
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod
@BeforeSuite
@AfterSuite
@BeforeGroups
@AfterGroups
@Test

8. What is the importance of testng.xml file?


In a Selenium TestNG project, we use testng.xml file to configure the complete test suite in a
single file. Some of the features are as follows.

 testng.xml file allows to include or exclude the execution of test methods and test groups
 It allows to pass parameters to the test cases
 Allows to add group dependencies
 Allows to add priorities to the test cases
 Allows to configure parallel execution of test cases
 Allows to parameterize the test cases
9. How to disable a test case in TestNG ?

To disable the test case we use the parameter enabled = false to the @Test annotation.

10.What is Cucumber? Explain the need of using Cucumber.

Cucumber is a behavior-driven development (BDD) testing tool. The BDD


framework's major goal is to bring together a variety of project responsibilities,
such as quality assurance, developers, and business analysts, to understand the
application without diving too deeply into the technical components.
Testers use Cucumber to create test cases for evaluating program behaviour. It is
an important tool to automate acceptance tests written in logical language that
customers can understand. It's primarily used to develop acceptance tests for
web apps based on their features' behaviour.

11. Which language is used in Cucumber?

Gherkin language is used in cucumber.

12.What are the different files in Cucumber?

Feature File - It has plain text descriptions of single or numerous test situations.

 Step Definition file - It has the extension .java. It essentially acts as a translator
between the test scenario steps provided in the feature file and the
automation code. Cucumber searches the step definition file and executes
the relevant functions that are assigned to that step when it runs a step
described in the feature file.
 TestRunner: .java is the file extension for this file. It connects the feature file
and the step definition file. It allows the user to run one or more feature files
at the same time. It contains the locations of the step definition and feature
files.

You might also like