Selenium TestNG Cucumber Interview Questions 1729752421
Selenium TestNG Cucumber Interview Questions 1729752421
1. What is Selenium?
• Selenium IDE
• Selenium WebDriver
• Selenium Grid
5. What is TestNG?
• TestNG is a testing framework inspired by JUnit and NUnit, designed to cover all
categories of testing, including unit, functional, end-to-end, and integration
testing.
• You can run a TestNG test using an XML file or directly from an IDE like Eclipse or
IntelliJ IDEA.
• @Test
• @BeforeMethod
• @AfterMethod
• @BeforeClass
• @AfterClass
8. What is Cucumber?
• Cucumber is a tool for Behavior Driven Development (BDD) that allows writing
tests in a human-readable format using Gherkin syntax.
• Feature
• Scenario
• Given
• When
• Then
• And
• You can use Scenario Outline and Examples to parameterize tests in Cucumber.
• POM is a design pattern that creates an object repository for web UI elements,
promoting code reusability and maintainability.
• Use the Alert interface provided by WebDriver to switch to alerts and perform
actions like accept or dismiss.
• It is used to wait for a certain condition to occur before proceeding with the next
step in the code, helping to manage dynamic web elements.
java
• Implicit wait sets a default wait time for all elements, while explicit wait allows
waiting for specific conditions for individual elements.
java
dropdown.selectByVisibleText("Option Text");
18. Explain the difference between findElement() and findElements().
java
driver.switchTo().frame("frameName");
• These annotations are used to specify methods that should run before or after
all tests in a suite.
java
actions.moveToElement(element).perform();
• Assert.assertEquals()
• Assert.assertTrue()
• Assert.assertFalse()
• You can configure parallel execution in the TestNG XML file using the <suite> tag
with the attribute parallel.
• A feature file contains scenarios written in Gherkin syntax that describe the
behavior of an application from an end-user perspective.
java
driver.get("http://example.com/login");
• @BeforeMethod runs before each test method, while @BeforeClass runs once
before any methods in the current class are invoked.
27. How can you read data from Excel files in Selenium?
• Use libraries like Apache POI or JExcelAPI to read data from Excel files.
28. Explain how to create a custom exception in Java for Selenium tests.
java
super(message);
java
actions.dragAndDrop(sourceElement, targetElement).perform();
java
32. What are some common exceptions encountered while using Selenium?
• NoSuchElementException
• TimeoutException
• StaleElementReferenceException
java
driver.findElement(By.xpath("//div[contains(@class,'dynamic-class')]"));
34. How do you verify if an element is displayed on the webpage using Selenium?
java
xml
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.x.x</version>
<scope>test</scope>
</dependency>
java
driver.findElement(By.id("uploadField")).sendKeys("path/to/file.txt");
38. What are tags in Cucumber, and how are they used?
Tags allow grouping scenarios for selective execution based on specific criteria defined
by annotations like @smoke or @regression.
39. How can you take screenshots during test execution in Selenium?
Use the TakesScreenshot interface:
java
40. Explain how to implement data-driven testing using TestNG and Excel files.
Use DataProvider annotation along with Apache POI to fetch data from Excel files for
parameterized tests.
41. What are some best practices when writing automation scripts with Selenium?
Best practices include:
42. How do you handle SSL certificates issues during testing with Selenium WebDriver?
Configure browser capabilities to accept insecure certificates:
java
ChromeOptions options = new ChromeOptions();
options.setAcceptInsecureCerts(true);
46. How can we switch back from a frame to the main content using WebDriver?
java
driver.switchTo().defaultContent();
47. Explain how to perform keyboard actions using Actions class in Selenium
WebDriver:
java
java
POM
What is Page Object Model (POM)?
The Page Object Model is a design pattern that creates an object repository for web UI
elements. Each web page in the application is represented by a separate class, which contains
the elements and methods related to that page. This helps in organizing the code better, making
it more readable and maintainable.
• Code Reusability: Common actions can be reused across different tests, reducing
code duplication.
• Better Readability: Tests become more readable as they use methods from page
classes rather than direct WebDriver calls.
1. Create Page Classes: Each class corresponds to a web page and contains locators and
methods for interacting with those elements.
2. Define Web Elements: Use locators to define the web elements on the page.
4. Use Page Objects in Tests: In your test scripts, create instances of the page classes
and call their methods.
Example Implementation
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
// Locators
// Constructor
this.driver = driver;
}
driver.findElement(usernameField).sendKeys(username);
driver.findElement(passwordField).sendKeys(password);
driver.findElement(loginButton).click();
In your test class, you can use the LoginPage class as follows:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import pages.LoginPage;
// Set up WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
driver.get("http://example.com/login");
// Create an instance of LoginPage
loginPage.enterUsername("testuser");
loginPage.enterPassword("testpassword");
loginPage.clickLogin();
driver.quit();
• Easier Updates: If an element's locator changes, you only need to update it in one
place.
• Clear Structure: The code structure is clear, making it easier for new team members to
understand.
1. Definition: POM is a design pattern that creates an object repository for web UI
elements. Each web page in the application has a corresponding class that contains
methods to interact with the elements on that page.
2. Structure:
• Each page class contains locators for web elements and methods that perform
actions on those elements.
3. Initialization:
4. Advantages:
5. Example:
// Locators
this.driver = driver;
driver.findElement(username).sendKeys(user);
driver.findElement(password).sendKeys(pass);
driver.findElement(loginButton).click();
Page Factory
1. Definition: Page Factory is an extension of the Page Object Model provided by Selenium
WebDriver. It simplifies the process of creating Page Objects by using annotations to
initialize web elements.
2. Structure:
• Web elements are defined using annotations like @FindBy, which allows for
more concise code.
3. Initialization:
• All page elements are initialized at once using the initElements() method, which
can lead to lazy initialization (elements are only found when they are first used).
• This approach can potentially reduce boilerplate code but may lead to stale
element exceptions if the DOM changes after initialization.
4. Advantages:
5. Example:
PageFactory.initElements(driver, this);
username.sendKeys(user);
password.sendKeys(pass);
}
public void clickLogin() {
loginButton.click();
Element Requires individual initialization of each page Uses @FindBy annotations for automatic
Initialization object initialization
Lazy Initialization Does not support lazy initialization Supports lazy initialization
Code Readability More verbose, requires more boilerplate More concise due to annotations
TESTNG
Here are 50 commonly asked interview questions along with their answers related to TestNG,
a popular testing framework for Java applications.
1. What is TestNG?
• You can run a TestNG test by right-clicking the test class in your IDE and
selecting "Run As" > "TestNG Test."
• @Test
• @BeforeMethod
• @AfterMethod
• @BeforeClass
• @AfterClass
• @BeforeSuite
• @AfterSuite
1. @BeforeSuite
2. @BeforeTest
3. @BeforeClass
4. @BeforeMethod
5. @Test
6. @AfterMethod
7. @AfterClass
8. @AfterTest
9. @AfterSuite
• You can set priorities using the priority attribute in the @Test annotation:
java
@Test(priority = 1)
• Grouping allows you to execute multiple test cases together under a single group
name defined in the @Test annotation.
• Dependency allows you to specify that one test method should run only after
another method has successfully executed.
• The timeOut attribute specifies the maximum time (in milliseconds) that a test
method should take to execute before it is marked as failed.
• The invocationCount attribute specifies how many times a test method should
be invoked.
• The testng.xml file is used to configure and organize tests, specify groups, and
define parameters for running tests.
xml
java
@Parameters({"username"})
• You can disable a test case by setting the enabled attribute to false:
java
@Test(enabled = false)
14. What is the difference between soft assertion and hard assertion?
• Hard assertions stop the execution of the test if an assertion fails, while soft
assertions allow the test to continue executing even if an assertion fails.
• The @Listener annotation allows you to register listeners that can perform
actions when certain events occur during the test execution.
• You can handle exceptions using try-catch blocks within your test methods or by
using expectedExceptions attribute in the @Test annotation.
• Assertions are used to verify whether the expected results match actual results
during testing, helping determine if a test has passed or failed.
• Assert.assertEquals()
• Assert.assertTrue()
• Assert.assertFalse()
• Assert.assertNull()
• Assert.assertNotNull()
xml
<test name="Test1">
<classes>
<class name="YourClass"/>
</classes>
</test>
</suite>
java
@Test(groups = {"smoke"})
@Test(groups = {"regression"})
• ITestListener
• IReporter
• IInvocationListener
• You can generate HTML reports automatically after running tests, or you can
implement custom reporting using listeners.
java
@DataProvider(name = "data-provider")
@Test(dataProvider = "data-provider")
if (condition) {
• Priority determines the order of execution for test methods; lower numbers have
higher priority.
java
java
@Test(timeOut = 1000)
32. Can we run multiple tests from different classes simultaneously using groups?
Yes, by defining groups in your XML configuration and specifying those groups when
running tests.
34. Explain how to use XML configuration files with multiple suites and tests in TestNG.
You can define multiple <suite> and <test> tags within your XML file to organize and
execute different sets of tests concurrently or sequentially.
35. How do you pass parameters from command line when running a TestNG suite?
Use command line arguments with the -D flag:
text
38. Explain how to use soft assertions with SoftAssert class in TestNG:
java
softAssert.assertEquals(actualValue, expectedValue);
softAssert.assertAll();
39. How do you configure listeners globally for all tests in your project?
Add listener configurations directly into your testng.xml file:
xml
<listeners>
<listener class-name="your.package.ListenerClass"/>
</listeners>
40. Can we have multiple DataProviders for a single test method? How?
Yes, by specifying different DataProviders with their respective names as parameters
when calling them from a single test method.
44. Can we use JavaScript code within our Selenium scripts when using TestNG for web
automation testing?
Yes, JavaScript can be executed through WebDriver's JavaScriptExecutor interface for
handling dynamic web elements or triggering events not directly accessible through
WebDriver methods.
45. How do we handle multiple browsers with different configurations using TestNG?
Define different browser configurations within separate classes or methods annotated
with appropriate DataProviders or Factory annotations.
46. Explain how we can create reusable methods across multiple classes using
inheritance with TestNG:
java
@Test
commonSetup();
47. What are some best practices when writing automated tests with TestNG:
java
js.executeScript("window.scrollBy(0,-250)", "");
In this example, the second parameter of window.scrollBy() is set to a negative value (-250) to
scroll up by 250 pixels.
java
js.executeScript("window.scrollTo(0, 0)");
This code scrolls to the top of the page by setting both the horizontal (scrollX) and vertical
(scrollY) scroll positions to 0.
java
js.executeScript("arguments[0].scrollIntoView(true);", element);
This script scrolls the page until the specified element is visible. The scrollIntoView() method is
used to align the element to the top of the visible area of the scrollable ancestor.
java
actions.sendKeys(Keys.PAGE_UP).perform();
You can use the sendKeys() method from the Actions class and pass Keys.PAGE_UP to simulate
pressing the Page Up key on the keyboard, which scrolls up.Remember to import the necessary
classes (JavascriptExecutor, WebElement, Actions, Keys) based on your programming language
and framework.By using these techniques with JavascriptExecutor or the Actions class, you can
effectively handle scrolling up in Selenium tests, allowing you to interact with elements that are
not initially visible on the page.
Common XPath Selectors for Dynamic
Elements
1. Basic XPath Syntax:
• //tagname[@attribute='value']
• Example: //input[@id='username']
6. Using Indexing:
• When multiple elements match the criteria, use indexing to specify which one to
select.
Advanced Techniques
11. Using Relative XPath:
• Relative XPath allows you to start from any point in the DOM rather than from the
root.
• You can select elements based on their position in relation to other elements.
The contains() function is useful when you know part of the attribute value but not the entire
value.
• Syntax:
text
//tag[contains(@attribute, 'value')]
• Example:
java
This XPath matches any input element where the ID contains "login".
• Syntax:
text
//tag[starts-with(@attribute, 'value')]
• Example:
java
• Syntax:
text
//tag[text()='exactText']
• Example:
java
4. Using normalize-space()
• Syntax:
text
//tag[normalize-space(text())='exactText']
• Example:
java
The wildcard allows you to select all elements that match certain attributes, regardless of the
tag name.
• Syntax:
text
//*[@attribute='value']
• Example:
java
XPath allows you to traverse the DOM tree based on the hierarchical structure of elements.
Parent to Child
• Syntax:
text
//parentTag/childTag
• Example:
java
• Syntax:
text
//parentTag//descendantTag
• Example:
java
Following-Sibling
• Syntax:
text
//tag1/following-sibling::tag2
Preceding-Sibling
• Syntax:
text
//tag1/preceding-sibling::tag2
java
WebElement siblingElement =
driver.findElement(By.xpath("//label[text()='Username']/following-sibling::input"));
• Example:
java
This finds an input element whose ID starts with "user_" and is inside a div with a class that
contains "form-group".
a. Ancestor
• Syntax:
text
//tag/ancestor::ancestorTag
• Example:
java
WebElement ancestorElement =
driver.findElement(By.xpath("//input[@id='user']/ancestor::form"));
This locates the form element that is an ancestor of the input field with id='user'.
b. Child
• Syntax:
text
//tag/child::childTag
c. Following
• Syntax:
text
//tag/following::followingTag
d. Preceding
• Syntax:
text
//tag/preceding::precedingTag
e. Self
• Syntax:
text
//tag/self::tag
java
This locates a sibling div with class "child" that follows the div with class "parent".
Here are 10 examples of traversing with XPath axes specifically for web tables in Selenium.
These examples will help you understand how to navigate through the elements of a web table
using various XPath axes.
The ancestor axis selects all ancestor elements (parents, grandparents, etc.) of the current
node.
WebElement tableElement =
driver.findElement(By.xpath("//td[text()='CellValue']/ancestor::table"));
• Example: Select all <tr> elements (rows) that are children of a specific <table>.
java
The descendant axis selects all descendants (children, grandchildren, etc.) of the current node.
java
List<WebElement> cells =
driver.findElements(By.xpath("//table[@id='myTable']//descendant::td"));
The following axis selects all nodes in the document after the closing tag of the current node.
• Example: Find all elements that appear after a specific row in a table.
java
List<WebElement> followingElements =
driver.findElements(By.xpath("//tr[td[text()='RowValue']]/following::tr"));
The following-sibling axis selects all siblings after the current node.
java
The preceding axis selects all nodes that appear before the current node.
• Example: Find all rows that appear before a specific row in a table.
java
List<WebElement> precedingRows =
driver.findElements(By.xpath("//tr[td[text()='RowValue']]/preceding::tr"));
java
List<WebElement> previousRows =
driver.findElements(By.xpath("//tr[td[text()='RowValue']]/preceding-sibling::tr"));
java
• Example: Find all cells in rows that follow a specific header row.
java
List<WebElement> cellsAfterHeader =
driver.findElements(By.xpath("//th[text()='HeaderValue']/following::tr/td"));
java
WebElement cell =
driver.findElement(By.xpath("//table//th[text()='ColumnHeader']/ancestor::table//tr/td[position()
=2]"));
This example finds the second cell in each row under a column with a specific header.
1. Abstraction
Definition: Abstraction is the process of hiding the implementation details and showing only
the essential features of an object. In Selenium, abstraction is achieved through the use of
interfaces and abstract classes.Example:
In the Page Object Model (POM) design pattern, you define locators and methods in a page
class but do not expose the implementation details to the test scripts.
java
@FindBy(id = "username")
@FindBy(id = "password")
@FindBy(id = "loginButton")
this.driver = driver;
PageFactory.initElements(driver, this);
usernameField.sendKeys(username);
passwordField.sendKeys(password);
loginButton.click();
In this example, the implementation details of how to interact with the web elements are hidden
from the test scripts.
2. Encapsulation
Definition: Encapsulation is the bundling of data (attributes) and methods that operate on that
data into a single unit or class. It restricts direct access to some components.Example:
In POM classes, you can declare data members as private and provide public methods to
access or modify them.
java
return name;
this.name = name;
return email;
this.email = email;
Here, the name and email attributes are encapsulated within the User class. They can only be
accessed through getter and setter methods.
3. Inheritance
Definition: Inheritance is a mechanism where one class inherits properties and behavior
(methods) from another class. This promotes code reusability.Example:
You can create a base class for common functionalities like initializing WebDriver or common
test setup.
java
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://example.com");
@AfterClass
if (driver != null) {
driver.quit();
@Test
loginPage.login("user", "pass");
In this example, LoginTest inherits from BaseTest, allowing it to use the setup and teardown
methods without duplicating code.
4. Polymorphism
Definition: Polymorphism allows methods to do different things based on the object that it is
acting upon. It can be achieved through method overloading and method overriding.
• Method Overloading: Multiple methods with the same name but different
parameters.Example:
java
java
element.click();
@Override
super.click(element);
Interfaces in Selenium
In Selenium, interfaces play a crucial role in defining the behavior of various components within
the framework. An interface in Java is a reference type, similar to a class, that can contain only
constants, method signatures, default methods, static methods, and nested types. Interfaces
cannot contain instance fields or constructors.Here’s a detailed discussion on the interfaces
used in Selenium, their methods, and examples of how they are applied.
1. SearchContext
• Methods:
• findElement(By by)
• findElements(By by)
• Description: This is the parent interface for all classes that can be searched for
elements. It provides methods to find elements on the page.
Example:
java
2. WebDriver
• Methods:
• get(String url)
• close()
• quit()
• navigate()
• manage()
• switchTo()
Example:
java
driver.get("http://example.com");
3. WebElement
• Methods:
• click()
• sendKeys(CharSequence... keysToSend)
• getText()
• getAttribute(String name)
• isDisplayed()
Example:
java
loginButton.click();
4. JavascriptExecutor
• Methods:
• Description: This interface allows executing JavaScript code within the context
of the currently selected frame or window.
Example:
java
js.executeScript("window.scrollBy(0, 250);");
5. TakesScreenshot
• Methods:
• getScreenshotAs(OutputType<X> target)
Example:
java
6. Navigation
• Methods:
• back()
• forward()
• refresh()
• to(String url)
Example:
java
driver.navigate().to("http://example.com");
driver.navigate().back();
7. TargetLocator
• Methods:
• frame(String nameOrId)
• defaultContent()
• alert()
Example:
java
driver.switchTo().frame("frameName");
8. Alert
• Methods:
• accept()
• dismiss()
• getText()
• sendKeys(String keysToSend)
Example:
java
9. Options
• Methods:
• addCookie(Cookie cookie)
• deleteCookieNamed(String name)
• getCookies()
• getCookieNamed(String name)
Example:
java
driver.manage().window().maximize();
10. Timeouts
• Methods:
Example:
java
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Dynamic web elements change their properties (like IDs, classes) during runtime, making them
difficult to locate consistently.
• Solution: Use XPath functions like contains(), starts-with(), or CSS selectors to create
flexible locators. Implement explicit waits to ensure elements are present before
interacting with them.
Selenium can handle browser-based pop-ups but struggles with OS-level pop-ups (like file
download dialogs).
java
For OS-level pop-ups, consider using tools like AutoIt or Robot class in Java.
New users may find Selenium challenging due to the need for programming knowledge and
understanding of web technologies.
• Solution: Invest time in learning the basics of Java (or your chosen language), HTML,
CSS, and how web applications work. Utilize online resources, tutorials, and
documentation.
4. Limited Support for Mobile Testing
Selenium primarily focuses on web applications and has limited capabilities for mobile app
testing.
• Solution: Use Appium, which is built on top of Selenium, specifically designed for
mobile application testing.
Selenium does not provide built-in reporting features for test results.
• Solution: Integrate Selenium with testing frameworks like TestNG or JUnit that offer
reporting capabilities. You can also use third-party reporting tools like Allure or
ExtentReports.
• Solution: Regularly test across all major browsers (Chrome, Firefox, Safari, Edge) using
Selenium Grid to ensure compatibility.
7. Flaky Tests
Tests may fail intermittently due to timing issues or changes in the application state.
8. Performance Limitations
Selenium can slow down when running large test suites or when interacting with complex web
applications.
• Solution: Optimize your tests by minimizing the number of interactions with the browser
and using efficient locators. Consider parallel execution using TestNG or other
frameworks to speed up test runs.
This exception occurs when an element previously found is no longer attached to the DOM (e.g.,
after a page refresh).
• Solution: Re-locate the element before interacting with it or use try-catch blocks to
handle this exception gracefully.
Selenium may struggle with complex user interactions such as drag-and-drop operations or
handling gestures on touch devices.
• Solution: Use the Actions class for simulating complex user actions:
java
• Description: Selenium Grid allows you to run tests on different machines and
browsers in parallel, significantly reducing execution time.
• Benefit: This distributed testing capability helps manage increased demand for
fast testing across various environments.
2. Parallel Testing:
• Benefit: This drastically reduces the time required for test execution. For
instance, if you have ten tests, running them in parallel can complete all in the
time it takes to run just one sequentially.
• Benefit: This reduces unnecessary delays in test execution, as the script will
wait only for specific conditions before proceeding.
• Example:
java
WebElement element =
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("elementId")));
• Benefit: Shorter tests are easier to maintain and debug. They also help in quickly
identifying failures.
• Implementation: Limit the number of steps in each test and avoid redundant
actions.
5. Utilize Fast Selectors:
• Benefit: Faster selectors reduce the time taken to locate elements on the page.
• Example:
java
driver.findElement(By.id("username")); // Fastest
• Benefit: This allows for quick setup and teardown of testing environments,
making it easier to scale resources dynamically based on load.
• Implementation: Create Docker images with your testing environment and run
multiple containers for parallel test execution.
8. Data-Driven Testing:
• Description: Implement data-driven testing to run the same test case with
multiple sets of data.
• Benefit: This enhances test coverage without needing to write additional test
scripts, making it scalable for various input scenarios.
• Benefit: This improves collaboration among team members and allows for
easier updates to test cases based on business requirements.
java
select.selectByVisibleText("Option 1");
// Select by value
select.selectByValue("option1");
// Select by index
select.selectByIndex(0);
java
actions.click().perform();
actions.click(element).perform();
java
ExpectedConditions.visibilityOf(element);
ExpectedConditions.visibilityOfElementLocated(locator);
4. Overloading methods in the WebElement interface:
The WebElement interface has overloaded methods like click(), sendKeys(),
getAttribute(), etc. to interact with web elements:
java
element.click();
element.sendKeys("text");
java
driver.get("http://example.com");
driver.findElement(By.id("id"));
• Maven Dependency: If you are using Maven, add the following dependencies to
your pom.xml file to include Apache POI:
xml
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
• Download JARs: If not using Maven, download the Apache POI JAR files from
the Apache POI website and add them to your project’s build path.
Create an Excel file (e.g., TestData.xlsx) with some sample data that you want to read in your
tests. For example, create a sheet named "Data" with the following structure:
Username Password
user1 pass1
user2 pass2
Here’s a code snippet that demonstrates how to read data from an Excel file using Apache POI
in a Selenium test:
java
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.FileInputStream;
import java.io.IOException;
// Set up WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
driver.get("http://example.com/login");
driver.findElement(By.id("username")).sendKeys(username);
driver.findElement(By.id("password")).sendKeys(password);
driver.findElement(By.id("loginButton")).click();
// Close resources
workbook.close();
fis.close();
driver.quit();
5. Iterate through Rows: Loops through each row in the sheet, retrieving data from
specific cells (username and password).
6. Selenium Actions: Uses the retrieved data to perform actions on a web application
(e.g., logging in).
7. Cleanup: Closes the workbook and file input stream, and quits the WebDriver.