Infosys Interview Question

1.What is constructer 2.How read data from excel sheet 3. Locaters in Selenium 4. Testng annotations 5. some scenario based questions

Interview Answers

Anonymous

May 6, 2020

Constructor: A constructor is a special method in java which is invoked during the object creation. Constructor has same name as class name with no return type.This is how we differentiate the method and the constructor.Constructor doesn't have any return type and the method does. We can pass the parameters to the constructor to initialize the non static variables using the this keyword. If user doesn't define any constructor then java compiler itself defines the default constructor.Here we cannot initialize the variables .The purpose of the default constructor is to initialize variables to its default values based on its type. Constructor overloading is same as method overloading.Constructor overloading is a technique in java having more than one constructor with different parameter list. A constructor in java cannot be static,final ,abstract.

4

Anonymous

May 6, 2020

There are different types of locators available in selenium to locate or identify web elements on the web page. 1.Id 2.class name 3.tag name 4. xpath 5. css selector 6.linktext 7.partial linktext

1