Discover the essential automation testing interview questions that are frequently encountered in job interviews.
Our guide equips you with the knowledge and insights needed to excel in your interview preparation and secure your dream testing role.
1) What are DesiredCapabilities in Selenium WebDriver?
Table of Contents
DesiredCapabilities in Selenium WebDriver are a set of key-value pairs that specify the browser and platform properties for test automation.
2) How to do file upload in Selenium?
To perform file upload in Selenium, use the sendKeys() method on the file input element, providing the local file path.
3) What is Robot API?
Robot API is a class in Selenium that simulates keyboard and mouse actions, allowing interaction with non-web elements like dialog boxes.
4) How to handle the HTTPS website in Selenium or how to accept the SSL untrusted connection?
To handle HTTPS websites and accept SSL untrusted connections in Selenium, set the desired capabilities to ignore SSL errors.
5) How to handle hidden elements in Selenium WebDriver?
6) What is hub and node in selenium grid?
In Selenium Grid, a hub manages test distribution and a node executes tests on different machines/browsers.
7) Name an API used for reading and writing data to excel files.
An API used for reading and writing data to Excel files is Apache POI.
8) What is the use of @ Listener annotation in TestNG?
@Listener annotation in TestNG is used to customize and manage the test execution lifecycle.
9) What is the use of @Factory annotation in TestNG?
@Factory annotation in TestNG is used to generate multiple instances of test classes.
10) What is the difference between @Factory and @ DataProvider annotation?
@Factory creates test instances while @DataProvider supplies data to tests in TestNG.
11) How can we locate an element by only partially matching the value of its attributes in Xpath?
To locate an element by partially matching its attribute value in XPath, use the contains() function.
12) What is the difference between XPath and CSS selectors?
XPath is more versatile but slower, while CSS selectors are faster but less expressive for complex traversals.
13) How to switch between multiple windows in Selenium?
To switch between multiple windows in Selenium, use driver.switchTo().window(windowHandle).
14) What is the difference between driver.getWindowHandle() and driver.getWindowHandles() in Selenium?
driver.getWindowHandle() gets the current window, while driver.getWindowHandles() returns handles of all open windows.
15) Explain the frame concept in the selenium.
In Selenium, a frame is an HTML document embedded within another HTML document, typically used for handling iframes.
16) How can we capture screenshots using Selenium?
Capture screenshots in Selenium using TakesScreenshot interface and the getScreenshotAs() method.
17) How to do drag and drop in Selenium?
Perform drag and drop in Selenium using the Actions class and its dragAndDrop() method.
18) What are the different keyboard operations that can be performed in Selenium?
Different keyboard operations in Selenium include key press, key release, and key combination using the Keys class.
19) What are the different mouse actions that can be performed using Selenium?
Various mouse actions in Selenium include click, double click, right-click, and mouse hover using the Actions class.