Friday, 15 January 2016

Interview Question on selenium and java

Swami
Difference between JUnit&TestNG?
Ans :

Note: Please refer http://www.mkyong.com/unittest/junit-4-vs-testng-comparison/ for more details.

Explain TestNG annotations in brief.
Ans:
Annotation    Description
@BeforeSuite    The annotated method will be run only once before all tests in this suite have run.
@AfterSuite    The annotated method will be run only once after all tests in this suite have run.
@BeforeClass    The annotated method will be run only once before the first test method in the current class is invoked.
@AfterClass    The annotated method will be run only once after all the test methods in the current class have been run.
@BeforeTest    The annotated method will be run before any test method belonging to the classes inside the <test> tag is run.
@AfterTest    The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run.
@BeforeGroups    The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
@AfterGroups    The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.
@BeforeMethod    The annotated method will be run before each test method.
@AfterMethod    The annotated method will be run after each test method.
@DataProvider    Marks a method as supplying data for a test method. The annotated method must return an Object[ ][ ] where each Object[ ] can be assigned the parameter list of the test method. The @Test method that wants to receive data from this DataProvider needs to use a dataProvider name equals to the name of this annotation.
@Factory    Marks a method as a factory that returns objects that will be used by TestNG as Test classes. The method must return Object[ ].
@Listeners    Defines listeners on a test class.
@Parameters    Describes how to pass parameters to a @Test method.
@Test    Marks a class or a method as part of the test.

What is Selenium Grid?
Ans: Selenium-Grid allows you run your tests on different machines against different browsers in parallel.
Start hub: java -jar selenium-server-standalone-2.38.0.jar -role hub
Start node: java -jar selenium-server-standalone-2.38.0.jar -role node  -hub http://localhost:4444/grid/register
Create RemoteWebDriver object
WebDriver driver = new RemoteWebDriver(hub-url,capabilities);
Write code for Palindrome. e.g madam, dad
Ans : public static void checkPalindrome(String original){
        String reverse="";
        int length = original.length();
       
          for ( int i = length - 1 ; i >= 0 ; i-- )
             reverse = reverse + original.charAt(i);
   
          if (original.equals(reverse))
             System.out.println(original+" is a palindrome.");
          else
             System.out.println(original+" is not a palindrome.");
    }
Write code to remove duplicates from arr={1,2,3,1,4,5,3};
Ans : public static void removeDuplicatesAndSort(int arr[]) {
        int end = arr.length;
        Set<Integer> set = new HashSet<Integer>();

        for (int i = 0; i < end; i++) {
            set.add(arr[i]);
        }
        Iterator it = set.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
    }
What is difference absolute & relative xpath? Write one xpath manually?
Ans:  XPATH is a language that describes how to locate specific elements, attributes, etc. in a xml document. It allows you to locate specific content within an XML document.
Location path is a specialization of an XPath expression. A location path identifies a set of XPath nodes relative to its context. XPath defines two syntaxes: the abbreviated syntax and the unabbreviated syntax. We consider only the abbreviated syntax because as the most widely used; the unabbreviated syntax is more complex.
The two types of location paths are relative and absolute.
Absolute XPath : Absolute XPath starts with / ( Note : ‘/’ is used for root path)
  e.g. a) https://webmail.in.v2solutions.com/owa/
  b) html/body/div[23]/div[4]/div[1]/div[2]/div/div
Relative XPath : Relative XPath starts with // (Note :‘//’ is used for current path)
  Syntax: //element_type[@attribute_name =’value’]
  e.g. a) //*[@id='gbqfba']
        b)//div[4]/div[1]/div[2]/div/div
  
Write code to reverse an array(int) of 1 to 10.
Ans: a) Using commons.lang java library
public static int arr[]={1,4,2,3,7,6};
    public static void revAnArray(int arr[]){
        ArrayUtils.reverse(arr);
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
    }

b) Reverse loop

public static void reverseByloop(int[] arr){
        int length=arr.length-1;
        for(int i=length;i>=0;i--){
            System.out.println(arr[i]);
        }
    }
Explain framework in brief.
What is difference between Hybrid, Native & Web apps(Android/iPhone).
Ans : a) Native app     : Apps which does not need web connectivity.
      b) Web app      :  App which runs in mobile web browser.
      c) Hybrid app    :  App having inbuilt web browser & native app components.
How to handles Alerts & Popups in selenium?
Ans: a) Alerts
Alert alert = driver.switchTo().alert();
alert.accept();

b)Popups & Windows
After click take windowhandle. Count number of windows from windowHandle. If count > 1, just close current window, switch window to parent window. 


 Ratings (out of 10) - Java, Selenium, TestNG.
Ans : Please rate it yourself.
How to handle multiple windows?
Ans:  After click take windowhandle. Count number of windows from windowHandle. If count > 1, just close current window, switch window to parent window. 

 How to handle frames?
Ans: driver.switchTo().frame(name_or_id)
driver.switchTo().frame(index)
Differences between close() & quit() browser
Ans: 1.driver.close() - Close the browser window that the driver has focus of
          2.driver.quit() - Calls dispose
          3.Dispose() Closes all browser windows and safely ends the session
What is the difference between “/” & “//” in XPath?
Ans:      / is used for root path (Absolute Path).
       // is used for current path (Relative Path)
What is root tag in TestNG xml?
Ans : <suite> is root tag in testng.xml
========================================================================================
Dharmendra
Write manual XPath: go to http://www.intuit.com/ , search for links under “About Intuit” in the footer.
Ans: Manual XPath: //h5[contains(text(),"About Intuit")]/following-sibling:: ul
How to handle multiple Windows.
Ans:
    publicclassMultipleWindowHandle {
   
    publicstaticvoid main(String[] args) throwsInterruptedException {
   
    WebDriver driver = newFirefoxDriver();
   
   
    driver.get("https://www.irctc.co.in/");
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
   
    driver.findElement(By.linkText("Tour Packages")).click();
      Set<String>windowHandle=driver.getWindowHandles();
      Iterator<String > it=windowHandle.iterator();
   
      String parentWindow="";
      String childWindow="";
   
    while(it.hasNext()){
        parentWindow=it.next();
        System.out.println("Parent window: "+ parentWindow);
        childWindow=it.next();
        System.out.println("Child Window: "+ childWindow);
      }
   
    // switching current window to child Window
    Thread.sleep(4000);
    driver.switchTo().window(childWindow);
   
    // do some operation here on child window
    System.out.println("on child window:");
   

    // switching current window to Parent Window
    Thread.sleep(4000);
    driver.switchTo().window(parentWindow);

    // do some operation here on parent window
    System.out.println("on parent window: ");
   

    // switching current window to child Window

    Thread.sleep(4000);
    driver.switchTo().window(childWindow);
    // do some operation here on child window
   
     }
}
TestNG test execution flow.
Ans:
importorg.testng.annotations.Test;
importorg.testng.annotations.BeforeMethod;
importorg.testng.annotations.AfterMethod;
importorg.testng.annotations.BeforeClass;
importorg.testng.annotations.AfterClass;
importorg.testng.annotations.BeforeTest;
importorg.testng.annotations.AfterTest;
importorg.testng.annotations.BeforeSuite;
importorg.testng.annotations.AfterSuite;

public class TestngAnnotation {
    // test case 1
    @Test
    public void testCase1() {
        System.out.println("in test case 1");
    }

    // test case 2
    @Test
    public void testCase2() {
        System.out.println("in test case 2");
    }

    @BeforeMethod
    public void beforeMethod() {
        System.out.println("in beforeMethod");
    }

    @AfterMethod
    public void afterMethod() {
        System.out.println("in afterMethod");
    }

    @BeforeClass
    public void beforeClass() {
        System.out.println("in beforeClass");
    }

    @AfterClass
    public void afterClass() {
        System.out.println("in afterClass");
    }

    @BeforeTest
    public void beforeTest() {
        System.out.println("in beforeTest");
    }

    @AfterTest
    public void afterTest() {
        System.out.println("in afterTest");
    }

    @BeforeSuite
    public void beforeSuite() {
        System.out.println("in beforeSuite");
    }

    @AfterSuite
    public void afterSuite() {
        System.out.println("in afterSuite");
    }

}
Verify the output.
inbeforeSuite
inbeforeTest
inbeforeClass
inbeforeMethod
in test case 1
inafterMethod
inbeforeMethod
in test case 2
inafterMethod
inafterClass
inafterTest
inafterSuite

===============================================
Suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================
See the above output and this is how the TestNG execution procedure is:
First of all beforeSuite() method is executed only once.
Lastly, the afterSuite() method executes only once.
Even the methods beforeTest(), beforeClass(), afterClass() and afterTest() methods are executed only once.
beforeMethod() method executes for each test case but before executing the test case.
afterMethod() method executes for each test case but after the execution of test case.
In between beforeMethod() and afterMethod() each test case executes.

Explain your framework.
How to handle cookies.
Ans:
import java.util.Set;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class FindAllCookiesInaWebSite
{
    public static void main(String[] args)
    {
        WebDriver driver=new FirefoxDriver();
        driver.get("http://in.yahoo.com/");
       
        Set<Cookie> cookies=driver.manage().getCookies();
       
        //To find the number of cookies used by this site
        System.out.println("Number of cookies in this site "+cookies.size());
       
        for(Cookie cookie:cookies)
        {
            System.out.println(cookie.getName()+" "+cookie.getValue());
           
            //This will delete cookie By Name
            //driver.manage().deleteCookieNamed(cookie.getName());
           
            //This will delete the cookie
            //driver.manage().deleteCookie(cookie);
        }
       
        //This will delete all cookies.
        //driver.manage().deleteAllCookies();  
    }
}
===========================================================================================
Pravanjan
Exaplain about '@DataProvider'?
Ans: A DataProvider is data feeder method defined in your class that supplies a test method with data .
The annotated method must return an Object[][] where each Object[] can be assigned the parameter list of the test method.
  Example Script:
@DataProvider(name = "DP1")
public Object[][] createData() {
Object[][] retObjArr={{"001","Jack","London"},
                            {"002","John","New York"},
                            {"003","Mary","Miami"},
{"004","George","california"}};
return(retObjArr);
    }

@Test (dataProvider = "DP1")
public void testEmployeeData(String empid, String empName, String city){
selenium.type("id", empid);
selenium.type("name", empName);
selenium.click("submit_button");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent(city)); }
 difference between 'implicit wait' and 'explicit wait'?
Ans:      In Implicit Wait , we define a code to wait for a certain amount of time when trying to find an element or elements. If the Web Driver cannot find it immediately because of its availability, the WebDriver will wait. The default setting is zero. Once we set a time, the Web Driver waits for the period of the WebDriver object instance.
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       

In Explicit Wait, we write a code to define a wait statement for certain condition to be satisfied until the wait reaches its timeout period. If WebDriver can find the element before the defined timeout value, the code execution will continue to next line of code. Therefore, it is important to setup a reasonable timeout seconds according to the system response.
WebDriverWait wait = new WebDriverWait(driver, 30); 
wait.until(ExpectedConditions.presenceOfElementLocated(by));

 Difference between 'final' and 'finally'?
final:
    final is a keyword. The variable declared as final should be initialized only once and cannot be changed. Java classes declared as final cannot be extended. Methods declared as final cannot be overridden.
   
finally:
    finally is a block. The finally block always executes when the try block exits. This ensures that the finally block is executed even if an unexpected exception occurs.

 Do you have any idea about 'jenkins'?
Ans:     Jenkins is one open source tool to perform continuous integration.
The basic functionality of Jenkins is to monitor a version control system and to start and monitor a build system (for example, Apache Ant or Maven) if changes occur.
Jenkins monitors the whole build process and provides reports and notifications to alert maintainers on success or errors.

  How to skip particular test using 'TestNG'?
Ans: @Test(enable=false)
  ========================================================================================
Veera
What is the difference between “/” & “\” in java?
“/” :  - Allows in file path.
“\” :  - Doesn’t allow in file path, but “\\” allows in file path.
What are the Assertions and their drawbacks?
Assertions are conditional statements like if…else.
Drawback: Assertion aborts the execution when assertion fails
Difference between hashmap & hashtable?
Hashmap:
It is not synchronized
Allows one null key & any number of null values
Hashtable:
It is synchronized
Doesn’t allow null keys or values
Explain about framework.
Write program for reverse of a string without using reverse () method.
public class Test {
    public static void main(String[] args) {
        String s="Madam";
        String s1="";
        for(int i=s.length()-1; i>=0; i--){
            s1=s1+s.charAt(i);
        }
        System.out.println(s1);
    }
}
Write a program for getting all data from webtable.
  public class WebTable {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.get("url");
        WebElement table = driver.findElement(By.xpath("html/body/div[1]/div/div[4]/div[2]/div[2]/table"));
        List<WebElement> rows = table.findElements(By.tagName("tr"));
        System.out.println("Total Row-->" + rows.size());
        for (int rowNum = 0; rowNum < rows.size(); rowNum++) {
            List<WebElement> cells = rows.get(rowNum).findElements(By.tagName("td"));
            System.out.println("Total Cols-->" + cells.size());
            for (int colNum = 0; colNum < cells.size(); colNum++) {
                System.out.print(cells.get(colNum).getText() + "\t");
            }
            System.out.println();
        }
    }
  }

How to handle multiple instances in grid
What is Interface and one example
An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.
What is abstract class & example
An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.
Difference between class, abstract class & interface
Main difference is methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.
Variables declared in a Java interface is by default final. An  abstract class may contain non-final variables.
Write a code for Handling multiple window & java script alerts
Handling multiple window:
public void handleMultipleWindows(String windowTitle) {
             Set<String> windows = driver.getWindowHandles();
              for (String window : windows) {
                 driver.switchTo().window(window);
                 if (driver.getTitle().contains(windowTitle)) {
                return;
                     }
                     }
    }
    Javascript alerts:
        //First we need switch the control to alert.
           Alert alert = driver.switchTo().alert();
    //Getting alert text
            alert.getText();
    //Click on OK
           alert.accept();
    //Click ok Cancel
     alert.dismiss();
Write a code for sorting an array without using Collections
  class Sort {
    public static void main(String[] args) {
        int n, c, d, swap;
        Scanner in = new Scanner(System.in);
        System.out.println("Input number of integers to sort");
        n = in.nextInt();
        int array[] = new int[n];
        System.out.println("Enter " + n + " integers");
        for (c = 0; c < n; c++)
            array[c] = in.nextInt();
        for (c = 0; c < (n - 1); c++) {
            for (d = 0; d < n - c - 1; d++) {
                if (array[d] > array[d + 1]){ /* For descending order use < */
                    swap = array[d];
                    array[d] = array[d + 1];
                    array[d + 1] = swap;
                }
            }
        }
        System.out.println("Sorted list of numbers");
        for (c = 0; c < n; c++)
            System.out.println(array[c]);
    }
}

Write a logic for bubble & quick sort
Bubble Sort: Refer this link http://www.roseindia.net/java/beginners/arrayexamples/bubbleSort.shtml
Quik Sorrt: Refer this link “http://www.roseindia.net/java/beginners/arrayexamples/QuickSort.shtml”
Write a code for reverse of a dynamic string
    public static String reverse(String input) {
        String s1="";
        for(int i=input.length()-1; i>=0; i--){
            s1=s1+input.charAt(i);
        }
        System.out.println(s1);
    return s1;
    }
What is page object model?
Within your web app's UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place.
More details refer http://code.google.com/p/selenium/wiki/PageObjects

What are design patterns in java?
Refer this link http://www.tutorialspoint.com/design_pattern/design_pattern_quick_guide.htm

============================================================================
Final Round Intuit questions
Swami
Write a java code for Linked List basic operations without using any predefined collections or methods.
Sort an array int arr[]={-1,10,0,3,-5,4,0,3,8};
& also remove duplicates from an array in single function, without using sort function or any java collection.
Reverse a String and also identify is it palindrome or not. E.g “Hello mam ! How are you?”
Write selenium script for following html code to verify all select box text with manual xpath.
<Select id=”intuit”>
    <option 1=”IB”/>
    <option 2=”TD”/>
    <option 3=”TS”/>
</Select>
Explain your framework.

Dharmendra
Event and Listeners in Java?
Ans:
Events are basically occurrence of something. Changing the state of an object is known as an event.
We can perform some important tasks at the occurrence of these exceptions, such as counting total and current logged-in users, creating tables of the database at time of deploying the project, creating database connection object etc.
There are many Event classes and Listener interfaces in the javax.servlet and javax.servlet.http packages.
Event classes
The event classes are as follows:
ServletRequestEvent
ServletContextEvent
ServletRequestAttributeEvent
ServletContextAttributeEvent
HttpSessionEvent
HttpSessionBindingEvent
Event interfaces
The event interfaces are as follows:
ServletRequestListener
ServletRequestAttributeListener
ServletContextListener
ServletContextAttributeListener
HttpSessionListener
HttpSessionAttributeListener
HttpSessionBindingListener
HttpSessionActivationListener
What is inheritance and where have you implemented that in your framework?
Ans:
Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object.
The idea behind inheritance is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you reuse (or inherit) methods and fields, and you add new methods and fields to adapt your new class to new situations.
    Inheritance represents the IS-A relationship.
In our framework we have created a class with method name “OpenBrowser” which inherit the functionality of “Driver” class for different browsers.

How do you handle dynamic element in Selenium?
Ans:
starts-with
if your dynamic element's ids have the format  where button id="continue-12345"  where 12345 is a dynamic number you could use the following
XPath: //button[starts-with(@id, 'continue-')]
contains
Sometimes an element gets identfied by a value that could be surrounded by other text, then contains function can be used.
To demonstrate, the element can be located based on the ‘suggest’ class without having to couple it with the ‘top’ and ‘business’ classes using the following
XPath: //input[contains(@class, 'suggest')].

How will you stop the instance of driver after completion of test script?
Ans:    The quit() method will kill the WebDriver instance.
    driver.quit();
Explain WebDriver.
Ans:
WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.

How to find user defined objects as a key from LinkedHashMap?
Ans:
    We can achieve this by implementing equals and hash code methods at the user defined objects.
publicclassMyObjectKeySearch {

publicstaticvoidmain(String a[]){
        
        LinkedHashMap<Price, String> hm = newLinkedHashMap<Price, String>();
        hm.put(newPrice("Banana", 20), "Banana");
        hm.put(newPrice("Apple", 40), "Apple");
        hm.put(newPrice("Orange", 30), "Orange");
        printMap(hm);
        Price key = newPrice("Banana", 20);
        System.out.println("Does key available? "+hm.containsKey(key));
    }
    
    publicstaticvoidprintMap(LinkedHashMap<Price, String> map){
        
        Set<Price> keys = map.keySet();
        for(Price p:keys){
            System.out.println(p+"==>"+map.get(p));
        }
    }
}

classPrice{
    
    privateString item;
    privateintprice;
    
    publicPrice(String itm, intpr){
        this.item = itm;
        this.price = pr;
    }
    
    publicinthashCode(){
        System.out.println("In hashcode");
        inthashcode = 0;
        hashcode = price*20;
        hashcode += item.hashCode();
        returnhashcode;
    }
    
    publicbooleanequals(Object obj){
        System.out.println("In equals");
        if(obj instanceofPrice) {
            Price pp = (Price) obj;
            return(pp.item.equals(this.item) && pp.price == this.price);
        } else{
            returnfalse;
        }
    }
    
    publicString getItem() {
        returnitem;
    }
    publicvoidsetItem(String item) {
        this.item = item;
    }
    publicintgetPrice() {
        returnprice;
    }
    publicvoidsetPrice(intprice) {
        this.price = price;
    }
    
    publicString toString(){
        return"item: "+item+"  price: "+price;
    }
}

Explain quick sort.
Ans:
Quicksort or partition-exchange sort, is a fast sorting algorithm, which is using divide and conquer algorithm. Quicksort first divides a large list into two smaller sub-lists: the low elements and the high elements. Quicksort can then recursively sort the sub-lists.
Steps to implement Quick sort:
1) Choose an element, called pivot, from the list. Generally pivot can be the middle index element.
2) Reorder the list so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.
3) Recursively apply the above steps to the sub-list of elements with smaller values and separately the sub-list of elements with greater values.
public class MyQuickSort {

    private int array[];
    private int length;

    public void sort(int[] inputArr) {

        if (inputArr == null || inputArr.length == 0) {
            return;
        }
        this.array = inputArr;
        length = inputArr.length;
        quickSort(0, length - 1);
    }

    private void quickSort(int lowerIndex, int higherIndex) {

        int i = lowerIndex;
        int j = higherIndex;
        // calculate pivot number, I am taking pivot as middle index number
        int pivot = array[lowerIndex+(higherIndex-lowerIndex)/2];
        // Divide into two arrays
        while (i <= j) {
            /**
             * In each iteration, we will identify a number from left side which
             * is greater then the pivot value, and also we will identify a number
             * from right side which is less then the pivot value. Once the search
             * is done, then we exchange both numbers.
             */
            while (array[i] < pivot) {
                i++;
            }
            while (array[j] > pivot) {
                j--;
            }
            if (i <= j) {
                exchangeNumbers(i, j);
                //move index to next position on both sides
                i++;
                j--;
            }
        }
        // call quickSort() method recursively
        if (lowerIndex < j)
            quickSort(lowerIndex, j);
        if (i < higherIndex)
            quickSort(i, higherIndex);
    }

    private void exchangeNumbers(int i, int j) {
        int temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }

    public static void main(String a[]){

        MyQuickSort sorter = new MyQuickSort();
        int[] input = {24,2,45,20,56,75,2,56,99,53,12};
        sorter.sort(input);
        for(int i:input){
            System.out.print(i);
            System.out.print(" ");
        }
    }
}

What do you know about Jenkins?
Ans:
Jenkins is one open source tool to perform continuous integration. The basic functionality of Jenkins is to monitor a version control system and to start and monitor a build system (for example, Apache Ant or Maven) if changes occur. Jenkins monitors the whole build process and provides reports and notifications to alert maintainers on success or errors.
Jenkins can be extended by additional plug-ins, e.g., for building and testing Android applications.
What are different ways in which you can generate the reports of TestNG results?
Ans:
Listeners: For implementing a listener class, the class has to implement the org.testng.ITestListener interface. These classes are notified at runtime by TestNG when the test starts, finishes, fails, skips, or passes.
Reporters: For implementing a reporting class, the class has to implement an org.testng.IReporter interface. These classes are called when the whole suite run ends. The object containing the information of the whole test run is passed to this class when called.
How to get screen shot in WebDriver?
Ans:
    File screenShot=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(screenShot, newFile("D:\google_page.png"));
What has been the greatest challenge you have faced in your project?
Why are you looking for a change?
Other interview questions:::::::
interview questions asked in Cignity.....
1. What is the process followed in your company can you explaiin each stage in detail
2. Consider any scenario of your project and write test script how you will test the scenario
3. what are frameworks? what is the framework followed in your company
4. Can we handle page onload alert message which fetches some data from our local disk
5. how do you find locators of a component on your web page using webdriver. Write program
6. How do you handle different windows write prgm
7. how you fetch data from .bat of text file of you application write webdriver program?
8. write a program for reverse of a string without using reverse string command normal prgm
9. how do you check whether a certain element/text/title is present in your webpage using webdriver(as if we do verifyText/verifyTitle in IDE)
can anyone provide answers for all these question.....
Answer:::::::::::::::
1 and 2 that's u need to explain as per ur proj.
3- data driven, keyword driven, modular driven, function driven, hybrid driven and page object model.
4- if it is related to page load then we can say implicit wait for page we can use- driver.manage().timeouts().pageLoadTimeout(arg0, arg1)
5- write any simple program and use all locators.
ex- driver.findElement(By.id(" ")) etc.
6- Iterator<String> windows = driver.getWindowHandles().iterator();
String main = windows.next();
String child = windows.next();
driver.switchTo().window(child);
7- i think they have asked for the command which we used to run the suite thru command promt so the command is-
java -cp bin;jars/* org.testng.TestNG testng.xml
8- Reverse a given statement
Input: “This is a book”
Output: “book a is This”
Ans- class Reverse{
public static void main(String args[]) {
String input = "This is a book";
String output = "";
int l=input.length();
int j =0;
for(int i=l-1; i>=0; i--){
j++;
if(input.charAt(i)==' '){
output = output+input.substring(i+1, l)+" ";
l = l-j;
j=0;
}
if(i==0 && input.charAt(i)!=0){
output = output+input.substring(i, l);
}
}
System.out.println(output);
}
}
Other company interview questions:;:::::::
1)You said , you were involved in your Datadriven Framework,now tell me how Handling Multiple Pop Ups & Handling Multiple Windows differ with each other or what are similarities in the approach?Are they same or different?
2)In our company we are using Flex, are you aware of Flexdriver Automation and what is it?
3)What is the difference between Flash and Flex Automation.
4)Handling Multiple Frame
5)What is type casting?Can you tell me a scenario where you had came across the same in your Selenium Project?
6)How to handle dynamic object.
7)How to work with button which is in div tag and and u have to click without using xpath
8)How to parameterized your Junit and TestNG.
9)How to handle ssl security
10)What are the data structure you are aware of.
11) There is page, in selenium how do you check whether it is completely loaded or not.
12) How do you check whether page is stuck in infinite loop.
13) what are the annotation in testng.
14)How do you run dependent test cases, bulk run.
15) Write selenium to login into yahoo, with proper assertions and validation.
16)Write test case for add cart functionality of flip kart.
17)Write a program to reversing a sentence, ex "this is [24]7" o/p "[24]/7 is this"
11)Disadvantages Of Selenium.
12)Unlike Object Repository Concept present in QTP,can you throw some light in accordance with Selenium.
13)In your day to day automation activities,what are the challenges that you had faced while automating scripts in Selenium.
14)Are you aware of Selenium Grid Architecture, Apart from Hub and Nodes Concepts,tell me something interesting about it?
15)For Capturing ScreenShot,Here is the code,Now tell me what each one of them stands for :
// Take screenshot and store as a file format
File src= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
16)Can you store an image other than png format and how ?
17)I am giving you two scripts based on JavascriptExecutor?
i>((JavascriptExecutor)driver).executeScript("document.getElementById('txt2').value='Password'");
try {
FileUtils.copyFile(src, new File("C:/selenium/error.png"));
}
ii> js.executeScript("arguments[0].setAttribute('style,'border: solid 2px red'')", username);
What compels you to use document,arguments attributes.Are you aware how to write test cases using JavaScript.
6+++++++++++++++
How to switch between frames when frames id are not provided?
2)What do you know about Client Libraries?
3)Can you briefly explain about Selenium WebDriver Architecture?
4)Explain what is AJAX?
5)What is FluentWait,How is it different from Explicit Wait and ImplicitWait?
6)Difference between Thread.Sleep() and Explicit Wait.
7)Why CSS is faster when compared to Xpath?
8)How will you automate Tab Key present on your keyboard?
9)In an Action Class ,have you ever come across Chord() and Key.What are they and their uses.
10)How will you automate ALT & number 4 present on your keyboard through Action Classes
+++++++++++++++++++Cognizant interview questions+++++++++++++++

1. tell me abt urself
2. what is stlc
3. what is test planning
4. defect life cycle
5. what is inheritance
6. method overloading and overriding
7. framework & framework used in the company
8. what is Parametisation and how do you use it in TestNG
9. how do you execute the tests based on priority
10. what are the annotations
11. what is the order of executing the annotations
12. when a test suite is executed in the order
13. Tell me anything about collections
14. interfaces
15. what is the difference between interface and a class
16. what are arrays and list difference between them
17. Is parameterisation possible and how(Tell the coding)
18. how do you check whether a test script is passed or not
19. if a test case fails how will you log the failure and the exception that caused. how will you report the result to your team lead, prj manager and the customer
20. what is the framework you are using for logging the bugs
21. How do you submit all the test scripts, execution results to you TL, PM
22. what is the process followed in you company
23. what is the difference between agile methodology and spiral modal
24. what is requirement traceability matrix
25. how do hover a link which is present on web page which opens a pop up containing a link.how do you click on the link that is in th pop up
26. prgm for reading a excel file
27. how do you initialise a chrome browser
28. SQl-joins,difference between inner joins and outer joins
29. i am having a table which consists of student details,id, marks and how do i fetch the second maximum value from the table
30. I am having two tables one having student id, student name,and the college id and the other table having college id,college name, location now i want to get map these two tables and get the students who are studying in a specific college
31. i want the count of all the students who belongs to same location
---interview questions in cognizant
+++++++++++++++++++++++++++++++++++++++
Altimetrik interview questions
1. Tell me about urself
2. What are Test Management tools used
3. What is the process followed in your company
4. What are the advantages of Agile methodology
5. What is the bug tracking tool used? what are the mandatory fields in the bug tracking tool? Explain all the fields
6. How will you log bug in the tracker?
7. what is the difference between Severity and priority? give an example
8. What Testing Life Cycle
9. What is defect life cycle
10. What are different status of bug
11. Consider a login window having a logo of the company and fields as Username, Password, Submit and cancel buttons. The conditions are for username should contain 6 to 9 characters and should accept only characters and password should be 8 to 10 integers. What is the number of test cases we can write for this scenario
12. When logged in home page is displayed with header as Myaccount, Mails, Outbox, Drafts what are the number of test cases
13. What is the automation tool used and what are the advantages
14. How will you enter value in a text box using selenium webdriver
15. How do you select value in a text box using text write the command for it
16. How do you select value from the drop down by reading the value from an excel sheet
17. what is the difference between get and navigate
18.What is TestNG
19. What are the annotations of TestNg
20. What is the process of execution of TestNg
21.how do you swap two numbers without using a third variable
22. consider a scenario having a textbox which accepts only 0-99 integers, and it is a mandatory field. List out all the negative and positive test cases
23. In the above scenario does it accepts 0099 value. Is this a negative test case or a positive test case?
24. What is the difference between array and arraylist
25. write a java program for reverse of a string
26. Consider an excel sheet having data of employee table
EMP name Salary
Emp1 100
Emp 2 400
Emp 3 500
Emp 4 200
Emp 5 100
How will you read the excel sheet, check the condition that salary>100 and print all the emp names
27. What are locators in selenium
28. What is difference between LinkText and PartiallinkText
29. If elements keeps on changing dynamically then what are the locators to access such elements
30. What is the order of preference of locators used in your company
31. Consider a scenario, a web page is having only one link named as “Link” how will you write the xpath for accessing that link
32. How do you locate an element on webpage using Selenium Ide
33. Differentiate relative xpath and absolute xpath
34. If an element is no having the locator id then how will you access it? What is the next locator you are going to use? why?
35. Is link and partial link case sensitive explain with an example
36.how do you locate the locators of an element
37. how can you say the locator of element is correct?
38.consider a scenario having an url login page and home page after logging in with valid user. Now explain how will you test it using TestNG framework. (we have to explain what comes under @Test,@BeforeTest and @AfterTest.)
Tell me about urself
2. What are Test Management tools used
3. What is the process followed in your company
4. What are the advantages of Agile methodology
5. What is the bug tracking tool used? what are the mandatory fields in the bug tracking tool? Explain all the fields
6. How will you log bug in the tracker?
7. what is the difference between Severity and priority? give an example
8. What Testing Life Cycle
9. What is defect life cycle
10. What are different status of bug
11. Consider a login window having a logo of the company and fields as Username, Password, Submit and cancel buttons. The conditions are for username should contain 6 to 9 characters and should accept only characters and password should be 8 to 10 integers. What is the number of test cases we can write for this scenario
12. When logged in home page is displayed with header as Myaccount, Mails, Outbox, Drafts what are the number of test cases
13. What is the automation tool used and what are the advantages
14. How will you enter value in a text box using selenium webdriver
15. How do you select value in a text box using text write the command for it
16. How do you select value from the drop down by reading the value from an excel sheet
17. what is the difference between get and navigate
18.What is TestNG
19. What are the annotations of TestNg
20. What is the process of execution of TestNg
21.how do you swap two numbers without using a third variable
22. consider a scenario having a textbox which accepts only 0-99 integers, and it is a mandatory field. List out all the negative and positive test cases
23. In the above scenario does it accepts 0099 value. Is this a negative test case or a positive test case?
24. What is the difference between array and arraylist
25. write a java program for reverse of a string
26. Consider an excel sheet having data of employee table
EMP name Salary
Emp1 100
Emp 2 400
Emp 3 500
Emp 4 200
Emp 5 100
How will you read the excel sheet, check the condition that salary>100 and print all the emp names
27. What are locators in selenium
28. What is difference between LinkText and PartiallinkText
29. If elements keeps on changing dynamically then what are the locators to access such elements
30. What is the order of preference of locators used in your company
31. Consider a scenario, a web page is having only one link named as “Link” how will you write the xpath for accessing that link
32. How do you locate an element on webpage using Selenium Ide
33. Differentiate relative xpath and absolute xpath
34. If an element is no having the locator id then how will you access it? What is the next locator you are going to use? why?
35. Is link and partial link case sensitive explain with an example
36.how do you locate the locators of an element
37. how can you say the locator of element is correct?
38.consider a scenario having an url login page and home page after logging in with valid user. Now explain how will you test it using TestNG framework. (we have to explain what comes under @Test,@BeforeTest and @AfterTest.)
===========company assked interview questions============
What is difference between SDLC and STLC?
• What is compatibility testing?
• What is the difference between functional testing and Black box testing?
• What is V-model and Agile model?
• What is smoke testing and sanity testing?
• How many test cases are there in your project?
• How to test the credit card login page, if client doesn’t given any data for testing?
• You have potential to do 10 test cases per day but clint want you to do 250 test cases in 7 days ?
• How many test cases you will do in a day?
• When you will delivery to the client
• Did you deliver any project as of now? When was the last delivery?
• What bug you file recently?
• You test the application in your system raise the bug, but developer system not coming that bug, how to convince them?
• How you will raise the defect?
• Explain the complete flow to raise the bug?
• How you will plan the test requirements?
• Do you exposed to jira?
Continued..........
• How would you know your raised bug is duplicate or not? Did you have any option in QC to find that?
• Do you know about performance testing?
• Which browser you used to test the application?
• Which version you used in firefox?
• What is greatest achievement in your current role?
• What was the critical defect you have submitted till now?
• Which command do you use in linux to know the processor in your system?
• What is the use of find and grep?
• What are your strengths and weakness?
• What is your challenges and failures in your current role?
• Why should we hire you? Tell me a strong reason?
• What is joins? What is outer join?
• How to find second highest salary?
• How can I know whether I have covered all the requirements in test cases or not in a project?
• If I give you android mobile what you test and how to test in android mobile?
• If I give one online application how can you test?
• Explain what is exploratory testing?
• If I give online shopping site without any requirements how can you test?
• What functional testing you do in a site?
• How do you check credit card module in online shopping?
• Tell me about one project in your last company.
• What do you meant by RC in selenium?
• How to you plan your work in your office?
• How to find last file in a directory?

Unlike
Today I attended a Telephonic Round from Altimetrix for a CMMI-5 Level Company(a prestigious Client).
What are Inner and Outer Classes and where do we use them...?Give an Example.
2) How do you retrieve the WebTable content and print them.Explain the code WITH and WITHOUT using Iterator...?
   2nd ans:
  package Selenium_Practice;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
public class Dynamic_Webtable_World_Clock {
public static void main(String[] args) {
ProfilesIni pr = new ProfilesIni();
FirefoxProfile fp = pr.getProfile("FirefoxProfile_Selenium");
FirefoxDriver driver = new FirefoxDriver(fp);
driver.get("http://www.timeanddate.com/worldclock/");
driver.manage().window().maximize();
WebElement table = driver.findElement(By.xpath("html/body/div[6]/table"));
List<WebElement> rows = table.findElements(By.tagName("tr"));
for(int i = 0; i<= rows.size(); i++)
{
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
for(int j = 0; j < cols.size();j++)
{
System.out.print(cols.get(j).getText() + "---------");
}
System.out.println();
}
}
}
3) How do you print the values from the drop down list WITHOUT using "Select" Class....?
4) What are different Element locators available in Selenium...?
5) Collections - Tell me brief about them and explain about any two of them...that are used in your project...?
6) Difference between List,Set and Map...?
7) How do you launch a webpage using selenium webdriver code...?Mention the packages that you use when doing the same...?
8) Briefly describe about your project and what is the Automation framework used...?
9) Explain about POM...?.
10) Explain about Hybrid Framework...?
11) ATLC...?
  11th Ans:
11)Automation Life Cycle (I had uploaded a ppt on the same in group's File section)
Test Planning
Analyze AUT
Setup Test Environment
Generating basic Tests
Enhancing Tests
Debugging Tests
Setup Test Environment
Analyzing Test Results
Bug Reporting
12) Bug Life Cycle...?
13) Differences between Interface and Abstract Class...and when and where do we use them...?.Answer briefly in two lines...?.Note: No indepth answer was expected here...due to lack of time for me.But,be prepared for an elaborate answers to be given in your case.
14) How do you print all the links present in a webpage...?
     14th ans:
14) List<WebElement> links= driver.findElements(By.tagName("a"));
System.out.println("Total links = " +links.size());
for(int i =0;i<links.size();i++){
System.out.println(links.get(i).getText()):
}
The interview was for a position of a Automation Test Engineer with 2 Yrs of experience in Selenium with an overall of 5+ Yrs experience in Testing.


Hi All,Today I attended a F2F Technical round in Indecomm.
The following are the interview Questions.
1) Difference between XPath and CSS...?
What are the advantages of using one over the other....?.Which one do you prefer to use and why....?.When do you use XPath and CSS....in what scenarios...?.Note: I was asked the full form of XPath.Prepare to answer in your case.
2) Difference between "/" and "//"...?
3) Which one is faster between XPath and CSS... and why....?.Note: Prepare yourself to give an elaborate answer....its their way of drilling you... to know how much do you know about element locators in selenium...?
4) Give a list of all the Element Locators in Selenium...?
5) What is Stale Element Reference Exception...?.How do you handle it...?
6) Write a code to open a browser and provide a url to it and open the webpage of that url...?
Note: The interviewer is expecting you to know the import statements too...?.Be Prepared.
7) WebDriver Wait..?How many types...?.Give an example of each of them...?
8) What are immutable Objects...?.Give an example...? (Java Question)
9) Apart from the firefox browser, which other browsers you have used for testing your application...?.Note: Prepare for some touch questions....If you have said,YES,for the question and have mentioned.... I.E,G.C and Safari are the browsers that you have worked on...?
10) How do you perform the Reporting of the test cases that you have executed to your client...?
11) About Agile Testing and its Methodology...?
Note: These questions were asked for a Selenium Automation Test Engineer with 2 Yrs of experience in Selenium Automation and an overall experience of 7+ in Software Testing.
P.S: In this group,if anyone are attending the interviews regularly,kindly post the questions,so that others can benefit from them.
Thanks,
Chaitanya
VM Ware

Below are the Questions are asked in my 3 rounds of technical interview:
--------------------------------------------------------------------------------------
1. What are the different types annotations used in TestNG? How to use the
@Beforesuite and @AfterSuite annotations in TestNG?
2. How do we achieve parallel execution in TestNG?
3. What are the different arguments are passed along with @Test annotation in TestNG?
4. How do we include and exclude the groups in the TestNG xml file?
5. How to use the dataprovider in TestNG with an example?
6. How do u idenityfy the objects? In what scenarios these locators are
used? Ex: name, id, xpath, linktext, csslocator, Partial linktext
7. Difference between Datadriven and Hybrid Frame work?

Java:
----
1. What is Abstract class? Where we will use Abstract Class in java?
2. What is interface? Difference between Abstract class and interface?
3. Difference between normal methods and Abstract methods in Java?
4. Why we are using constructors in java?
5. Difference between overloading and overriding ?
6. Explain "static" keyword in java and it's usage?
7. Why multiple inheritance is not supported in java?
8. Difference between "extend" and "implement" in java?
9. Explain the access specifiers public, Private, protected and default in

java with their visibility and security?
10. What are the difference between primitive and derived data types?
11. Difference between final, finally and finalize method in java?
12. How do we handle the exceptions in java? and Exception hierarchy in
java?
13. Why we are using finally block in java?
14. Can we handle the exception with try and without catch block?
15. Write a java program for whether the given string is palindrome or not?
16. Difference between String constant and String non-constant pools?
17. Give the example for String immutable code?
18. Difference between "==" and "equals()" in String class?
19. How to compare the two strings in java?
20. How to sort the elements in the Array? Syntax of the Array?
21. What is Collections Framework in Java?
22. What are the difference between Array and ArrayList in java? Give the
examples for each?
23. What is Set in the Collections? How to move from element to another
element in the Set?
24. Usage of Iterator interface?
25. How to use HashMap in the collection and sample code?
26. How many ways to implement Threads in java?


HCL interview Question
===================================
1st technical
From Java
1.What is the Difference between final,finally,finalize
2.what is the difference between Call by value and call by referance
3.How to find out the length of the string without using length function
4.How to find out the part of the string from a string
5.difference between throw & throws
6.What is binding(Early and Late binding)
He give Programes
1.Reverse a number
2.1,2,3,4,5,65,76,5,,4,33,4,34,232,3,2323,
find the biggest number among these
simple string programe.
what is exception types of exception
From manual
what is the testcase technique
why we write test case.
bug life cycle
what are the different status of bug
what is the different between functional and smoke testing
what is STLC.
from Selenium
what is testng and its advantage
how to handle SSl/
how to handle alert
how to take screenshot
give the diagram write a scrpt..
tell me about Project .What are the challenge face during project
what is the difference between RC and webdriver
what is freamwork explain it.
why we use wait statement.
2nd technical
he gives a application & tell to write the scenario
some manual testing concepts.

====================================
HappyestMind & Ness
===================================

Selenium
1.Write the syntax of drop down
2.What is Webdriver-Java interface
3.What is the current Version of Selinum webdriver
4.How to get the text value from text box
5.StrinG x="ABC";
String x="ab"; does it create two objects?
6.write a program to compare the strings
7.Class a
{
}
class b extends a
{
}
A a= new A();
B b=new B();
A a= new B();
B a=new A();
Which is valid and invalid?
8.How to handle differnt type of pop up.(Wnidow,Alerts,Invisible popup)
9.How to handle DropDown menu
10. How to handle SSL certificate
11.How to handle Google search text.
12. How to handle dynamic text box which contains the 3 numbers, get
the number and add the three number and add it other text box.
13.How to handle Ajax Objects
8.Explain webdriver architecture
9.Explain File downloading
10.Explain File attachments other that Auto IT
11.Write the syntax for finding the row count in dynamic web table
12.Differnece between class and Interface
13. What type of class is the string class
14.WHAT are the differnt methods that are used along with Xpath
15.Explain Interface
16 Explain Abstract
17.What is selenum grid
18 what is selenium RC
19.Why is key word drivern frame work only choosen,
1. how to handle dynamic object
2. how to work with button which is in div tag and and u have to click
without using xpath
3. JVM is dependent or independent platform

4.how many Test script you write in day
5. describe your framework
6. how to parameterized your junit
7.how to handle ssl security
8. how to handle window pops
9. diffnct between implicit and explicit
10.what are the types of assertion and what are assertion in junit
11.How to handle ssl certificate
12.What is dom concept
13.What is the challenges u have faced during Automation
14What is genrics
15.What is synchronization

Java
1.JVM is dependent or independent platform
2.diffn bw hashmap and hash set, set and linkedlist, arraylist and
vector list , linkedhash set and hashset
3.abstract and interface
4.throw and throws
5.how to split
6.checked and unchecked exception
7.how to work with azax aplication
8.why sring is immutable
9.wat is the retru ntype of getwindowhandles();
10.what are the types of assertion and what are assertion in java
11.differnce between interface and Abstract classes
12.What is static varaible
13.what is volitile
14. what is trainsient
15.what is the differnece between Final,Finalize and finally
16.what is the differnce between Public,private and protected

==========================================
FICO
===========================================

1.what is the default package in java ?
2.: why we use interface why not abstract class ...what if i implements same method in interface and abstract ....thn ?? any diffrnc??
3. what are inner classes ..name them ?
4.in public static void main(String arr[])... what if i replace public with private ........... remove static ........replace void with string
5.in hash map we have (key and value ) pair , can we store inside a value =(key, value ) again ??
5. what are variable scope in java (in class , in method , in static block)
6. what are the oops concept ? explain them each with real world examples
7.write a program so that when ever u create a object ... u get to know how many object u have created
8. what is singleton classes ?
9.what is difference between .equals() , (==) and compare-to();
10. what is the difference between hash code and equals
11.write a program to get substring of string ex: javais good ... so result : avais
12.write a program to reverse the string
13. wap for binary search
14.what is the use of package
15. why we use interface and abstract
16.we have 2 interface both have print method , in my class i have implemented the print method , how u wil get to know that i have implemented the first interface and how u will use it .. if u want to use it
17.what is the difference between vector list and arraylist
18. difference between hashmap and hash table, what is synchronization , how it is achieved
19. what is the use of collection, when we use it
20. what is priority queue in collection , what is the use , how u have use in your project
21.where to use hashmap and hashtable
22. where u have use the concept of interface and abstract in your framework
23.

==============================================
SPAN Info tech
=============================================

Selenium question:

How to work with dynamic webtable ?
What is asserstion & types of asserstion ?
what to work with file attachment & file download in webdriver ?
How to file attachment with out Autoit scripts ?
how to work with weblist @ radio button in webdriver ?
what is the difference between the implicit wait & webdriver wait ?

Which repository you have used to store the test scripts ?
What is Check-in & check-out , revert ?
how to work with Radio buttun ?
how to work with weblist ?
what is the use of Actions class in webdriver?
how to work with keybord and mouse opration in java ?
how to get the text from the UI in runtime ?
expain the Architructure of Webdriver?
How to run the test scripts with mulitiple browser ?

Java Qustion

IN parent and child class i have disp() methode , using child class reference how to call parent disp() methode ?
what is the use of this keyword
how many types execption avilable in java?

difference between final finaly , finalize?
difference between Overriding and overload ?
differebce between MAP & set ?

================================================
Mind tree interview Question
===================================================

Selenium
1. how to handle dynamic object
2. how to work with button which is in div tag and and u have to click without using xpath
3. JVM is dependent or independent platform

4.how many Test script you write in day
5. describe your framework
6. how to parameterized your junit
7.how to handle ssl security
8. how to handle window pops
9. diffnct between implicit and explicit
10.what are the types of assertion and what are assertion in junit

Java
1.JVM is dependent or independent platform
2.diffn bw hashmap and hash set, set and linkedlist, arraylist and vector list , linkedhash set and hashset
3.abstract and interface
4.throw and throws
5.how to split
6.checked and unchecked exception
7.how to work with azax aplication
8.why sring is immutable
9.wat is the retru ntype of getwindowhandles();
10.what are the types of assertion and what are assertion in java

=================================================
Indicomm Interview Question
================================================

Interview Questions AltiMetrik

1 what is inheritence?Explain the use of inheritence?
2 what is abstract class?
3 what is interface?
4 when to use inheritence and when to use abstract class?
5 what happence if i not provide abstract method in abstract class

and interface?
6 what is method overriding java what is the use of method

overriding?
7 what is constructor ?use of constructor and can i ovverride the

costructor?
8 how to call the super class method in subclass?
9 what is the base class for all java class?tell me the methods?
10 what is hashcode method explain programtically(asked

implementaion of hashcode method)?
11 what is toString method ?what happens when i use in the program

explain?
12 what is String builder?
13 what is String tokenizer?
14 what is the difference between string and String Buffer?
15 what is the capacity of String Buffer?
16 what is collection ?
17 what is list?
18 what is Arraylist Expain?
19 Write logic for Array to Arraylist?
20 write logic for Arraylist to Array?
21 why vector class is defined Synchronized ?
22 what is exception ?
22 difference between Throw And Throws?
23 what is custom Exception explain?
24 What is finally block?Use of Finally block?explain
25 what happens if exception not found in try catch block?
Then finally block will be Excuted or not

Questions from Infinite
if u have multiple alerts, how do you handle it.
if you have two password/reneter password
assert equals/assert same
navigate() and switch to
one webdriver driver is opened, what to do to make addons to work
how to join two sets/answer: by using addon method....
what are all the collections you used

india/all states, need to select the last value of the dropdown list

=============================================
Software AG
=============================================

how to work with ajax application, flash, frame, log files,

log file will generated, for each action u do...ex: for gmail, compose mail;> there would be some log generated....so how to capture that log...

if you have a .bat file, how do you call that...

what exactly you call for this..

how you will make sure that page has been loaded...

StarMark Interview Questions
1. Diff between static and non static
2. What is multiple inheritance
3. Write program for prime no.
4.How to run build.xml through command prompt
5. Diff b/w overloading and overriding
6. how many wait methods you are using in webdriver
7. Difference between assertion and verification
8. What are the roles and responsibilities.
9. Why TestNG is better than JUNIT

================================================
HCL interview Questions:
===============================================
1. difference between string and string buffer?
2. difference between linked list and arraylist?
3. thread concepts?
4. why string class is immutable?
5. Singleton class?

==================================================
Adobe Interview Questions:
==================================================
1. Retrieve the test data from excel sheet, put in in google search bar, click on search button and click on the first link opened in google search.
2. Write a program to check whether the string can be a palindrome. for example if the string aab(it is not a palindrom string). replace the characters in a string like aba, baa etc. and check that can be a palindrome string.
3. How will you Identify the webelement that has same property values?
4. write a pgm to return the no.of rows and columns in a webtable?
5. Write a prm to return the row and colum value like(3,4) for a given data in web table?

interview question from companies(happest minds,emids and adobe)
1) how to create a folder in build.xml
2) describe about your framework.
3) difference between selenium rc and selenium webdriver
4) explain the architecture of your project
5) draw ur framework
6) write a code for fetching the data from excel sheet
7) write a code for palindrome
explain about jenkins
9) explain about ur control version tool
10) how to handle with drop down
11) how to handle window id
12) how to handle with google search text box
13) how to handle alert and window pop up
14) how u will get the frame id
15) how to handle dynamic webtable
16) why we are using follwing siblings
17) create a pagefactory for login page
18) how u will group,how u will add classes from different packages

====================================================
EBAY InterView Questions
====================================================
TESTNG QUESTIONS ASKED IN EBAY
1. What is the use of TestNG/Junit ?
2. What is parameterized testing?
3. How can u achieve parameterized testing using TestNG?
With the help of 2 annotations @Parameters and @Dataprovider.
4. Can you map test method names in XML file along with class names?
Yes, we can do it please see below ex:
<classes>
<class name="test.IndividualMethodsTest">
<methods>
<include name="testMethod" />
</methods>
</class>
</classes>

5. Sequence of execution of below annotations:
@Test
@BeforeGroups
@AfterGroups
@BeforeSuite
@AfterSuite
@BeforeMethod
@AfterMethod
@BeforeClass
@AfterClass

6. What is Yaml file?
TestNG supports YAML as an alternate way of specifying your suite file.You might find the YAML file format easier to read and to maintain. YAML files are also recognized by the TestNG Eclipse plug-in.

7. How will you execute only selected test methods in particular Test class?
8. How do you fail test cases in TestNg?
9. Can we execute test cases parallely in TestNg?
10. How can we control the order of test method invocation?
We need to create Dependency.
TestNG allows you to specify dependencies either with annotations or in XML.:
You can use the attributes dependsOnMethods or dependsOnGroups, found on the @Test annotation.
Alternatively, you can specify your group dependencies in the testng.xml file. You use the <dependencies> tag to achieve this:

11. How can you make sure test methods which are run in a certain order doesn't really depend on the success of others ?
By adding "alwaysRun=true" in your @Test annotation.

================================================
ACCOLITE INTERVIEW QUESTIONS:
================================================

1.What is the use of static keyword in Main()?
2.can a class without main() gets compilation successful?
3.difference between abstract and interface.
4.Example of function overloading in Selenium Webdriver
5.Can we private access specifier inside interface?
6.Is there any way to deallocate memory in JAVA?
7.What is the use of finalize method? whether implementation is already available.
8.How do you handle drop down list box.
9.Write a pgm for removing white spaces in a String?
10.Write five critical testcases for the above written pgm.
11.What is missing in Selenium Webdriver compared to Selenium RC?
12.you have a parametrized constructor, whether it will call default constructor first? or directly it will call parametrized contructor?
13.What is the difference between Webdriver Wait(Explicit Wait) and Implicit wait?
14.Write a xpath using following-sibling?
15.How will you analyze the failures after giving a run in the TestNG framework?
16.Explain the Selenium Webdriver Architecture?
17.Explain The framework you were using ?
18.What is Object class?
19.Jenkins Tool - Scheduled Batch Run - any idea
20.What is the current version of Selenium Webdriver ? What are the other languages do Selenium Support?
21.How are you writing log files in your framework?Using Log4J Jars or any other methods.
22.How to handle SSL certificate?
23.What is the latest version of selenium webdriver?

All interview Qustions
=============================================
HeadStronginterview qustions
=============================================
1.explain framework
2.page factory model code?diffrence between pagefactory and page object model?
3.what is object reposiratory?
4.How to overwrite a data in excel sheet?
5.explain different frame works.
6.what are property files?
7.howgroupin is done in testng xml.
8.how to run tests in different browser.
9.how to handle alerts.
10.jdbc connections?
11.how to report ?
12.common method for reverse a string?
13.challenges faced?
14.String s=”AABBBCFFDD” Count the presence of each letter.
15 pascle triangle program.
16.class and interface difference?
17 interface and inheritance difference?
18.what is polymorphism?
19.diffrence between string and string builder?
20.what is static variable,
21.what is null pointer exception .
22.what are the exception you found?
23.bug lifecycle?
24.web driver waits and implicit wait?
25.can we write multiple CATCH in webdriver code?
26.if we close the driver in try block then,FINALLY will execute or not?
27.what are the different types of framework ?
28.why we go for hybrid frame work?
29.diffrence between data driven and modular f/w?

============================================
Exlliant Interview qustions
===========================================

1.what is testng?why we go for testng?
2.can we run a test without testng?
3.what is the difference between verification and valiation?
4.what are the different locators in selenium?
5.what is xpath?
6.diffrence between absolute and relative path?
7.what is difference between abstract class and interface?
8.what in diff between method overloading and constructor overloading?with example?
9.diffrence between string and string buffer?
10.what is overriding ?
11.how to handle dynamic elements?
12.how to get the no of emp getting same salary?

===========================================
CalSoft labs interview qustions?
============================================

1.explain your framework?
2.how to do grouping?with code?
3.how to handle different pop ups?
4.diffrence between string and string buffer?
5.what is difference between abstract class and interface?
6.diffrence between final,finaly,finalize?
7.diffrence between normal class and final class?
8.how to handle frames without having any attributes?
9.diffence between smoke and sanity testing?
10.QA process you follows?
11.adapter design in java?

===================================================
Bosch interview Qustions
==================================================

1.Reverse a string without using inbuilt functions?
2.Sorting of numbers?
3.Generic method for select dropdown?
4.generic code for fetching data from xl sheet?
5.What is testNg?
6.What is selenium grid?write the code?
7.how to do parallel execution?
8.how to handle ssl certification in ie?
9.how to handle popup’s?
10.how to fetch all the options in auto suggest?
11.how to upload a file ?write the code?
12.how to generate daily execution report?
13.explain frame work?
14.difference between junit and testng?

====================================================
Techmetric interview
====================================================
1.what is webdriver?
2.where all of abstract methods of webdriver are implemented?
3.how to handle dynamics webelement?
5.how to fetch data from excel sheet?
6.how to write xpath,css?
7.how to connect to the database?

Explain ur responsibility in ur project?
2. Explain ur project(team size,domain etc)
3. Automation process?
4. All basic questions on Manual Testing?
5. Diff between RC,IDE,GRID and Web Driver?
6. How to handle SSL issue,POP-Up alert?...

==================================================
HappiestMind interview questions
=================================================
1.what is collection in java.
2.play with any of the collections.
3.scarch a letter in string?
4.reverse a number?
5. sorting ana array?
6 .What is page object model?
7between css and xpath which one is faster?
8.what is exception.tell some exception.
9.tell some exception you get while writing code.
10.how to handle exception ?
11.is it agood approche to throw an exception?
14.how to generate a report?
15.how many testcase you have automated.
16.how many test case you run in a batch execution?
17.what is the minimum time to run a batch execution?
18.tell me complex secnarion of your application?
19.challenges you faced in automation.
20.how to upload file other than Autoit?
21.negative testcase for a pen?
22.how to run a test 3times if the test fail ?

==========================================
Ness
==========================================
1. what is the diff between STRING and STRING BUFFER.
2. WAP For String Reverse.
3. Find how many duplicate values in Array List.
4. string [] str={"abc","efg","fgh"};
conver array to string.
5. about file downloading and uploading.
6. what is PageFactory explain.
7. explain method overloading and overriding .. how practically
implemented in ur project.
8. what are the challenges of SELENIUM.
9. explain the features of JAVA.
10. how do u say JAVA is platform independent.
11. is JVM platform independent.
12. write code for data fetch of excelSheet.
13. explain how do u access DB in selenium.
14. explain ANT and what are the pros and cons.
15. how do u achieve parallel execution in TestNG.
16. what is the dictionary meaning of SELENIUM.
17. accronomy of ANT and POI.

Explain ur responsibility in ur project?
2. Explain ur project(team size,domain etc)
3. Automation process?
4. All basic questions on Manual Testing?
5. Diff between RC,IDE,GRID and Web Driver?
6. How to handle SSL issue,POP-Up alert?...=======
++++++++++++++++++++++++++++++++++++++++++
Interview questions asked in 'LearningMate'(Manual&Autoamtion):

1st Round(Telephonic)

1) Tell me about your self
2) What are the testing types your going to do in manual testing
3) What are the testing types your going to do in Automation testing
4) Tell me something about Agile model
5) Give me example for 'High Seviority' & 'Low Prority'?
6) What are the object identification technics?
7) How to handle dynamically changing values?
8) Have you any experiance on 'Web Services' testing?
9) On How many browsers your  testing using automation?
10) System Intergration testing example?

2nd Round(Face to Face)


1) Tell me requirements for 'age' field ?(Assume as a end uesr)
2) Write +ve and -Ve test cases for 'age' field?(requirement: only accept numerics)
3) What kind of testing techniques you used for 'field' validation?
4) System Integration testing real time example except gmail ?
5) What is Priority?
6) What is Seviourity?
7) Real time example for 'High Seviority' & 'Low Prority'?
8) When we go for 'Manual' testing & 'Automation' testing?
9) Give me one example to prove 'Automation' is better than 'Manual' Testing?
10) What is hybrid driven framework & Data driveb framework?
11) Our V2_AutoW framework structure?
12) Tell What are the keywords you used for Login application?
13) What is 'Object Repository' & uses?
14) Write sample code for Login page using 'Hybrid driven framework'(using keywords in excel)?
15) Write sample code for Login page using 'normal code' in eclipse?
16) How to test the application using 'POM'(page object model)?
17) Draw the  BLC(bug life cycle) architecture and explain the work flow with it's all status?
18) On which bug tracking tools you worked on?
19) Tell me actual and expected test case for 'Price on Category' page &' Check out page'?
20) As a automation test engineer if i give manual testing how you will do?
21) Have u worked on 'Grid'?
22) What is 'ant','TestNG' ?
23) is xslt reports are user friendly?
24) What is Integration testing?





3 comments: