
Cognizant


Cognizant Automation Test Engineer Interview Questions and Answers for Freshers
Q1. How to identify object in Selenium
To identify objects in Selenium, we use locators such as ID, Name, Class Name, XPath, CSS Selector, etc.
Locators are used to identify web elements on a page
ID and Name are the most commonly used locators
XPath and CSS Selector are more powerful but slower
Class Name is useful for identifying multiple elements with the same class
Locators can be used with findElement() and findElements() methods
Example: driver.findElement(By.id("username"));
Q2. what is feature and step definitions in cucumber BDD
Feature files contain high-level description of the functionality to be tested, while step definitions are the implementation of the steps in the feature file using code.
Feature files are written in Gherkin syntax and describe the behavior of the application in plain text.
Step definitions are written in programming languages like Java, Ruby, etc., and map the steps in the feature file to automation code.
Feature files and step definitions together form the basis of Behavior Dr...read more
Q3. What would be return if multiple tabs are open
The return would be the number of tabs open in the browser.
The return value would be an integer representing the count of open tabs.
For example, if there are 5 tabs open, the return value would be 5.
Q4. What is Test case, Test plan and Test Secenarios
Test case is a set of conditions or variables under which a tester will determine whether a system under test satisfies requirements. Test plan is a document outlining the scope, approach, resources, and schedule of testing activities. Test scenarios are detailed descriptions of possible interactions with the system.
Test case: specific conditions to be tested, expected results, steps to execute
Test plan: overall strategy for testing, including objectives, resources, schedule
T...read more
Q5. Difference between absolute and relative Xpath
Absolute Xpath starts from the root element, while relative Xpath starts from any node in the DOM structure.
Absolute Xpath starts with a single forward slash (/) and starts selection from the root node.
Relative Xpath starts with a double forward slash (//) and starts selection from the current node or any node in the DOM structure.
Absolute Xpath is more brittle and prone to breaking if the structure of the page changes, while relative Xpath is more flexible and resilient to c...read more
Q6. What are the waits in selenium
Types of waits in Selenium include Implicit Wait, Explicit Wait, and Fluent Wait.
Implicit Wait: Waits for a certain amount of time before throwing a NoSuchElementException.
Explicit Wait: Waits for a certain condition to occur before proceeding further in the code.
Fluent Wait: Waits for a condition to be true with a defined polling frequency.
Example: driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Q7. How to input data in cucumber
Data can be input in Cucumber using feature files and step definitions.
Data can be input in feature files using scenarios and scenario outlines
Step definitions can be used to define the actions to be taken with the input data
Data tables can be used in feature files to input structured data
Examples keyword can be used in scenario outlines to provide multiple sets of input data
Q8. Exceptions in selenium
Exceptions in Selenium are errors that occur during test execution, disrupting the flow of the test script.
Exceptions are thrown when there is an unexpected behavior in the application under test or in the test script itself.
Common exceptions in Selenium include NoSuchElementException, ElementNotVisibleException, TimeoutException, and StaleElementReferenceException.
Handling exceptions in Selenium can be done using try-catch blocks or using Selenium's built-in exception handli...read more
Q9. Hooks in Java
Hooks in Java are methods that allow subclasses to override or extend the behavior of a superclass.
Hooks are commonly used in frameworks like JUnit and TestNG for test automation.
They are often used for setup and teardown operations before and after test methods.
Examples include @Before, @After, @BeforeClass, and @AfterClass annotations in JUnit.
More about working at Cognizant







Top HR Questions asked in Cognizant Automation Test Engineer for Freshers
Interview Process at Cognizant Automation Test Engineer for Freshers

Top Automation Test Engineer Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

