0% found this document useful (0 votes)
7 views

Rahul SA QA Interview Q a Day2

The document discusses key programming concepts such as abstraction, encapsulation, and synchronization in Java and Selenium. It highlights the differences between abstract classes and interfaces, explaining their functionalities and use cases. Additionally, it elaborates on encapsulation as a means of data hiding and synchronization as a mechanism to ensure components work together effectively during testing.

Uploaded by

qavasutesting
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Rahul SA QA Interview Q a Day2

The document discusses key programming concepts such as abstraction, encapsulation, and synchronization in Java and Selenium. It highlights the differences between abstract classes and interfaces, explaining their functionalities and use cases. Additionally, it elaborates on encapsulation as a means of data hiding and synchronization as a mechanism to ensure components work together effectively during testing.

Uploaded by

qavasutesting
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

LOCATION COMPANY ROW ID Q.NO.

Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
AR, USA Walmart 2_W 1 Difference between Abstration and interface Abstract class and interface both are used to Abstraction: Abstract class: The interface will have only abstract methods in 1.Using abstract we cant achieve multiple Abstraction: It is about showing the necessary Abstraction:It is nothing but which hides the Abstract class and interface both are used to An interface is basically a description which Abstract class can have instance methods Abstract vs Intereface Abstract class Abstraction is a process of hiding the
achieve abstraction where we can declare the It is used to hide the implementation details and ================= which it can extend another interface. while inheritance but using interface we can achieve details to the user without showing the implementation of internal logic and showing achieve abstraction in which Abstract class can defines the behavior of an implementing class. (Implementation) while Interface strictly allows a> if we want to implement partially then we can 1)An abstract class can have method body (non- implementation details from the user, only the
abstract methods. ... Interface can have only display only essential features such as (1) Abstract class can have both abstract and abstract class and have both abstract and non multiple inheritance complexity (like how it works) related to specific only functionalities to the user called an have abstract and non-abstract method where Methods of Java interface are implicitly abstract. only non implemented methods. go for abstract class . abstract methods). functionality will be provided to the user. In other
abstract methods. Since Java 8, it can have properties and methods of the object. non-abstract methods Abstract methods, can extend another Java 2.An abstract class can be defined and it can scenario. abstraction. as Interface can have only abstract methods. The implementing class ensures that it will have if we don't know anything about implementation 2)An abstract class can have instance variables. words, the user will have the information on what
default and static methods also. 2) Abstract An abstract class can extend only one class or (2) Abstract class doesn't support multiple class or multiple interfaces contain access modifiers fo the subs,functions, To achieve above we use Abstract class and Interface It is blue print of class by using Abstract Class can have an access modifier but these methods that can be used on it. just we have requirements then we go for 3)An abstract class can have constructor. the object does instead of how it does it.
class doesn't support multiple one abstract class at a time. inheritance properties but interface member cant be defined Interface. interface we can achieve 100% abstraction it The interface does not have access modifiers, so Variables declared in an interface are by default interface 4)An abstract class can have static methods. Interface: An Interface can only declare
inheritance. Interface supports multiple An abstract class can extend another concrete (3) Abstract class can have final,non-final,static using the keyword static,virtual,abstract or Below are the differences between these: accepts only abstract methods in it Everything defined inside the interface is final. Interface classes are public by default. b> Abstract class can have both abstract 5)You can extends one abstract class. constants and instance methods, but cannot
inheritance. (regular) class or abstract class. and non-static variables sealed and interface can not use any access a) Abstract class can have abstract and non- assumed as 'public'. An abstract class is base for different sub- methods and concrete methods where as in Interface implement default behavior and all methods are
An abstract class can have both abstract and (4) Abstract class can provide the modifier i.e, public,private,protected,internal etc. abstract methods. Multiple inheritance concept is achieved through classes that share a common behavior and thus interface all the methods are default public and Interface have only abstract methods. implicitly abstract. An interface has all public
concrete methods implementation of interface because within an interface by default Interface can have only abstract methods. Since Interface so An interface can inherit multiple does't need to be created multiple times. Also abstract. An interface cannot have instance variables. members and no implementation.
(5) The Abstract keyword is used to declare everything is public. Java 8, it can have default and static methods interfaces but cannot inherit a class but An sub-classes can override the predefined c> The variables present in Abstract class need Interface cannot have constructor. In short, Interface will have methods but no body.
Interface: Abstract class 3.A class may inherit only one abstract class but also. abstract class can inherit a class and multiple behavior as long as it is not define as private or not be public, static and final where as in Interface cannot have static methods.
An interface can extend any number of (6) An Abstract class can extend another java In interface, A class may inherit several b) Abstract class doesn't support multiple interfaces. final. An abstract class may contain non final interface all the variables by default public, You can implement multiple interfaces.
interfaces at a time. class and implement multiple java interfaces interfaces inheritance. variables. Abstract class can be public, private static and final.
An interface can only extend another interface. (7) An abstract class can be extended using the Interface supports multiple inheritance. and protected d> Abstract class can extend class where as in
An interface can have only abstract methods keyword extends c) Abstract class can have final, non-final, static interface we can implement the class but not
and non-static variables. Interface has only extend.
Interface: static and final variables. e> we can declare constructor inside Abstract
============== d) Abstract class can provide the implementation class where in interface we cannot declare
(1) Interface can have only abstract methods. of interface. Interface can't provide the constructor
Since java 8 it can have default and static implementation of abstract class.
methods also e) The abstract keyword is used to declare
(2) Interface support multiple inheritance abstract class.
(3) Interface can have only final and static The interface keyword is used to declare
variables interface.
(4) Interface can't provide the implementation of f) An abstract class can extend another Java
abstract class class and implement multiple Java interfaces.
(5) The Interface keyword is used to declare An interface can extend another Java interface
Interface only.
(6) An interface can extend another java interface g) An abstract class can be extended using
only keyword "extends".
(7) An interface class can be implemented using An interface can be implemented using keyword
the keyword implements "implements".
h) A Java abstract class can have class members
like private, protected, etc. Members of a Java
interface are public by default.

AR, USA Walmart 2_W 2 What is encapsulation Encapsulation in Java is a process of wrapping Encapsulation The Process of grouping Data members and Encapsulation is hiding the actual Encapsulation in Java is a process of wrapping Encapsulation: This concept used to achieve Encapsulation:It is an concept of binding ,here The process of wrapping code and data together Encapsulation is a OOP concept and is a form of Wrapping of data/variables and methods into a Encapsulation allows us to protect the data What is encapsulation - Wrapping methods or It is Abstraction plus the data hiding. It can be
code and data together into a single unit, for It is used to bind data members and member related methods can be referred as implementation of a class, means variables, code and data together into a single unit.By data hiding by making that data private and in class is also an encapsulation which binds into a single unit is known as encapsulation data hiding. Encapsulation wraps the data single unit.(Known as Data Hiding also) because stored in a class from system-wide access. The data as a single unit. example- we can use get() achieved by declaring class variable as private
example, a capsule which is mixed of several functions into a single unit to prevent outsiders encapsulation methods, and all data in class is hiding by providing only a setter or getter method, we can order to use that private data we can use public methods and variables in it and encapsulation is variables and the methods together in a single implementation is hidden for the users. main advantage of encapsulation is it restricts and set() methods and make them public. these and provide public setter, getter methods for
medicines to access it directly. --> If any component allows Data hiding and another class can be accessed by only any make the class read-only or write-only. In other getter and setter method. the key to security it can be implemented by unit. It makes the variables of a class hidden from direct access to data members if the class. we can be used to either access variable or set modifying and viewing variable values to get
We can create a fully encapsulated class in Java Eg: Declaring all the variables in the class as abstraction can be termed as an encapsulated method which they are declared. gives data words, you can skip the getter or setter methods. Thus our actual data is hiding whatever user will using private access modifier other classes and if any class want to access can implement encapsulation in java by keeping values for the variables control over data.
by making all the data members of the class private and using C# Properties in the class to component hiding and Re-usability. It provides user the control over the data. You do to that private data can never by known by these variables they need to do it from the the class variables private and providing public
private. Now we can use setter and getter set and get the values of variables. --> Encapsulation = Data hiding + Abstraction can write the logic not to store the negative others. methods of their current class. getter and setter methods to each of them.
methods to set and get the data in it.By providing Example: numbers in the setter methods.It is a way to To achieve encapsulation we need to make sure the best way that we used encapsulation in our
only a setter or getter method, you can make the class Student achieve data hiding in Java because other class two important things -- private and public project is making all the webelements in each
class read-only or write-only.It is a way to { will not be able to access the data through the -- need to define variables in the class as private page class as private and created public getter
achieve data hiding in Java because other class private int age; private data members. -- we need provide public methods for view, methods to each webelement in order to access
will not be able to access the data through the private int roll no; The encapsulate class is easy to test. So, it is modify privately defined variables- for eg get them outside the class.
private data members. private float marks; better for unit testing. and set
public void read()
{
}
public void write()
{
}
}
AR, USA Walmart 2_W 3 Explain about synchronization in selenium Synchronization meaning: when two or more Synchronization: When we are testing our application. Selenium Synchronization in selenium means nothing but Synchronization in Selenium Webdriver: Synchronization in Selenium: This concept Synchronization:Generally when we work with Normally Synchronization is a mechanism which Synchronization in selenium is an crucial Synchronization is basically the waits involved in Synchronization is a mechanism which involves Synchronisation is nothing but when elements Synchronization can be achieved through waits
components involved to perform any action, we It is a mechanism which involves more than one webdriver may be faster when compared to our managing wait between the application which Synchronization is a mechanism which involves comes into picture when we have two or more real time project all the elements may not load at involves two or more components working component for making the scripts running on an codes. It may be implicit,explicit, thread.sleep, two or more components working parallel with on the web page are in sync with the WebDriver. in Selenium. There are two different types of
expect these components to work together with component to work parallel with each other web application as it takes some time to load our you are testing and selenium tool to avoid two or more components working parallel with components need to be work in synchronized the same time in the application in that scenario parallel with each other. Usually we have our AUT application/website successful. It's basically a fluent wait. We shouldn't use thread.sleep more each other and it is one of the common issue It avoids exceptions like timeoutexception we use synchronizations.
the same pace. The co-ordination between these page exceptions like elementnotfoundexception .etc... each other. Usually, in test automation, there will order. we will get Synchronization problems in order to and tool to work on that AUT. sync between the Application under testing and as it haults the execution. that we face in our automation. why do we face impliciWait() or explicitWait() methods. a) Unconditional: It is used to specify timeout
components to run paralelly is Synchronization can be classified into two or for webelements to be present in our webpage in order to handle that we are using be two components such as application under While go for Automation testing, we have 2 solve this problems we will use following Both of them have seperate speeds .For example, selenium (the testing tool). Both these two this issue is as we know in test automation, there value only. Ex: Thread.Sleep();
called Synchronization categories: At that time Selenium will throw the exception unconditional and conditional waits like - test and the test automation tool. components:- The Application (to be tested) and methods on selenium If I want to navigate to some url and click on different things have their own speed and thus are two main components that we deal with b) Conditional : It is used on condition along with
It is a mechanism which involves more than one Unconditional Synchronization: "ELEMENTNOTVISIBLEEXCEPTION" Implicit wait- wait until the specified time for the Automation tool (selenium, QTP etc.). A user implicit wait some element and try to enter text.at this points there is always a chance of miss match to occur. application under test and the test automation timeout value. Ex: Implicit Wait, Explicit Wait and
components to work parallel with Each other. We will make the tool to wait until certain amount So to match the speed of the application or in every step in the test script before you throw the Unconditional Synchronization: Only the timeout should ensure while running the test script, both explicit wait the selenium commands what ever I pass may be For eg - selenium webdriver may be faster and tool which will have their own specified speeds. Fluent Wait.
Generally in Test Automation, we have two of time and then proceed further. some case, to wait for specific condition at some error. value to be specified.It will wait till certain time the application and the script run with same fluent wait faster than the application loading time which has reached a certain step where web element while writing the test scripts we should be written Implicit Wait: It is a global wait i.e.,when we define
components Eg: Wait() and Thread.Sleep(); point of time , we use synchronization in driver.manage.TimeOuts.implicitwait(6,Timeunit. before proceeding. Wait(),Thread.Sleep(); speed so that we can avoid "Element not found" results in an exception. needs to be clicked. But the application under in a way such that both these components will the implicit wait, it will set for the life of the
1. Application Under Test selenium, which helps to SECONDS); The main advantage of this method is that it will exception. So we always should synchronise the test (a website may be) is slow and its page is work with same speed. In order to achieve this we WebDriver object instance.
2. Test Automation Tool. Conditional Synchronization: bring the AUT and selenium Speed in sync Explicitwait - wait until the specified time for a come for help when we interact with a third party Thus we use the concept of below waits with 2 application with our tool.Normally we can go for still loading up where that element is present. In need to implement waits concept in our Syntax: driver.manage().timeouts().implicitlyWait
We specify a condition along with timeout value, specified test step before throwing an exception. system such as an interface. Here, it is not categories: Thread.sleep() which is not encouraged because this case the script will fail. automation scripts. (10, TimeUnit.SECONDS);
Both these components will have their own so that tool waits to check for the condition and Synchronization in Selenium: Good use when page loads dynamically possible to write condition or check for a a) Unconditional: Thread.sleep() it increases execution time unnecessarly even Hence to overcome this situation, Explicit Wait: To define a wait statement for
speed. We should write our scripts in such a way then come out if nothing happens. ======================= WebDriverWait wait = new WebDriverWait(driver, condition. In such cases, the application can be b) Conditional: Implicit, Explicit, Fluent wait. though it doesnt need for application. synchronization is required between selenium certain condition to be satisfied until the
that both the components should move with Implicit Wait: An implicit wait is to tell WebDriver 1) Implicit wait 10); made to wait for a specific period using this type There are 3 ways to achieve this, 1.Implicit wait 2. and the AUT. It can be achieved using wait func specified timeout period.
same and desired speed, so that we will not to poll the DOM for a certain amount of time when 2) Explicit wait wait.until(ExpectedConditions. of synchronization. The major disadvantage is Explicit wait and 3.Fluent wait in selenium and also sleep(). But we should Syntax: WebDriverWait wait = new WebDriverWait
encounter "Element Not Found" errors which will trying to find an element or elements if they are 3) Thread.sleep() visibilityOfElementLocated("locator"))) that at some times, the tool will be made to wait Implicit wait :This can be used while trying to find prefer waits -- Implicit or Explicit waits. (driver, 10);
consume time again in debugging. not immediately available 4) Fluent wait fluent wait - the maximum time to wait for test unnecessarily even when the application is out an element or elements and when they are wait.until(ExpectedConditions.
Explicit Wait: We need to define a wait statement step with polling time to ignore the exception ready. not readily available. The implicit wait will tell the visibilityOfElementLocated(By.id("Name")));
Synchronization can be classified into two for certain condition to be satisfied until the 1) Implicit wait: during that period. webdriver to poll the DOM for a certain period of Fluent Wait: To define the maximum amount of
categories: specified timeout period. If the Webdriver finds ================= Conditional Synchronization time. However, this will not work for all commands time to wait for a condition, as well as the
the element within the timeout period the code Implicit wait will wait for the specified time before In this case, a condition also will be specified but only for “Find Element” and “Find Elements” frequency with which to check for the condition.
1. Unconditional will get executed. throwing the exception along with the timeout value. The tool will wait to statements. Syntax: Wait<WebDriver> wait = new
2. Conditional Synchronization Fluent Wait: Using FluentWait we can define the check the condition and will come out if nothing driver.manage.TimeOuts.implicitwait(6,Timeunit. FluentWait<WebDriver>(driver)
maximum amount of time to wait for a condition, Syntax: driver.manage().timeouts().implicitlyWait happens. However, it is important to set a timeout SECONDS); //Wait for the condition
Unconditional : as well as the frequency with which to check for (30, TimeUnit.SECONDS); value also in conditional synchronization so that Explicit wait : Here, in this case, a wait statement .withTimeout(20, TimeUnit.SECONDS)
In this we just specify timeout value only. We will the condition. the tool will proceed even if the condition is not for certain conditions will be defined which // which to check for the condition with interval
make the tool to wait until certain amount of time 1. Implicit wait is a single line of code and can be met. There two different types of conditional should be satisfied within the specified timeout of 3 seconds.
and then proceed further. declared globally which is applied to all the statements in selenium webdriver and they are period. The code will be executed if the element .pollingEvery(3, TimeUnit.SECONDS)
webelements an implicit wait and explicit wait. is found within the specified time. //Which will ignore the
Examples: Wait() and Thread.Sleep(); 2. It is a Dynamic wait and it won't wait for the WebDriverWait wait = new WebDriverWait(driver, NoSuchElementException
specified time if the element found early and Implicit Wait 10); .ignoring(NoSuchElementException.class);
The main disadvantage for the above statements continues to the next line for execution This can be used while trying to find out an wait.until(ExpectedConditions.
are, there is a chance of unnecessary waiting 3. It will be applied till the end of driver life element or elements and when they are not visibilityOfElementLocated(By.xpath("some
time even though the application is ready. readily available. The implicit wait will tell the locator"));
2) Explicit wait: webdriver to poll the DOM for a certain period of Fluent Wait:This is used to define maximum
The advantages are like in a situation where we ================== time. However, this will not work for all commands amount of time to wait for a condition and also to
interact for third party systems like interfaces, it Explicit wait mechanism targets only specific but only for “Find Element” and “Find Elements” increase the frequency with which the conditions
is not possible to write a condition or check for a element. We can tell to wait till the condition statements. are checked.
condition. Here in this situations, we have to satisfy, Once the condition satisfied, The tool Wait wait = new FluentWait<WebDriver>(driver)
make the application to wait for certain amount proceed with the Syntax .withTimeout(50, TimeUnit.SECONDS)
of time by specifying the timeout value. next step driver.manage.TimeOuts.implicitwait(6,Timeunit. .pollingevery(3, TimeUnit.SECONDS)
This can be done with WebDriverWait in SECONDS); .ignoring(NoSuchElementException.class);
Conditional Synchronization: conjunction with ExpectedConditions class Explicit Wait
Here, in this case, a wait statement for certain
We specify a condition along with timeout value, Example: conditions will be defined which should be
so that tool waits to check for the condition and ======== satisfied within the specified timeout period. The
then come out if nothing happens. //define webdriver wait statement with time code will be executed if the element is found
specified within the specified time.
It is very important to set the timeout value in WebDriverWait wait = new WebDriverWait(driver,
conditional synchronization, because the tool 10);
should proceed further instead of making the
tool to wait for a particular condition to satisfy. //apply the wait for specific element. Below
statement will wait for element to be present till
10 sec as specified by above
wait.until(ExpectedConditions.
presenceOfAllElementsLocatedBy((By.xpath("//a
[@class='ico-register']"))));

3) Thread.sleep():
====================
One of the way to achieve synchronization,
implement wait is by calling Thread.sleep()
function however, it is not recommended
because this
is not very stable and unreliable. The time has to
be specified in milliseconds.
Halts execution for particular time

Syntax: Thread.sleep(3000)

4) Fluent Wait:
===================
In Fluent Wait we define a Maximum amount of
time to wait for a condition. Also, we will be
defining a Polling frequency time while declaring
the Fluent Wait.Fluent Wait will be polling the web
pages every Polling frequency time to verify the
given condition.

Fluent Wait has Inbuilt exception handler, which


will handle NoSuchElementException until given
Maximum amount of time has breached.

Example:
=========
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);

WebElement element = wait.until(new


Function<WebDriver, WebElement>()
{
public WebElement apply(WebDriver driver) {
return driver.findElement(By.xpath("find"));
} );
element.click();
AR, USA Walmart 2_W 4 Difference between throw and throws Throw is a keyword which is used Throw and throws: throw: Throw - throw is used in a method to throw 1. Throws - is used to declare an exception, which Throw vs Throws: Throws is an exception and throw is a keyword in Throw is a keyword which is used to throw an We use throws keyword in our selenium script to Throw is used to explicitly throw an exception Throws: throw keyword is used in a body to throw an The main diffence between Throw and Throws is
to throw an exception explicitly in the program Throw keyword is used in the method body to ======== exceptions explicitly. means it works similar to the try-catch block. ... Both are used for Exception handling which we java exception explicitly in the program inside a declare an exception and throw is used to while throws is used to declare exception. We ◦Throws keyword is another way of handling the exception Throw keyword is used to throw the exception
inside a function or inside a block of throw an exception, while throws is used in throw keyword is used to handover created Throws - throws is used in method signature to Throw keyword is used in the method body to face while writing our test script. function or inside a block of code. explicitly throw an exception may be at a certain use throw within method while throws in method exception just like try catch example- explicitly in any method
code. Throws is a keyword used in the method method signature to declare the exceptions that exception object to the JVM Manually declare an exception. throw an exception, while throws is used in Throw: Throws is a keyword used in the method condition. signature. ◦It delegate the exception to the caller method. public void method1() Ex: void Demo()
signature used to declare an exception which can occur in the statements present in the throw keyword is used inside a method method signature to declare the exceptions that a) It is used to declare an exception like try catch signature used to declare an exception which Class is defined after throws, whereas an ◦Ex: public void doOperations() throws { {
might get thrown by the function while executing method. throw keyword is used to throw an exception can occur in the statements present in the block might get thrown by the function while executing instance follow up the throw keyword. SQLException { throw ArithmeticException(""This is Arithmetic throw new IOException();
the code. Eg: void methodMath() throws explicitly,it can throw one exception at a time method. b) Used inside the method body the code. One important difference is while defining the ........... exception.""); }
Only single exception is thrown by using ArithmeticException{} throw keyword cannot propogate checked c) At a time only 1 exception can be thrown Only single exception is thrown by using throw methods, we can define throws there only and ...... } } throws keyword can be used to declare multiple
throwMultiple exceptions can be thrown by using void methodAdd() { exceptions Throws whereas Multiple exceptions can be thrown by also multiple throws can be defined. But throw is So if we want to use doOperation() method then throws is used to declare an exception exceptions, separated by comma. Whichever
throws. throw new ArithmeticException("An integer : a) It generally throw an exception. using throws. defined inside the method and cannot be we need to handle the SQLException example- exception occurs, if matched with the declared
should not be divided by zero!!"); throws: b) Used with the method signature multiple public void method()throws IOException{ ones, is thrown automatically then.
} ========== c) Here multiple exceptions can be handled Eg - public void clickButton() throws exception, Throw: code EX: void Demo() throws ArithmeticException,
throws keyword is used to Delegate responsibilty NoSuchElementException } NullPointerException
of exception handling to the caller for checked Throw is a keyword used in java to create user {
exceptions defined exceptions. // Statements
throws keyword is the method signature }
throws keyword can be used to declare multiple
exceptions seperated by comma,
throws keyword is used to propogate only for
checked exceptions
AR, USA Walmart 2_W 5 What are the exceptions you have faced i have faced No such element found exception . How to resolve no such element exception? (1) WebDriverException NoSuchWindowException I have faced the following exception a) FileNotFound Exception: Found during compile I faced following exceptions I have faced many exceptions but I could I have faced many exceptions during my No SuchElement, NoSuchFrame, No SuchWindow, Some of the exceptions i have faced in my NoSuchElement - by correcting the locator When I'm working with web application, mostly I
(how can you resolve no such element exception) The NoSuchElementException in Java is thrown We need to do add some wait time (2) NoSuchElementException NoSuchFrameException 1.TimeoutException: Thrown when there is not time and handled by try catch block. NoSuchElementException:Generally we get when remember some like automation journey and one of the common NoAlertPresent, ElementNotVisible. Check if the projects are ElementNotVisible came across TimeoutException,
when one tries to access an iterable beyond its (explicit/implicit/Fluent wait) or scroll page so (3) NoSuchFrameException TimeoutException enough time for a command to be completed. b) WebDriver Exception: found during compile element is not in visibility area in that scenario NoSuchElement Exception,ElementNotFound, exception is the NoSuchElementException. locator is correct. May be Dynamic element. Timeout Exception TimeOutException NosuchElementException,
maximum limit. The exception indicates that that the UI framework loads the data. (4) NoAlertPresentException StaleElementReferenceException 2.NotFoundException: This exception is subclass time when user not able to initialize Webdriver we use Action class movetToElement() then we StaleElement,TimeOut,ElementNotVisible, This exception basically tells us that a particular Stale-element Exception StaleElementaexception ElementNotVisibleException,
there are no more elements remaining to iterate (5) NoSuchWindowException NoSuchElementException- Occurs when the of WebDriverException. It happens when an and handled by again configure the same with can do any action in selenium InvalidSelector etc element which we are trying to access, may be NoSuchElement exception ArrayIndexOutOfBound StaleElementReferenceException,
over in an enumeration. (6) ElementNotVisibleException locator is wrong, it is present in window /frame. element on the DOM does not exist. right driver. When element is in Iframe also we may get this Coming to NoSuchElement, it occurs when click or get text/value from is not available on the ElementNotVisibleException NoSuchFrame NoAlertPresentException and
The NoSuchElementException is thrown by the (7) ElementNotInterceptableException If the locator is right still occurring means i.e 3.ElementNotSelectableException: This Selenium c) NoSuchelementException: found during run error for we need to hit on framw first by using webDriver is unable to find and locate element. page. The reason for the element not present NoAlertPresentException NoSuchWindow NoSuchWindowException
following: iterator::next() (8) SessionNotCreatedException page loading issue you can handle via webdriver exception is thrown when an element is time, when user accessing the element which is driver.switchTo.frame(id/name/webElement); So I go for synchronisation so that the page get can be -- the page has not loaded completely, ◦We can resolve no such element exception in NoSuchAlert NosuchElementException(): This exception
By applying WebDriverWait, webdriver object wait (9) TimeOutException waits presented in the DOM but you can be able to not present (it can be user mistake while StaleElementException:When element is loaded and element gets visible the second can be the xpath we have defined for two ways occurs in 3 difference scenarios
for a specific time (in second) of an element for (10) InvalidSelectorException select. Hence, it is impossible to interact with. defining) and handled using try catch block and detached from the DOM need to write proper the element is not correct and third can be the 1.By applying WebDriverWait, webdriver object a) If there are any timing issues loading a page or
its visibility. ... We can handle (11) IllegalStateException again verify the correct path. relative xpath for it and maintain explicit wait. element itself is not visible on the page (may be wait for a specific time (in second) of an element application
NoSuchElementException through try-catch (12) StaleElementReferenceException how can you resolve no such element d) ElementNotVisible Exception: When we are SessionNotCreatedException:When we work with a BUG in the website itself) for its visibility. This can be handled by using conditional wait on
block inside Generic method public boolean It happens due to the following reasons: trying to interact with the hidden element. It can selenium chrome browser and chrome driver To correct this - the simple solution to this is to 2.We can handle NoSuchElementException element
isElementPresent(By by) { boolean isPresent = 1. NoSuchElementException occurs, when the be handled by either tell developer to make it not version should be same if not we will face this use wait. In this we can use implicit wait. this tells through try-catch block inside Generic method. b) If the locator identified is incorrect
true; try { driver. locators (i.e. id / xpath/ css selectors etc) we 1) The page is still being rendered and I already hidden or/and can be handled again by using try exception. the script to wait for a certain time before trying For example: public boolean isElementPresent(By c) If the element is in frame: If tried to locate
mentioned in the code is unable to find the web finished my element search and obtain no catch or wait. to access that particular element. by) { element
element element exception. e) TimeOut Exception: When maximum time reach or the best solution will be to use explicit wait, boolean isPresent = true; This can be achieved by using driver.SwitchTo().
on the web page. 2) The second reason is AJAX has not returned to identify an element, same can be handled by put up a condition in here that wait for a defined try { frame("XX");
2. There are two possibilities for getting this yet and I've already obtain using Implicit wait/Explicit wait. time frame or until this element which we want to driver.findElement(by);
Exception, i.e. either we have provided a incorrect NoSuchElementException access is visible on the page. if the element gets }
locator and trying to find the web element or we 3) The element is really not on the page visible before the time, it will click on it and move
have provided correct locator, but the web whenever. to next step. catch (NoSuchElementException e) {
element related to the locator is not available on exceptionWebDriverWait wait = new isPresent = false;
the web page. WebDriverWait(webDriver, timeoutInSeconds); Also, before changing the script with wait we }
3. We can handle this exception by wrapping wait.until(ExpectedConditions. should try and look for the xpath again. Is it return isPresent
fluent wait with try-catch block elementToBeClickable(By.id<locator>)) correct or not, has it changed recently or need }
an update.
AR, USA Walmart 2_W 6 Method to get the page title it could be done by getting the page title by Method to get page title? driver.getTitle() method can be used to get the driver.getTitle(); To get the page title use getTitle() method of Title of the page: using driver.getTitle() method. driver.getTitle(); getTitle() driver.getTitle() is the method to get the page title driver.getTitle(); getTitle() is a method available in selenium to get getTitle() By using getTitle() method we can get the page
Selenium and do assertion by using TestNG. driver.getTitle(); title of a page driver. the page title title
Import Assert class in the import section: `import driver.getTitle();
org. testng. ...
Create a WebDriver object: WebDriver driver=new
FirefoxDriver();
Apply this to assert the title of the page: or you
may be written this
To get the page title use getTitle() method of
driver.
actualTitle = driver.getTitle();
AR, USA Walmart 2_W 8 How to handle multiple windows on browser Selenium WebDriver software testing tool has To handle multiple windows on browser: Selenium provides 2 methods namely You can use driver.getWindowHandle(); to get the get.windowhandle(): helps in getting the window We use 2methods to handle the same by using driver.getWindowHandle,driver. There is window handling concept in selenium we Each window has a unique identifier (handle) Set<String> ids = driver.getWindowHandles(); We can use getWindowHandle() and .getWindowhandles() By using getWindowHandle() method we can
built in "WebDriver.switchTo().window()" method • pass desired URL to driver. getWindowHandle() and getWindowHandles() to current window id and use driver. handle of the current window getWindowHandle() and getWindowHandles() getWindowHandles methods we can handle have method getWindowHandles() to get all which nothing but tells the address of the Iterator<String> id = ids.iterator(); getWindowHandles() functions to handle multiple handle multiple windows on browser.
available to switch from one window to another • Instantiate the browser driver to the new deal with multiple browser windows getWindowHandles(); method which returns all get.windowhandles(): helps in getting the handles Below is the code for the same: multiple windows in selenium windows in the browser and we can switch window. The method used to get the window String parent = id.next(); windows on browser To work on child window we can using driver.
window so it is very easy to handle multiple Chromedriver. the webdriver opened windows id. with that write of all the windows opened public class A between the windows as per our requirement we handle of our current browser is - String child = id.next(); •First we get the handle of the parent window switchTo().window(childWindow) and perform
windows in webdriver. • Get the window handle of the parent window and 1. getWindowHandle(): This method returns the a loop to navigate to parent-child windows. set: helps to set the window handles which is in { use switchTo() method. getwindowhandle(); and similarly to get the using the command: tasks on child window
print it. current window handling id that the webdriver is the form of a string. set<string> set= driver.get. @Test getWindowHandle() is the method helps to get window handle of all the windows we use String parentWindowHandle = driver.
• Find the element on the page using an ID which currently holding windowhandles() public void WindowHandle the window handle of the current window getwindowhandles(); •Then we get the handles of all the windows that
is an element locator. 2. getWindowHandles(): This method returns set switch to: helps in switching between the { We can then use set to set the window handles in are currently open using the command:
• Use for loop to iterate the number of child of browser handling id's that are invoked/opened windows WebDriver dr=new FirefoxDriver(); the form of string. We can use syntax eg- Set<String> allWindowHandles = driver.
windows being created. by the webdriver, each browser window action: helps to perform certain actions on the dr.get("https://www.yahoo.com"); set<string> windowhandlesall= driver. getWindowHandles(); which returns the set of
• Get the handles of all the windows opened. corresponds to one id, so windows. String parent=dr.getWindowHandle(); getWindowHandles() and then can perform handles.
• Print the window handle of the first window. we can loop over the set and work on each Set<String> s1=dr.getWindowHandles(); certain actions.
• Use the SwitchTo command to switch to the browser and close. Iterator<String> i1=s1.iterator(); •Then we use for loop to iterate the number of
desired window. while (i1.hasNext()) For eg storing the window handle of the parent child windows being created.
and we use SwitchTo().window { window in a string and then switching to it: •Then we Get the handles of all the windows
(windowhandling_id) to switch to different String child=i1.next(); set parentwindow = driver.getwindowhandle(); opened.
browser windows of the webdriver if(!parent.equals(child)) driver.switchTo().window(parentwindow); •Print the window handle of the first window.
{ •Use the SwitchTo command to switch to the
dr.swithcTo().window(child); desired window.
dr.close();
}
}
dr.switchto.window(parent);
}
}

AR, USA Walmart 2_W 9 Explain about Page object model and advantages Page Object Model as a design pattern used to Page object model: 1. Page object Model(POM) is a Selenium design PageObjectModel (POM) is a design which creates Page Object model is an object design pattern in It is a design pattern where we kept our web Page Object Model:The name itself specifies we Page Object Model (POM) is a design pattern, Page object is a strategy or a design to maintain Basically maintaining of all the objects of the Page object model is a design pattern which is 1. Create a package and all class corresponding The chief problem with script maintenance is that
build an object repository for the web elements Page Object Model in Selenium is a design pattern. We can see it as a repository where we object repository's for each web page elements Selenium, where web pages are represented as elements and logic of a page separately. This work on pages on these pages are pure java popularly used in test automation .Under this a object repository for all the Web UI elements. It particular page in one java file is Page Object used in our framework to store all the to each page if 10 different scripts are using the same page
available in the application under test. Few pattern that is extensively used by the Selenium store all the webelements. This has become very in the application. advantages are -reduce code classes, and the various elements on the page helps user to interact easily and clear classes model, for each web page in the application, helps in reducing the code duplication and Model. Advantage: Easy to maintain, Easy weblements. 2. Create a package and all test classes element, with any change in that element, you
others refer to it as a framework for Selenium community for automation tests. The basic popular duplication and code reusability. are defined as variables on the class. All understanding of the script. Advantages:Easy to maintain there should be a corresponding Page Class. improve the overall maintenance of the code. readability of scripts, reduce duplicity, Re- •In this model, we create a separate class for 3. Create a package for resources to add . need to change all 10 scripts. This is time
automation for the given application under test. design principle that the Page Object Model in in industry these days because it is very easy to possible user interactions can then be Advantages: Code is more readable format This Page class will identify the WebElements of The main structure of of page object model is to usability of code, Reliability. each web page present in the application and properties file, base class, utilities file etc consuming and error prone.
However, what I have understood about the term Selenium follows is that a central object manage, reusability of code and eliminates implemented as methods on the class Code maintenance Re usability that web page and also contains Page methods define all webelements of a single page of a that class holds all the functionality and Advantages: A better approach to script maintenance is to
Page Object Model is: repository should be created for controls on a duplication of code Reusability which perform operations on those website/web application in single class, along members of that webpage. 1. Structured create a separate class file which would find web
web page. Hence, each web page will be 2. The keybenifits is if UI changes in the future, Test cases become short and optimized. WebElements. with methods which perform certain thing on The main advantage of using POM is it reduce the 2. Clear understanding of Test Classes and base elements , fill them or verify them. This class can
#1) It is a design pattern where you have a represented by a separate class. Then we can update webelements to page This concept makes our code cleaner and easy those elements. code duplication and improves test case classes and Logic be reused in all the scripts using that element. In
separate Java class file corresponding to each Advantages: classes in POM or object repository accordingly to understand.We can reuse the page class if The main advantage of POM is that code maintenance. 3. Easily reusable and can be maintained easily future if there is change in the web element , we
screen or page in the application. The class file • Better Maintenance – With separate page required in different test cases which means we becomes more optimized and less in size For example: if developer did some changes in need to make change in just 1 class file and not
could include the object repository of the UI objects (or page classes) for different web pages, don’t need to write code for identifying the web because we now have the reusable methods in one of the application page like a new 10 different scripts.
elements as well as methods. functionality or web locator changes will have a elements and methods to interact with them for our POM classes. webelement is added or an old webelement This approach is called Page Object Model(POM)
less impact on the change in test scripts. This every test case. If we give proper names to methods as per their locator value got changed in the DOM, in this Advantages: a)Easy to understand and cleaner
#2) In case there are humongous web elements makes the code cleaner and more maintainable usage, it can be easily mapped and used. case we can do changes to that particular page code
on a page, the object repository class for a page as Selenium test automation implementation is Code is much cleaner and easy to understand. related class instead of doing changes in all the b) Easy of script maintenance
can be separated from the class that includes spread across separate page classes. classes where ever we used this webelement. c) we can use the same object repository for a
methods for the corresponding page. • Minimal Changes Due to UI Updates – The effect different purpose with different tools. For
of changes in the web locators will only be example, we can integrate POM with TestNG/JUnit
Example: If the Register Account page has many limited to the page classes, created for for functional testing
input fields then there could be a class automated browser testing of those web pages. d) Methods get more realistic names which can
RegisterAccountObjects.java that forms the This reduces the overall effort spent in changing be easily mapped with the operation happening
object repository for the UI elements on the test scripts due to frequent UI updates. in UI.
register accounts page. • Reusability – The page object methods defined
in different page classes can be reused across
A separate class file RegisterAccount.java Selenium test automation scripts. This, in turn,
extending or inheriting RegisterAccountObjects results in a reduction of code size as there is the
that includes all the methods performing increased usage of reusability.
different actions on the page could be created.

#3) Besides, there could be a generic package


with a {roperties file, Excel test data, and
Common methods under a package.

Example: DriverFactory that could be used very


easily throughout all the pages in the
application. Here is the link of screen shot:https:
//prnt.sc/tc3omf

Advantages of Page Object Model:

According to Page Object Model, we should keep


our tests and element locators separately, this
will keep code clean and easy to understand and
maintain.

The Page Object approach makes test


automation framework programmer friendly,
more durable and comprehensive.
AR, USA Walmart 2_W 10 Difference between submit and click in selenium Submit is for Forms and Click is for Buttons Submit and click:
If you submit using any element of Form, it will We can use
automatically find button with type 'submit' of
form and click on it.
Submit can be done on any form item and click
has to be done Button with type Submit
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Hyderabad Rishennya software services 3_R 1 Oops concepts OOPS concepts: OOPS Concepts? Polymorphism - Different ways to do a task with i)Class Inheritance A language which totally works on its object that Not Answered Oops concepts -
Abstraction: Ans: help of method overloading and method Collection of objects is called class. It is a logical OOPS Concept:Object oriented programming When one object acquires all the properties and contain data and methods. Object Oriented, Abstraction, Encapsulation,
It is used to hide the implementation details and overriding. entity. language behaviors of a parent object, it is known as a. Inheritance: One class extending the Inheritance, Polymorphism
display only essential features such as OOPS concept in Java are the main idea behind Inheritance - obtains all the properties and A class can also be defined as a blueprint from Abstraction inheritance. It provides code reusability properties of another class to avoid duplicacy of
properties and methods of the object. java's object oriented programming behaviors of parent class used with extends which you can create an individual object. Class Inheritance Polymorphism code. Redundancy will remove. One who extends
Encapsulation 1. Class keyword. doesn't consume any space. Encapsulation If one task is performed in different ways, it is in Child Class and other one is Parent class.
It is used to bind data members and member 2. Object Abstraction - Abstraction is a process where you Polymorphism known as polymorphism. Done using ""Extends"" keyword.
functions into a single unit to prevent outsiders 3. Data Hiding show only “relevant” data and “hide” ii)Inheritance In Java, we use method overloading and method b. Polymorphism: As name suggests: One name,
to access it directly. 4. Abstraction unnecessary details of an object from the user. When one object acquires all the properties and Abstraction:It hides internal logic of overriding to achieve polymorphism. many form, two types: Compile time(Method
Eg: Declaring all the variables in the class as 5. Encapsulation Encapsulation - binding object state(fields) and behaviors of a parent object, it is known as implementation and showing only functionalities Abstraction Overloading/Static), runTime(Method
private and using C# Properties in the class to 6. Inheritance behaviour(methods) together. inheritance. It provides code reusability. It is to the user Hiding internal details and showing functionality Overriding/dynamic). Method Overloading be like:
set and get the values of variables. 7. Polymorphism used to achieve runtime polymorphism. Inheritance:Acquiring the properties from parent is known as abstraction. add(), add(int a , int b), add( int a, int b, int c) , add(
Inheritance: to child In Java, we use abstract class and interface to String x, String y).
Its the process by which one class acquires the 1. Class: iii)Polymorphism in Java Encapsulation:It is the concept of binding into achieve abstraction. Method Overriding be like: method name, exact
properties and functionalities of another class ======= Polymorphism one cell like class which binds methods and Encapsulation same name with same number/type of
Polymorphism A class is a blueprint from which objects are If one task is performed in different ways, it is variables in it Binding (or wrapping) code and data together into arguments.At run times, it decides which method
Its a feature that allows us to perform a single created. It is a collection of data members and known as polymorphism. For example: to Polymorphism:One task can be done in different a single unit isknown as encapsulation. will be called depending upon the object
action in different ways. member functions convince the customer differently, to draw ways creation.
eg: using same method name with different something, for example, shape, triangle, it can be achieved by using method over loading c. Abstraction: It may contain some methods
arguments Ex: rectangle, etc. and method overriding which are implemented and at least one method
public class Vehicle In Java, we use method overloading and method methodoverloading:A method which has same which will be non-implemented.Showing some
{ overriding to achieve polymorphism. name with different parameter list relevant data only to the user and hiding some of
int doors; //Data members Another example can be to speak something; for methodoverriding:A method which has same the implementation.
int speed; example, a cat speaks meow, dog barks woof, etc. name with same parameter list d. Encapsulation: Binding fields/data and
String color; methods together in a class file.
public void run() //Member functions iv)Abstraction
{ Hiding internal details and showing functionality
//Implementation is known as abstraction. For example phone call,
} we don't know the internal processing.
} In Java, we use abstract class and interface to
achieve abstraction.
2. Object:
======== v)Encapsulation in Java OOPs Concepts
Object is the instance of a class. Object is Encapsulation
created using new keyword. Binding (or wrapping) code and data together into
a single unit are known as encapsulation.A java
Ex: class is the example of encapsulation. Java bean
public class Vehicle is the fully encapsulated class because all the
{ data members are private here.
int doors; //Data members
int speed;
String color;
public void run() //Member functions
{
//Implementation
}
public static void main (String args[])
{
Vehicle v = new Vehicle();
v.run();
}
}

3. Data hiding:
============
Our internal data should not go out directly. So
we use the concept of data hiding
private access modifier should be used to
declare the data
Ex:
Class Account
{
private double balance; //Data hiding
public double getbalance()
{
Implementation
}
}
--> For Data Security
--> Highly recommended modifier for variables is
private

4. Abstraction:
=============
Hiding internal implementation and highlight the
set of services providing
-->For security
-->Abstraction can be implemented using
interface concept

5. Encapsulation:
===============

--> The Process of grouping Data members and


related methods can be refered as
encapsulation
--> If any component allows Data hiding and
abstraction can be termed as an encapsulated
component
--> Encapsulation = Datahiding + Abstraction

Example:
========
class Student
{
private int age;
private int roll no;
private float marks;
public void read()
{
}
public void write()
{
}
}

6. Inheritance:
=============
--> It is one of the oops concept where the child
class acquires the properties of parent class (or)
super class
--> extends keyword is used to inherit the
properties of class
1. Single inheritance
2. Multilevel inheritance
3. Hierarichal inheritance

--> Java doesn't support multiple inheritance

7. Polymorphism:
================
Ability of an object to take different forms can be
referred as polymorhism

1. Compile time polymorphism:


==========================
Method resolution at compile time acheived
using method overloading(multiple methods with
same name but different signature)

Hyderabad Rishennya software services 3_R 2 What is data Driven testing It is a test automation framework that stores test 2. Runtime
1. Data polymorphism:
driven testing is a scripting technique that Data Driven Testing is a type of approach where DATA DRIVEN TESTING is a test automation Data Driven framework:It is best practise to read Data-driven testing is creation of test scripts Data driven is not supported by Selenium alone. DATA DRIVEN TESTING is a test automation Testing using different sets of data to break the
=======================
data in a table or spreadsheet format. This allows stores test input and expected result in a table for automation we use test date which will be framework that stores test data in a table or the data from external files like excel where test data and/or output values are read We just third party Apache poi Api to perform framework that stores test data in the form of code. example- boundary values
automation engineers to have a single test script orMethod Resolution
spreadsheet, So at runtime
that acheived
a single controlusing
script mostly stored in form of files or excel sheets, spreadsheet format. This allows automation As a Team When we were designing framework from data files instead of using the same hard- data driver testing. We have two jars apache poi- excel files, Text files, xml files, and in the
method
that can execute tests for all the test data in the can overriding
execute in subclasses
all of the tests in the table which is used to input in the application and get engineers to have a single test script that can we thought of that if client requirement was test coded values each time the test runs. ooxml and poi and one class XSSFWorkbook. Just databases.
table. 2. In the simplest form the tester supplies the the actual outputs later will be compared with execute tests for all the test data in the table. with multiple This way, testers can test how the application create object of this class and using some in- • In this framework, input values are read from
inputs from a row in the table and expects the expected outputs to obtain desired results. In this framework, input values are read from data data it was not recommend to use bulk of data handles various inputs effectively. It can be any build methods, we can get the data whatever we data files and are stored into a variable in test
output which occur in the same row. The table files and are stored into a variable in test scripts. into the script directly its better we use DDT into of the Datasources like Excel,DB,CSV Files,json want." scripts.
typically contains values which corresponds to Ddt (Data Driven testing) enables building both our etc" • And it is mainly used when the same test script
boundary or partition input spaces. positive and negative test cases into a single framework. need to be tested with multiple set of data."
test.
In Data-driven test automation framework, input
data can be stored in single or multiple data
sources like xls, XML, csv, and databases.
It allows testing application with multiple sets of
data values during Regression testing"

Bangalore Synechron technologies 4_S 1 Explain about your framework? 1. Language used: Java language : In our Selenium Project we are using
In our Selenium Project we are using Java Not Answered Hybrid framework using POM approach. I have
2. Type of Framework: Behavioral-driven Java language. language. Even though Selenium supports used Selenium+Java+TestNG+TDD+DDD
Framework by using Page Object Model design Type of Framework: we are using Data-drivenmultiple languages, we are using Java language
pattern with page factory Framework by using Page Object Model designis just because most of the automation
3. POM: As per pom, we have maintained a class pattern with Page Factory. developers have knowledge on Selenium with
for every web page. Each webpage has a TestNG: Using TestNG for Assertions, Grouping
Java.
seperate class for functionality and members of and Parallel execution. Type of Framework: In our project, we are using
that webpage. Seperate classes for every Maven: Using Maven for build, execution andData-driven Framework by using Page Object
individual test. dependency purpose. Integrating the TestNG Model design pattern with Page Factory.
4. Packages: We have seperate packages for test dependency in POM.xml file and running this POM.
POM: As per the Page Object Model, we have
case, test data, utilities xml file using Jenkins. maintained a class for every web page. Each web
5. Test Base class: It will deal with all the Version Control Tool: We use Git as a repository
page has a separate class and that class holds
common functions used by all the pages. This to store our test scripts. the functionality and members of that web page.
class is responsible for loading the Jenkins: By using Jenkins CI (Continuous Separate classes for every individual test.
configurations from properties file, initializing the Integration) Tool, we execute test cases on daily
We have separate packages for Pages and Tests.
Webdriver, Implicit waits, Extent Reports and also basis and also for nightly execution based on
All the web page related classes come under
to create the object of FileInputStream which is the schedule. Test Result will be sent to the
Pages package and all the tests related classes
responsible for pointing towards the file from peers using Jenkins. come under Tests package.
which the data should be read. Logs : Used Log4j for logging for tets scripts
Home Page and Login Page,we have a separate
6. Utility class: It stores and handles the the Extent Reports: For the reporting purpose, we are
classes to store element locators. For the login
functions which are repetitive (Waits, actions, using Extent Reports. It generates beautiful HTML
test there would be a separate class which calls
capturing screenshots,accessing excels, reports. We use the extent reports for the methods from the Home Page class and
Sending mails etc).This class extends the Test maintaining logs and also to include the Login Page class.
Base class to inherit the properties. screenshots of failed test cases in the Extent
As per the maven project, all the tests are kept in
7. Properties file: The file (config.properties) Report. the ‘src/test/java‘ and remaining files (such as
stores the info that remains static throughout POM : As per the Page Object Model, we haveconfig.properties, element locators (POM
the framework such as browser specific info, maintained a class for every web page. Each web
classes), utility files, test data, etc.,) kept under
application URL, screenshots path etc. page has a separate class and that class holds
‘src/main/java‘.
8.Screenshots: Screenshots will be captured and the functionality and members of that web page.
Test Base class (TestBase.java) deals with all the
stored in a seperate folder and the screenshots Separate classes for every individual test.common functions used by all the pages. This
of a failed test cases will be added in the extent Properties file: (config.properties) stores the
class is responsible for loading the
reports information that remains static throughout the
configurations from properties files, Initializing
9. Test-Data: All the historical test data will be framework such as browser specific information,
the WebDriver, Implicit Waits, Extent Reports and
kept in excel sheet. by using excel, we pass test application URL, screenshots path etc. also to create the object of FileInputStream
data and handle data driven testing. we use which is responsible for pointing towards the file
Apache POI to handle excel sheets from which the data should be read.
10. TestNG: Using TestNG for Assertions, Grouping Utility Class (AKA Functions Class): Utility class
and parallel execution (TestUtil.java) stores and handles the functions
11. BDD framework: we used BDD approach which (The code which is repetitive in nature such as
is in simple text language such that everyone waits, actions, capturing screenshots, accessing
can able to understand what is going on in the excels, sending email etc.,) which can be
project. commonly used across the entire framework. The
12. Maven: Using Maven for build, execution, and reason behind creating utility class is to achieve
dependancy purpose. Integrating the TestNG reusability. This class extends the TestBase
dependency in POM.xml file and running this POM. class to inherit the properties of TestBase in
xml file using jenkins TestUtil.
13. Version Control Tool: We use git and github as Properties file: This file (config.properties) stores
a repository to store and maintain our test the information that remains static throughout
scripts the framework such as browser specific
14. Jenkins: By using Jenkins CI (Continuous information, application URL, screenshots path
integration) Tool, we execute test cases on daily etc.
basis and for nightly execution based on the All the details which change as per the
schedule. Test Results will be sent to the peers environment and authorization such as URL,
using Jenkins. Login Credentials are kept in the config.
15. Extent Reports: For the reporting purpose, We properties file. Keeping these details in a
are using Extent Reports. It generates beautiful separate file makes easy to maintain.
HTML reports. We use extent Reports for Screenshots will be captured and stored in a
maintaining logs and to include the screenshots separate folder and also the screenshots of a
of failed test cases in the Extent Report. failed test cases will be added in the extent
reports.
All the historical test data will be kept in excel
sheet (controller.xlsx). By using ‘controller.xlsx’,
we pass test data and handle data driven testing.
We use Apache POI to handle excel sheets.
Using TestNG for Assertions, Grouping and
Parallel execution.
Using Maven for build, execution and
dependency purpose. Integrating the TestNG
dependency in POM.xml file and running this POM.
xml file using Jenkins.
We use Git as a repository to store our test
scripts.
By using Jenkins CI (Continuous Integration) Tool,
we execute test cases on daily basis and also for
nightly execution based on the schedule. Test
Result will be sent to the peers using Jenkins.
For the reporting purpose, we are using Extent
Reports. It generates beautiful HTML reports. We
use the extent reports for maintaining logs and
also to include the screenshots of failed test
cases in the Extent Report.
Bangalore Synechron technologies 4_S 2 Have you used POM in your framework? Yes, We have used Page Object Model design yes -As per the Page Object Model, we have As per the Page Object Model, we have Not Answered Yes
pattern with page factory. As per pom, we have maintained a class for every web page. Each web maintained a class for every web page.
maintained a class for every web page. Each page has a separate class and that class holds Each web page has a separate class and that
webpage has a seperate class for functionality the functionality and members of that web page. class holds the functionality and members of
and members of that webpage. Seperate classes Separate classes for every individual test. that web page. Separate classes for every
for every individual test. individual test.
Bangalore Synechron technologies 4_S 3 What is Page Factory? 1. Page Factory in Selenium webdriver is an The PageFactory Class in Selenium is an Selenium Page Factory Pattern is like an Not Answered It is optimized model of POM. It used @FindBy
integrated concept of API. Here we follow again extension of the Page Object design pattern. It is extension to Page Object Model , but Page annotation to find Webelements
the same principles of keeping repository used to initialize the elements of the Page Object Factory is much enhanced model. To start with,
objects or page classes seperate from test or instantiate the Page Objects itself. we just need to import package ‘org.openqa.
cases. selenium.support.PageFactory’
2. POM and page factory are same design Factory class can be used to make using Page
patterns but differs in the way we define the Objects simpler and easier.
locators when you are working with page object We use Page Factory pattern to initialize web
patterns. elements which are defined in Page Objects.
3. Here we use @FindBy annotation to find We should initialize page objects using
elements and to initialize webelements using initElements() method from PageFactory Class as
initelements process. below, Once we call initElements() method, all
elements will get initialized. PageFactory.
initElements() static method takes the driver
instance of the given class and the class type,
and returns a Page Object with its fields fully
initialized.
Bangalore Synechron technologies 4_S 4 Suppose you have 7 pages in your application then to We will write seperate class for every webpage. we can create each class for each page i.e for 7 Not answered Not Answered 1. create class for each of the 7 pages and put
achieve POM what u will do? Each webpage has a seperate class for pages = 7 classes which consist of all web them inside a package
functionality and members of that web page. elements on that page so that we can use that in 2. create another package for all test cases
our test case class. related to them
3. create package for base class and .properties
file
4. create package for Data
5. package is created for reports
Bangalore Synechron technologies 4_S 5 Have you used interface in your framework other then We have used TestNG listeners in selenium to Yes, I have used interface in my project to hide I have used selenium interfaces only in my Not Answered No
selenium interfaces? generate logs or customize the testng reports. the actual implementation. Like I have created an selenium project while initializing any browser
We have implemented ITestListener interface interface for user details and implemented it for using selenium webdriver.
which have below methods the login page class and esignature class to use
OnStart the data.
onTestSuccess
onTestFailure
onTestSkipped
onTestFailedButWithinSuccessPercentage
onFinish
Bangalore Synechron technologies 4_S 6 What are all the selenium interfaces? Webdriver itself is an interface. Webdriver is an interface in selenium which we Alert,Capabilities,ContextAware,HasCapabilities, Not Answered WebDriver
Alert. used to initialize it, other than that WebElement, JavascriptExecutor,OutputType,Rotatable, List
Capabilities. TakesScreenshot, Alert,ITestListener. SearchContext,TakesScreenshot,WebDriver, Set
ContextAware. WebDriver.ImeHandler,WebDriver.Navigation, Map
HasCapabilities. WebDriver.Options,WebDriver.TargetLocator, ITestListener
JavascriptExecutor. WebDriver.Timeout,WebDriver.Window,
OutputType. WebElement,WrapsDriver,WrapsElement
Rotatable.
SearchContext.
Bangalore Synechron technologies 4_S 7 Synchronization in selenium? syntax for implicit wait When we are testing our application. Selenium Synchronization is nothing managing we It is a mechanism which involves more than one Not Answered Synchronisation is nothing but when elements
webdriver may be faster when compared to our between an application under test and selenium. components to work parallel with Each other. on the web page are in sync with the WebDriver.
web application as it takes some time to load our in order to achieve this, we can use both Generally in Test Automation, we have two It avoids exceptions like timeoutexception we use
page conditional and unconditional waits components, impliciWait() or explicitWait() methods.
or for webelements to be present in our webpage Syntax for the implicit wait : 1. Application Under Test driver.manage().timeouts().implicityWait(20,
At that time Selenium will throw the exception -driver.Manage().Timeouts().ImplicitlyWait 2. Test Automation Tool. TimeUnit.SECONDS);
""ELEMENTNOTVISIBLEEXCEPTION"" (TimeSpan.FromSeconds(30)); Both these components will have their own
So to match the speed of the application or in speed. We should write our scripts in such a way
some case, to wait for specific condition at some that both the components should move with
point of time , we use synchronization in same and desired speed, so that we will not
selenium, which helps to bring the AUT and encounter ""Element Not Found"" errors which will
selenium Speed in sync consume time again in debugging.
Synchronization can be effectively handled by
Synchronization in Selenium : implicit and explicit waits. Implicit is application
============================ to all elements in the page.
1) Implicit wait WebDriver driver = new FirefoxDriver();
2) Explicit wait driver.manage().timeouts().implicitlyWait(10,
3) Thread.sleep() TimeUnit.SECONDS);
4) Fluent wait driver.get(""http://www.google.com"");

1) Implicit wait:
=================
Implicit wait will wait for the specified time before
throwing the exception

Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);

1. Implicit wait is a single line of code and can be


declared globally which is applied to all the
webelements
2. It is a Dynamic wait and it won't wait for the
specified time if the element found early and
continues to the next line for execution
3. It will be applied till the end of driver life
Bangalore Synechron technologies 4_S 8 How u will handle popup window ?other then get window Pop-up window can be handled using the java we can use void accept() and void dismiss() Not answered Not Answered May be using .switchTo.Alert(); and then click();
handle based utility Robot which is used to control methods to handle the web-based popup's other
keyboard and mouse actions. than window handles.

Common use-cases using Robot class:


Create object for robot class
Robot robot = new Robot();

1) To press down arrow of keyboard we use


robot.KeyPress(KeyEvent.VK_DOWN)
2) To press TAB key of Keyboard we use
robot.KeyPress(KeyEvent.VK_TAB)
3) To press ENTER key of keyboard we use
robot.KeyPress(KeyEvent.VK_ENTER)
Bangalore Synechron technologies 4_S 9 What is Listeners? Listeners is an interface that modifies the Listener is defined as interface that modifies the istener is defined as interface that modifies the Not Answered Inbuild Interfaces in TestNG. They are used to
behaviour of system. Listeners allow default TestNG's behavior. As the name suggests default TestNG's behavior. As the name suggests listen to every event that occur in Selenium
customization of reports and logs. Listeners ""listen"" to the event defined in the Listeners ""listen"" to the event defined in the code. We use annotation @Listeners. Most widely
Listeners comprise of two types namely. selenium script and behave accordingly. It is selenium script and behave accordingly. It is used Listener is ITestListene - we can use
1. Webdriver Listeners used in selenium by implementing Listeners used in selenium by implementing Listeners methods like onTestSuccess() , onTestFailure(),
2. TestNG Listeners Interface Interface. It allows customizing TestNG reports or onTestSkipped(), onStart(), onFinish()
logs. There are many types of TestNG listeners
available.
Bangalore Synechron technologies 4_S 10 How u will handle alert? we use driver.switchTo().alert();after created an 1) void dismiss() – The dismiss() method clicks on we can use Alert Interface to handle alerts in driver.switchTo.Alert();
Webdriver provides an API to handle alery object for that interface and use alert.accept(); , the “Cancel” button as soon as the pop up selenium webdriver. We can easily switch to alert
dialogues. Alerts cannot able to inspect if there alert().dismiss(); to handle it. window appears. 2) void accept() – The accept() from the main window by using Selenium's .
is no Alert in the screen, we will get method clicks on the “Ok” button as soon as the switchTo() method.
'NoAlertPresentException'. The Alert interface pop up window appears. 3) String getText() – The if we want to accept alert we use
contains a number of API's to execute different getText() method returns the text displayed on driver.switchTo().alert().accept();
actions. the alert box. if we want to dismiss the alert
driver.switchTo().alert().dismiss();
Alert alert = driver.switchTo().alert(); if we want to capture the alert message.
alert.accept(): This is equivalent to the OK button driver.switchTo().alert().getText();
action on the dialog if we want to send some data to alert box.
alert.dismiss(): This is equivalent to the clicking driver.switchTo().alert().sendKeys("Text");
on CANCEL action button
alert.sendKeys(""String""): This will allow to type in
some text into the alert
alert.getText(): This will return the text that
appears on the dialog
Bangalore Synechron technologies 4_S 11 How to get system date and time? By printing the instance of java.util.Date class, You use date class to get system date and time Needs to Decide which date format we want, then Not Answered DateFormat dateFormat = new SimpleDateFormat
you can print current date and time in java. and use SimpleDateFormat to get in concerned we can use SimpleDateFormat class to do the (""MM/dd/yyyy HH:mm:ss"");
format. same. SimpleDateFormat(“MM/dd/yyyy”) Date date = new Date();
java.util.Date date=new java.util.Date(); Date date = new Date(); Created Date class object which will return Date String date1= dateFormat.format(date);
System.out.println(date); SimpleDateFormat formatter = new and time.Then using format method get the date syso(date1);
SimpleDateFormat(""dd/MM/yyyy HH:mm:ss""); and time
System.out.println(formatter.format(date));
Bangalore Synechron technologies 4_S 12 How to connect to database? 1. Download the jar file of MySQL Connector Create Connection to DB -> Create Statement DriverManager.getConnection(URL, ""userid"", 12> using JDBC driver API we can establish driver.getDatabase();
2. Add the reference of this jar to your project Object -> Execute the SQL Query. Store results in ""password"" ) database connection in our framework String url = ""jdbc: odbc: makeConnection"";
(Right click on the project => Build Path => ResultSet Here, code is: Connection con = DriverManager.driver.
Configure Build Path => Add Library => Select the Connection con = DriverManager.getConnection Userid is the username configured in the Steps(jdbc connections): getDatabase(url,""userid"",""pwd"");
Jar => OK (dbUrl,username,password); database Load the Drivers
Statement stmt = con.createStatement(); Password of the configured user Class forname(“com.mysqljdbc.Driver”) // loading
ResultSet rs= stmt.executeQuery(query); URL is of format jdbc:< dbtype>://ipaddress: the driver
portnumber/db_name"" Connect the database with eclipse
<dbtype>- The driver for the database you are DriverManager.getConnection(“jdbc:mysql:
trying to connect. To connect to oracle database //hostname/dbname”, “username”, “password”);
this value will be ""oracle"" //connecting the database with eclipse/java
For connecting to database with name ""emp"" in Create statement
MYSQL URL will bejdbc:mysql://localhost: Con.CreateStatement();
3036/emp //Used to create statement
And the code to create connection looks like Execute statement
Stmt.executeQuery(“select * from selenium”);
Connection con = DriverManager.getConnection
//executes the statements given
(dbUrl,username,password);Need to load the
JDBC Driver using the code
Class.forName(""com.mysql.jdbc.Driver"");
Bangalore Synechron technologies 4_S 13 Exceptions in selenium? (1) WebDriverException NoSuchElementException. NoSuchElementException Not Answered NoSuchElement
(2) NoSuchElementException NoSuchWindowException NoSuchWindowException ElementNotVisible
(3) NoSuchFrameException NoSuchFrameException NoSuchFrameException TimeOutException
(4) NoAlertPresentException NoAlertPresentException. NoAlertPresentException StaleElementaexception
(5) NoSuchWindowException ElementNotVisibleException InvalidSelectorException ArrayIndexOutOfBound
(6) ElementNotVisibleException TimeoutException ElementNotVisibleException NoSuchFrame
(7) ElementNotInterceptableException ElementNotSelectableException NoSuchWindow
(8) SessionNotCreatedException TimeoutException NoSuchAlert
(9) TimeOutException NoSuchSessionException
(10) InvalidSelectorException StaleElementReferenceException
(11) IllegalStateException
(12) StaleElementReferenceException etc...
Bangalore Synechron technologies 4_S 14 Suppose u have class and abstract class in class there is The main method will always be excecuted first, The main method will always execute first User defined constructor Not Answered Abstract class will get executed first if the class
a user defined constructor and main method which one because it is a special static method that will be because it is a special static method that will be extends the abstract class.
will get execute first? called from Java itself to start an application called from Java itself to start an application.
Bangalore Synechron technologies 4_S 15 Primitives and Non Primitives datatypes in java? String is Ans: Primitive types are predefined (already A primitive data type is pre-defined by the Primitives and Non Primitives datatypes in java? 15> In Java, Data types are divided into two groups: The primitive data types - boolean, char, byte,
primitive or non primitive defined) in Java. programming language. The size and type of String is primitive or non primitive short, int, long, float and double - Inbuilt.
byte, int, long, short, float, double, char etc are variable values are specified ex: int, char, float, The primitive data types include byte, int, long, Primitive data types - includes byte, short, int, long, Non-primitive data types- String,Classes,
primitive data types double short, float, double, and char. ... float, double, boolean and char Interfaces, and Arrays- user defined except
--> Non-primitive types are created by the Non-Primitive Data Types: These data types are Non-primitive, or reference data types, are the Non-primitive data types - such as String, Arrays, string
programmer and is not defined by Java (except not actually defined by the programming more sophisticated members of the data type Interfaces and Classes
for String ) language but are created by the programmer family. ... And String s Non primitive data type, because it
class, interface, or array variable are non- Reference types can be a class, interface, or refers to an object. The String object has methods
primitive data types array variable. that are used to perform certain operations on strings
--> A String in Java is actually a non-primitive String is not a primitive data type like trim(),toLowercase(),split(),toCharArray()....etc
data type, because it refers to an object. The
String object has methods that are used to The main difference between primitive and non-
perform certain operations on strings primitive data types are:
Primitive types are predefined (already defined) in
Java. Non-primitive types are created by the
programmer and is not defined by Java (except for
String).
Non-primitive types can be used to call methods to
perform certain operations, while primitive types
cannot.
A primitive type has always a value, while non-
primitive types can be null.
A primitive type starts with a lowercase letter, while
non-primitive types starts with an uppercase letter.
The size of a primitive type depends on the data
type, while non-primitive types have all the same
size.

Bangalore Synechron technologies 4_S 16 What is Hashmap ? Can we store objects in hash map and Ans: HashMap is a hash table based The string is a non-primitive data type, because HashMap<Integer, String> hmap = new 16> HashMap is a Map based collection class HashMap is a class in Collections framework. It
how to retrieve them? implementation of Java's Map interface. A map is it refers to string object HashMap<Integer, String>(); available in collection A has unique combination of Keys and values. Yes,
an object that maps keys to values. A map pi. in this we can store the objects in the form key we can store objects in hash map.
cannot contain duplicate keys /*Adding elements to HashMap*/ value pair. we use put(key, value) function to store We can retrieve them by using -
--> In Java HashMap object provides key/value hmap.put(12, ""Chaitanya""); the objects and we use get(object key) function to map1.keySet();
pairs for storing information in memory. You can hmap.put(2, ""Rahul""); retrieve object from hashmap. map1.values();
store any data type combination as long as the hmap.put(7, ""Singh""); we can use syso(map1) to retrive all elements of
keys are unique. hmap.put(49, ""Ajeet""); the hash map.
--> When you want to retrieve the object, you call hmap.put(3, ""Anuj"");
the get() method and again pass the key object.
/* Display content using Iterator*/
Set set = hmap.entrySet();
Iterator iterator = set.iterator();
while(iterator.hasNext()) {
Map.Entry mentry = (Map.Entry)iterator.next();
System.out.print(""key is: ""+ mentry.getKey()
+ "" & Value is: "");
System.out.println(mentry.getValue())
For each key-value to be stored in HashMap, a
hash value is calculated using the key's hash
code.
This hash value is used to calculate the index in
the array for storing Entry object.
Bangalore Synechron technologies 4_S 17 What is Jenkins? Jenkins is an open source automation tool Hash map is part of collections which stores data Jenkins – an open source automation server Not Answered Jenkins is a continuous integration tool. Jenkins
written in Java with plugins built for Continuous in the form of key and values. which enables developers around the world to is centralized across teams, geographical
Integration purpose. Jenkins is used to build and yes we can store objects as keys in hasp map. reliably build, test, and deploy their software. locations and has its own environment.
test your software projects continuously making use get methods to retrieve the data.
it easier for developers and testers to integrate
changes to the project, and making it easier for
users to obtain a fresh build
Bangalore Synechron technologies 4_S 18 What is the use of Pom.xml? A: POM stands for Project Object Model. Jenkins is a free and open-source automation The pom. xml file contains information of project 18> Pom.xml is file which got created when we In a maven project POM.xml builts the
--> It is fundamental unit of work in Maven. server, facilitating continuous integration and and configuration information for the maven to create a maven project. This file contains information environment of our proj by downloading
--> It is an XML file that resides in the base continuous delivery build the project such as dependencies, build about the project and configuration details used by dependencies and plugins.
directory of the project as pom. xml. directory, source directory, test source directory, Maven to build the project. we add all our project
--> The POM contains information about the plugin, goals etc. Maven reads the pom. dependencies in the form of xml tags where we give
project and various configuration detail used by groupid artifact id and version details.
Maven to build the project
--> We can run all our test cases using POM.xml
file
Bangalore Synechron technologies 4_S 19 What is the use of testng.xml? TestNG. xml file is a configuration file that helps XML file that contains information about the TestNG. xml file is a configuration file that helps Not Answered testng.xml is the heart of executing testng test
in organizing our tests. It allows testers to create project and configuration details used by Maven in organizing our tests. It allows testers to create cases. We can drive our test cases, test suites
and handle multiple test classes, define test to build the project. and handle multiple test classes, define test through them on a single or different browser. We
suites and tests. It makes a tester's job easier by suites and tests. It makes a tester's job easier by can also run them in parellel.
controlling the execution of tests by putting all controlling the execution of tests by putting all
the test cases together and run it under one XML the test cases together and run it under one XML
file file.
Bangalore Synechron technologies 4_S 20 Annotation used in page object model? Here we use @FindBy annotation to find elements A: @FindBy is one of the annotation used in the Ans : @FindBy " Not Answered POM - we use .by
and to initialize webelements using initelements page object model" PFM - we use .findBy
process

Bangalore General Electric 5_G 1 Ways to find broken links in selenium (except using first i will find all the links in webpage using
HTTPURL Connection) findelements() method and as we know all the
links start with <a> tag .
then i will fond the total no.of links available in
webpage using size() method.
then iterate the loop, in loop i will perform
control+enter action using keys in selenium.
then we find the window handles using
getWindowHandles() method and iterate the
process to get the text of each link. "
Bangalore General Electric 5_G 2 Why did you choose selenium? Not Answered
Bangalore General Electric 5_G 3 Test scenarios for Amazon search results page Not Answered
Bangalore General Electric 5_G 4 Test scenarios for Screen sharing in an app Not Answered
Bangalore General Electric 5_G 5 How will you test a button which is enabled only for 5 Not Answered
minutes in a day.
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Bangalore GE Healthcare 6_G 1 How u handle dynamic drop-down list dynamically with a if the dropdown id are changing dynamically time u need to click based on user input further it wil
scenario to time, take u to diff window and then u need to handle d
( entire program they asked to write) driver.findElement(By.id(""id"")).sendkeys alert)
(""UserInput"");
driver.findElement(By.id(""id"")).sendKeys(Keys.
Enter);
String Homepagewindow = driver.
getWindowHandle();
Set<String> winhandles = driver.
getWindowHandles();
for(String handles : winhandles ) {
if(!handles.equals(Homepagewindow)) {
driver.switchTo().window(handles);
Alert alert = driver.switchTo().alert();
alert.accept();
}
Bangalore GE Healthcare 6_G 2 OOPS concept with programs Already provide answer in 3_R OOPS concept with programs - have mentioned
above
Bangalore GE Healthcare 6_G 3 About bug life cycle Journey of bug New-Assigned-Open-Fix-Resolved-Retest-Close
New -> Assigned -> Open -> Fixed -> Retest -> Or Retest-Open
Close Or Open-Not a Bug/deffered
New -> Assigned -> Open -> Fixed -> Retest ->
failed ->Re-assigned ->retest->Close
Bangalore GE Healthcare 6_G 4 Diff annotations in testng Already answered 2_w ->13 " A: @BeforeSuite, @BeforeTest, @BeforeClass
@Test @BeforeMethod @AfterMethod @AfterClass
@AfterTest @AfterSuite @Parameters
@DataProvider

Kolkata PricewaterhouseCoopers 7_P 1 Tell something about yourself Intro


Kolkata PricewaterhouseCoopers 7_P 2 What strategies you followed while building a Selenium 1. If we need to run tests in parellel
framework from scratch? 2. If we need data sheet for testing
3. If we need to focus on acceptance criteria for
each scenario for checking the behaviour of the
application
4. Best tools that can take care of our
requirements
Kolkata PricewaterhouseCoopers 7_P 3 How can we scroll to end of an page in dynamically ((JavascriptExecutor) webDriver).executeScript
loading page? (""arguments[0].scrollIntoView();"", element1);
Kolkata PricewaterhouseCoopers 7_P 4 Related to above question, if I ask you to find one element Not answered
while scrolling and then stop when found, how would you
handle it?
Kolkata PricewaterhouseCoopers 7_P 5 As a Team Lead, how you will evaluate your team's Depending on the quality bugs found, initiative to
performance improve overall quality of the project, extra
initiatives taken, client appreciation, timely
deliveries
Kolkata PricewaterhouseCoopers 7_P 6 What's the difference between Test Plan and Test Strategy Test plan document is a document which
contains the plan for all the testing activities to
be done to deliver a quality product.
Test Strategy is a high-level document and
usually developed by a project manager.
Kolkata PricewaterhouseCoopers 7_P 7 If there are 3 test cases with method names as "banana", if they have the same priority, they will be
"cat" & "apple" in respective order, which test call will executed alphabetically.
execute first and why?

Bangalore Harman 8_H 1 Roles and responsibilities Not Answered Roles and responsibilities
Bangalore Harman 8_H 2 Explain wyat you done in SQL testing Not Answered salesforce workbench, MySQL
Bangalore Harman 8_H 4 Explain What you done in API testing? Not Answered Postman, SF workbench Rest Explorer, Rest
Assured automation
Bangalore Harman 8_H 6 Explain different types of deffect management ? Not Answered JIRA, Quality Center, Trello
Bangalore Harman 8_H 7 Explain Bug cycle During the execution of test cases, if tester find Given the ans above
any defect, he will log that defect in the defect
tracking tool.

So, when the tester first time log the defect in


tool, then the initial status of the defect is new
and it will assign to test lead.

Then test lead will review the defect then he will


change the status to open and he will assign to
developer.

Then developer review the defect and if it is a


valid defect, he will fix it and change the status to
fixed and will assign back to the tester.

So, then tester will retest the defect and if it is


working as expected then he will close the
defect.

If a defect is partially fixed, then he will change


the status to reopen.

In other situations, like the defect which is


assigned to developer is not a valid defect then
he will change the status to rejected.

Or in some other situation, like if the defect is


valid and not of high priority and if they want to
fix it in future release then they will change the
status to differed.

And in few conditions if the same defect logged


again and again, the defect status will be
duplicate.
Bangalore Harman 8_H 8 Explain How you handle exception Not Answered Using Try catch block, using Listeners, using
Throws declaration
Bangalore Harman 8_H 9 What is xpath?Type of X path.Explain each type Not Answered Xpath gives the XML path of an element inside
the page DOM structure. There are two types-
Relative and Absolute.
Absolute xpath- traverses from parent node to
the exact tag. We generally use /.
Relative xpath- traverse directly to the tag. We
generally use //
Bangalore Harman 8_H 10 What is Wait selenium,Diffrernt type of waits,Explain each Not Answered Explain each waits
waits
Bangalore Harman 8_H 11 How you convert string "HELLO" into String "hello" we can covert String HELLO to hello by using toLowerCase();
toLowerCase() function available in String class

PA, USA Highmark 9_H 1 How do we identify the web elements? Using diff locators-ID, Name, CSS, Xpath, LinkText,
ClassName, TagName, PartialLinkText
PA, USA Highmark 9_H 2 How does Selenium work? given the ans in above questions.
PA, USA Highmark 9_H 3 We have a login functionality of banking application. We We need to test following scenario. User logs into
need to test following scenario. User logs into user user account and checks savings account
account and checks balance. How do you automate this test?
savings account balance. How do you automate this test? driver.getURL(""URL"");
driver.findElement(By.(""usernamelocator"")).
sendKeys();
driver.findElement(By.(""passwordlocator"")).
sendKeys();
driver.findElement(By.(""submitbuttonlocator"")).
click();
driver.findElement(By.(""identificationLocator"")).
click();
implicitwait
navigate to the account, assertTrue the expected
value.
PA, USA Highmark 9_H 4 We have login functionality. What do you start to test this Diff permutato and combination of username and
functionality with? (Manual testing question) password.
PA, USA Highmark 9_H 5 What is the difference between functional testing and Functional- new functions introduced in the
regression testing? (Manual testing question) system
Regression- main functionalities of the system
used over and over without any major changes.

PA, USA Highmark 9_H 6 Have you worked with single layer application? No
PA, USA Highmark 9_H 7 Can you tell me about architecture of the application you Salesforce architecture - Cloud based app,
worked? backend, integration with external tools like
jenkins, git, APIs, Eclipse
PA, USA Highmark 9_H 8 What is relative Xpath? How do we build it? Where do you Stated in previous questions.
start it?

Bangalore Thermo Fisher Scientific 10_T 1 How do you perform parallel testing in selenium? We use parallel attribute in testng.xml to acheive We define in Testng.xml file-
parallel testing in TestNG. It also has a <suite name=""TestSuite"" thread-count=""3""
parameter called as thread-count. The parallel parallel=""Test1"" >
can have the following values.
(1) Tests
(2) Classes
(3) Methods
(4) Instances

Ex:
<suite name = ""Deepthi"" parallel=""tests""
thread-count=""5"">
<test name=""Banking"">
<classes>
<class name =""test.day1""/>
</classes>
</test>
</suite>

In above example, execution will happen in


parallel mode for tests having thread-count of 5
Bangalore Thermo Fisher Scientific 10_T 2 Which framework do you use in current company? In Our project we are using Behavioral-driven Hybrid. explained in previous questions.
Framework by using Page Object Model design
pattern with page factory
Bangalore Thermo Fisher Scientific 10_T 3 Can you describe scrum ceremony? Scrum ceremonies are meetings that are unique Sprint Backlog, Sprint Planning, DSM, Sprint
to scrum teams. Scrum ceremonies ensure that review, Sprint retrospective
everyone (the scrum master, product owner and
development team, testing team ) is in-sync.
These ceremonies are held at key instances in a
sprint.

1. Sprint backlog refinement


2. Sprint planning meeting
3. Daily standup meeting
4. Sprint review meeting
5. Sprint retrospective meeting at end of sprint
Bangalore Thermo Fisher Scientific 10_T 4 What are the oops concepts ? OOPS concept in Java are the main idea behind stated in previous questions
java's object oriented programming
1. Class
2. Object
3. Data Hiding
4. Abstraction
5. Encapsulation
6. Inheritance
7. Polymorphism

1. Class:
=======
A class is a blueprint from which objects are
created. It is a collection of data members and
member functions

Ex:
public class Vehicle
{
int doors; //Data members
int speed;
String color;
public void run() //Member functions
{
//Implementation
}
}

2. Object:
========
Object is the instance of a class. Object is
created using new keyword.

Ex:
public class Vehicle
{
int doors; //Data members
int speed;
String color;
public void run() //Member functions
{
//Implementation
}
public static void main (String args[])
{
Vehicle v = new Vehicle();
v.run();
}
}

3. Data hiding:
============
Our internal data should not go out directly. So
we use the concept of data hiding
private access modifier should be used to
declare the data
Ex:
Class Account
{
private double balance; //Data hiding
public double getbalance()
{
Implementation
}
}
--> For Data Security
--> Highly recommended modifier for variables is
private

4. Abstraction:
=============
Hiding internal implementation and highlight the
set of services providing
-->For security
-->Abstraction can be implemented using
interface concept

5. Encapsulation:
===============

--> The Process of grouping Data members and


related methods can be refered as
encapsulation
--> If any component allows Data hiding and
abstraction can be termed as an encapsulated
component
--> Encapsulation = Datahiding + Abstraction

Example:
========
class Student
{
private int age;
private int roll no;
private float marks;
public void read()
{
}
public void write()
{
}
}

6. Inheritance:
=============
--> It is one of the oops concept where the child
class acquires the properties of parent class (or)
super class
--> extends keyword is used to inherit the
properties of class
1. Single inheritance
2. Multilevel inheritance
3. Hierarichal inheritance

--> Java doesn't support multiple inheritance

7. Polymorphism:
================
Ability of an object to take different forms can be
referred as polymorhism

1. Compile time polymorphism:


==========================
Method resolution at compile time acheived
using method overloading(multiple methods with
same name but different signature)

2. Runtime polymorphism:
=======================
Method Resolution at runtime acheived using
Bangalore Thermo Fisher Scientific 10_T 5 Explain overriding and method over loading . method overloading:
Method overriding in subclasses Multiple methods with the same name, having
================= different arguments in the same class
--> Overloading deals with multiple methods in 1. Argument count should be different
the same class with the same name but different 2. Or argument data type should be different
signatures
--> Overloading lets you define a similar Method Overloading
operation in different ways for different data. Same name of methods in different classes
having same data type, same arguments too
Method overriding: creating object of one class and calling the
================ function will override the method of another
--> Overriding deals with two methods, One in the class
parent class and one in a child class that have
the same signature
--> Overriding lets you define a similar operation
in different ways for different object types.

Bangalore Thermo Fisher Scientific 10_T 6 What is difference between constructor and interface ? Constructor : Constructor is the method inside the class that
=========== has same name as that of the class. It gets
Constructor has same name as the class name invoked when object of that class is created.
Constructor is used to initilize the data members Interface consists of only abstract methods. It
and start up tasks can be implemented by other classes.
Constructor is automatically called when an
object is created
There is no return data type in constructor
There is always a default constructor provided
by compiler

Interface:
=========
Interface contains only abstract methods
Access modifiers for methods in interfaces must
be public
Variables defined must be public,static,final
To implement an interface, we use implements
keyword

Bangalore Thermo Fisher Scientific 10_T 7 Why do you need geckodriver ? GeckoDriver is a connecting link to the Firefox For running Selenium with Firefox browser.
browser for your scripts in Selenium. GeckoDriver
is a proxy which helps to communicate with the
Gecko-based browsers (e.g. Firefox)
Bangalore Thermo Fisher Scientific 10_T 8 What is difference between explicit wait and implicit wait ? 1) Implicit wait: wait time out for webdriver till the specified time.
================= It can be overridden instead of 10 can gve 15
Implicit wait will wait for the specified time before seconds. It is global wait
throwing the exception driver().manage().timeouts().implicitlyWait(10,
TimeUnit.SECONDS);
Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS); Explicit wait is for a specific element on the page
Dynamic wait - create object of webdriverwait:
1. Implicit wait is a single line of code and can be WebDrriverWait(driver, 5).until
declared globally which is applied to all the (ExpectedConditions.presenceofElementLocated
webelements (By.id())""
2. It is a Dynamic wait and it won't wait for the
specified time if the element found early and
continues to the next line for execution
3. It will be applied till the end of driver life

2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class

Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);

//apply the wait for specific element. Below


statement will wait for element to be present till
10 sec as specified by above
wait.until(ExpectedConditions.
presenceOfAllElementsLocatedBy((By.xpath(""//a
[@class='ico-register']""))));
Bangalore Thermo Fisher Scientific 10_T 9 Class A have 3 method , class B have 2 ,class B inherited By using child class reference we can call both ClassA variable1 = new ClassB();
class A, how do you call method of class A by creating parent and child class methods. variable1.methodb1();
object of class B ?
B b=new B();
b.aclassmethod1();
b.aclassmethod2();
b.aclassmethod3();
Bangalore Thermo Fisher Scientific 10_T 10 What are annotation in testNG ? Ans: @Test: TestNG recognizes it as a test case. have mentioned in previous questions.
@Test followed by method
@BeforeTest: The method which comes under
this annotation will be executed first before any
test belonging to that folder.
@AfterTest: The method which comes under this
annotation is executed after the execution of all
the test methods of the available classes
@BeforeSuit: The @BeforeSuite annotated
method is executed before the execution of all
the test cases defined in the folder
@AfterSuit: @AfterSuite annotated method is
executed after the execution of all the test
methods in the Suite.
@BeforeMethod: @BeforeMethod annotated
method is executed before the execution of each
test method
@AfterMethod: @AfterMethod annotated method
will be invoked after the execution of each test
method
@BeforeClass: @BeforeClass annotated method
runs before the execution of test methods in a
current class.
@AfterClass: @AfterClass annotated method will
be executed after all the test methods of a
current class have been invoked.

Bangalore Thermo Fisher Scientific 10_T 11 How many suits can be there in testNG , what if I run all the Not Answered there are be multiple suites. will give results for
suits ? all suits.
Bangalore Thermo Fisher Scientific 10_T 12 As lead,how do you define quality of product before Quality of product - no P1/p2 - Blocker issues All bugs closed, no major bugs found, test
release? Insprint automation to ensure all the acceptance coverage is 100%
criteria of stories are met
Bangalore Thermo Fisher Scientific 10_T 13 in testNG, do we have multiple suit in one XML file and what Not Answered yes. we can . mentioned in previous questions.
if I want to run all suits ?

Bangalore Wells Fargo 11_W 1 In a web page there are several Pop-up, but we don't when we can handle dynamic popups using testNG TestNG Listeners
the pop-up will appear, in this case how we will handle the listeners. As we don't know when popup will occur
Pop-up using Selenium WebDriver (Java) during test script execution in this condition first we
write one generic function to handle the popup then
we call this popup in ITestListener implementation
class.
for example: i have a generic function
isAlertPresent(). i create one listener class which
implements the ITestListener Interface. In this
listener class, under toTestStart() function i will call
the isAlertPresent() method. As we know for every
test method execution before, toTestStart() function
is invoked. in this way for each and every test script
it will first check popup is present or not accordingly
it will perform alert actions.

Mumbai Jio 12_J 1 Suppose you are the leam QA and 1 new member join your Being a lead QA, i will first help the new hire get Give tasks that will help her learn the
team and at the same time you have a deadline to meet in familiar with all the team members and let him applications better but nothing on high priority
next 2 or 3 days so how will you involve that new member introduce himself. In case of immediate deadline, tasks. utilize by giving tasks that will help in
in team so that you can utilise him/her to meet deadlines? I will let him/her know the same, the situation we reaching goals like updating various statuses,
are in and make her comfortable about the scope updating excels, reporting, tracking etc
of the immediate need. I will get him/her familiar
with important people who he/she needs to know
in short term. I will define and prioritize a list of
task for the new team member and ask him/her to
contribute and work on them in his/her full
capability.
Take help from the senior folks and team member
in and around her. And never hesitate to
approach anybody including me to resolve or
find solution of any of the task given. And try and
complete the tasks because of the deadline and
regularly update the team with latest status so
that other can pickup those tasks which the new
team member is unable to work on
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Bangalore Fossil 13_F 1 Java- Write a Java program to print 1234 1234 in two rows. (1) Write a program to print 1234 1234 in two rows? "in order to print the order number from the public void mthod1(){ 1.
Ans: success message for(int i=0;i<2;i++) public class MovingZerosToEnd {
first we need to locate success message {
public class Polymorp { webelement and capture the text from web page System.out.println(""1234""); public static void main(String[]
by using findElement() and getText() methods. } args)
public static void main(String[] args) { then we store the text in a string } {
// TODO Auto-generated method stub now from that string we need to print only order int[] arr= {2,5,0,4,2,7,0,0,1,9,4,0,0,10};
number which means only digits. int[] r=moveZeros(arr);
for(int i=1;i<=4;i++) for this we need to write the below function in our System.out.println(Arrays.toString(r));
{ script }
System.out.print(i); public static int[] moveZeros(int[] a)
} public String extractDigits(String message) { {
System.out.println(); StringBuilder builder = new StringBuilder int index=0;
for(int i=1;i<=4;i++) (message.length()); for(int i=0;i<a.length;i++)
{ for (int i = 0; i < message.length(); i++) { {
System.out.print(i); char c = message.charAt(i); if(a[i]!=0)
} // with the help of isDigit() function we can filter {
the digits from the message a[index++]=a[i];
} if (Character.isDigit(c)) { }
builder.append(c); }
} } while(index<a.length)
} {
return builder.toString(); a[index++]=0;
}
return a;
}

}
2.
public class
PrintingDuplicateCharacters {

public static void main(String[]


args) {
String s="hcl-tech";
printDupes(s);

}
public static void printDupes(String
s)
{
char[] c=s.toCharArray();
Map<Character,Integer>
map=new LinkedHashMap<>();
for(int i=0;i<c.length;i++)
{
map.put(c[i], map.
getOrDefault(c[i], 0)+1);
}
for(Map.Entry<Character,
Integer> m : map.entrySet())
{
if(m.getValue()>1)
{
System.out.println(m.
getKey()+" --> "+m.getValue());
}
}
}

3.
public class ReverseString {

public static void main(String[]


args) {
String s="Java is a
programming language";
String r=reverse(s);
System.out.println(r);
}
public static String reverse(String
s)
{
int start=0;int end=s.length()-1;
while(start<end)
{
if(s.charAt(start)==' ')
{
start++;

}
else if(s.charAt(end)==' ')
{
end--;

}
else
{
s=String.valueOf(swap
(s,start,end));

start++;end--;
}
}
return s;

}
private static char[] swap(String s,
int start, int end) {
char[] ch=s.toCharArray();
char temp=ch[start];
ch[start]=ch[end];
ch[end]=temp;

return ch;

Bangalore Fossil 13_F 2 Selenium- In a online shopping application after placing a fetch the dynamic number generated in a
order, a success message will be displayed with a variable and print variable
weborder number. How to fetch and print the Weborder
number from that success message. The success
message can be in any language. (The weborder number
can be displayed anywhere in the success message
depending on the language)

Mi, Canada Canadian Tire Bank 14_C 1 Explain Set and Map in Java. Set: SetInterface->HashSet example, TreeSet and
==== LinkedHashSet
A set is a collection that cannot contain Does not accept Duplicate values
duplicate elements. How ever it makes no No guarantee that elements r stored in
guarantees concerning the order of iteration. sequential order
Below are the classes Implement set interface
1. Hashset HashMap is used for Key and Value set
2. LinkedHashSet HashMap is not synchronized-> if multiple thread
3. TreeSet are running this HashMap simultaneosly, it is not
synchronized
Implementation of Set interface: HashMap allows null values
============================ HashMap values are iterated using iterator ->
public class Hashset iterator interface
{
public static void main(String args[])
{
HashSet<String> hs = new HashSet();
hs.add(""Deepthi"");
hs.add(""Keerthi"");
hs.add(""Spoorthy"");
s.o.pn(hs);
}
}
Methods in iterator interface:
========================
hasNext()
next()
remove()

Iterator interface is used to traverse each


element present in the set interface.

iterator<String> it = hs.iterator();
while(it.hasNext())
{
s.o.pln((it.next()); //Prints all elements present in
the set
}

Map:
=====
A map is an object that maps keys to values. A
map cannot contain duplicate keys.
Below are the main implementations of Map
interfaces
1. HashMap
2. LinkedHashedMap
3. TreeMap

Implementation of Map Interface:


===============================
public class HashMap
{
public static void main(String args[])
{
HashMap<Integer, String> hm = new HashMap
(Integer,String);
hm.put(0, ""Deepthi"");
hm.put(1, ""Keerthi"");
hm.put(2,""Spoorthy"");
s.o.pn(hm);
Set s = hm.entryset(); // Storing in set interface
Iterator i = s.iterator();
while(i.next())
{
Map.Entry m=(Map.Entry);
i.next();
s.o.pln(m.getKey());
s.o.pln(m.getValue());
}
}
Mi, Canada Canadian Tire Bank 14_C 2 If proper Xpath, cssSelector and ID are not available, how If proper xpath,cssSelector and id are not Xpath - parent child traverse
do you identify an object. available. We can use absolute xpath and travel
from first xml node to the current element.
We can use Linktext locator to find element

Mi, Canada Canadian Tire Bank 14_C 3 Explain how BDD works with Cucumber. Cucumber is a tool based on Behavior Driven Feature file having Scenario , given , when then
Development (BDD) framework which is used to statements writen. Corresponding code is
write acceptance tests for the web application. It present in step definition file and we run the
allows automation of functional validation in runner file using JUnit.
easily readable format like plain english to
business analysts, Developers, Testers etc.
Mi, Canada Canadian Tire Bank 14_C 4 How do you set the test data in BDD. Framework built in cucumber: adding a variable or using Examples and
======================== Scenario Outline
When we have multiple test data to pass in a
single step of a feature file, we need to pass
multiple parameters

Feature file:
==========
Feature: Login feature
Scenario outline: Login test
Given: User is on Login page
When title of Login page is Welcome
Then user enters ""<username>"" and
""<password>""

Examples
----------------
|username|password|
|test |test123|
|sample |sample1|

StepDefinition file:
===============
@Then(^user enters \*(.*)\ and \*(*.)
public void user enters (String uname, String
pwd)
{
sysout(uname);
sysout(pwd);
}
The corresponding mapping of the parametrized
then in feature file

Mi, Canada Canadian Tire Bank 14_C 5 How do you manage test execution using TestNG. testng.xml file is used to manage the test testng.xml
execution in testNG.

hierarchy of the xml file:


====================
suite
test
Class
Method

1. To execute only few TC belonging to different


classes we can use <groups> concept
in XML file:
<groups>
<run>
<include name=""smoke"">
</run>
</groups>

In testcase:
@Test(groups={""smoke""})

2. To control the alphabetical order of execution


we can use testNG helper attribute
'dependsOnMethods'
@Test(dependsOnMethods={""method1"",""
method2})
3. To skip TC from execution we can declare
method as
@Test(enabled=false)
4. If test case takes more time to execute then
give time attribute
@Test(timeout=40000)

Mi, Canada Canadian Tire Bank 14_C 6 Explain inner join and outer join in SQL. Inner Join: Inner join- table that has join within itself. Gives
========= the resukt from the same table.
This type of join returns those records which Outer join- Gives result from the left table.
have matching values in both tables.

Outer join:
========
An outer join returns a set of records (or rows)
that include what an inner join would return but
also includes other rows for which no
corresponding match is found in the other table.
There are three types of outer joins: Left Outer
Join (or Left Join) Right Outer Join (or Right Join)
Mi, Canada Canadian Tire Bank 14_C 7 Explain implicit and explicit wait. 1) Implicit wait: explained in previous questions.
=================
Implicit wait will wait for the specified time before
throwing the exception

Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);

1. Implicit wait is a single line of code and can be


declared globally which is applied to all the
webelements
2. It is a Dynamic wait and it won't wait for the
specified time if the element found early and
continues to the next line for execution
3. It will be applied till the end of driver life

2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class

Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);

//apply the wait for specific element. Below


statement will wait for element to be present till
10 sec as specified by above
wait.until(ExpectedConditions.
presenceOfAllElementsLocatedBy((By.xpath(""//a
[@class='ico-register']""))));

Delhi Pure software 15_P 1 Different types of Waits available in Webdriver Synchronization in Selenium: implicit wait,explicit wait,fluent wait Implicit, Explicit, Fluent wait, thread.sleep the different types of waits available in selenium Different types of Waits available in Webdriver- Implicit wait, Explicit wait and Fluent wait 1. Explicit wait, implicit wait, fluennt wait
======================== Avoid using Thread.sleep() as it haults(slows webdriver are Static, impliit, explicit, fuent waits
1) Implicit wait down) the execution. implicit wait -- it is a global wait which applicable
2) Explicit wait The most effective wait is Fluent wait as it applies to all the webElements
3) Thread.sleep() to specific element and for specific time user can Explicit Wait-- this is wait is applicable to single
4) Fluent wait provide. webElement with ExpectedCondition.
Fluent Wait - it is similar to Explicit wait.In this
1) Implicit wait: along with wait duration, ExpectedCondition we
================= define the frequency.
Implicit wait will wait for the specified time before
throwing the exception

Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);

1. Implicit wait is a single line of code and can be


declared globally which is applied to all the
webelements
2. It is a Dynamic wait and it won't wait for the
specified time if the element found early and
continues to the next line for execution
3. It will be applied till the end of driver life

2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class

Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);

//apply the wait for specific element. Below


statement will wait for element to be present till
10 sec as specified by above
wait.until(ExpectedConditions.
presenceOfAllElementsLocatedBy((By.xpath(""//a
[@class='ico-register']""))));

3) Thread.sleep():
====================
One of the way to achieve synchronization,
implement wait is by calling Thread.sleep()
function however, it is not recommended
because this
is not very stable and unreliable. The time has to
be specified in milliseconds.
Halts execution for particular time

Syntax: Thread.sleep(3000)

4) Fluent Wait:
===================
In Fluent Wait we define a Maximum amount of
time to wait for a condition. Also, we will be
defining a Polling frequency time while declaring
the Fluent Wait.Fluent Wait will be polling the web
pages every Polling frequency time to verify the
given condition.

Fluent Wait has Inbuilt exception handler, which


will handle NoSuchElementException until given
Maximum amount of time has breached.

Example:
=========
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);

WebElement element = wait.until(new


Function<WebDriver, WebElement>()
{
public WebElement apply(WebDriver driver) {
return driver.findElement(By.xpath(""find""));
} );
element.click();

Delhi Pure software 15_P 2 Different types of Navigation Commands driver.navigate.To() driver.naviagte().back()/forward()/refresh()/to(url) Navigation is an interface in selenium to do Different types of Navigation Commands - . Navigate.back, Navigate. Refresh, Navigate. (to 2. driver.manage.navigate.forward/back/to URL, to
navigate().back(): driver.navigate.back() /wait(); navigate back and forth in browser. it has navigate().back , .forward(), .equals(), refresh(), String)., Navigate. (to Url), Navigate. Forward string
=============== driver.navigate.forward() methods to move back, forward as well as to notify(), notifyAll(), to(String arg0), toString(), to
It takes back the user to the previous webpage in refresh a page (URL arg0)
the web browser’s history navigate().to()-- to launch a new web browser
Ex: driver.navigate().back(); window and navigate to the specified URL
navigate().back()-- takes back to the previous
navigate().forward(): webpage with reference to the browser's history
================= navigate().forward()--- to navigate to the next
Navigates to the next web page with reference to webpage with reference to the browser's history
the browser’s history navigate().refresh()-- to refresh the current web
Ex: driver.navigate().forward(); page

navigate().refresh():
==================
This command will refresh the current web page
there by reloading all the web elements.
Ex: driver.navigate().refresh();

navigate().to():
=============
Used to launch a new web browser window and
navigate to the specified URL.
Ex: driver.navigate().to(“https://google.com”);
Delhi Pure software 15_P 3 How to handle frame Frames can't be handled in the normal way. We driver.swichTo.frame(id/name/webElement); driver.switchTo().frame(); IFrame is a web page which is embedded in How to handle frame - driver.switchTo.Frame(); driver. SwitchTo(). frame(int), driver. switchTo(). 3. driver.switchTo().frame
need to tell selenium to go inside the frame and driver.switchTo.defaultContent();//to come out of Actions a = new actions(driver); another web page frame(toString), driver. switch To. frame
handle the webelement the frame a.dragAndDrop(source, target).build().perform(); We can identify the iframes using below methods (webelement)
We can identify if a frame is present in the once frame is done, driver.switchTo(). ---Right click on the element, If you find the
webpage by using the tagname iframe defaultContent(); option like 'This Frame' then it is an iframe.
---Right click on the page and click 'View Page
List<WebElements> iframes = driver.findElements Source' and Search with the 'iframe', if you can
(By.tagName(“iframe”)); find any tag name with the 'iframe' then it is
meaning to say the page consisting an iframe.
We can use below three methods to switch to we can switch over the elements in frames in
frame (String/FrameID/WebElement) three ways
switchTo.frame(int frameNumber) Switch to the frame by index:
switchTo.frame(string frameName) driver.switchTo().frame(index);
switchTo.frame(WebElement frameElement) Switch to the frame by id or Name:
driver.switchTo().frame(id);
switchTo().defaultContent(): Switching back and Switch to the frame by Web Element:
forth between iframes and parent page can be driver.switchTo().frame(WebElement);
achieved using this method once we done certain actions in frame if we want
to come out of frame then we need to use
driver.switchTo().defaultContent();
In case of nested frame we use
driver.switchTo().parentFrame();
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Delhi Pure software 15_P 4 How to handle Alerts Webdriver provides an API to handle alert By using alert method we can handle alerts in Selenium can't handle by inspecting elements. answered 4th question related to alerts in row id How to handle Alerts - driver.switchTo.Alerts(); driver.switchTo().Alert.dismiss, driver. Switch To. 4. driver.switchTo().alert().accept/dismiss
dialogues. Alerts cannot able to inspect. selenium we have to follow this: driver.switchTo().alert(). 4_S Alert. accept, driver. switchTo. Alert. get Text,
if there is no alert in the screen we will get driver.alert.accept(); accept() --> For OK/Yes/Done/Accepting alerts. driver. switchTo. sendKeys()
'NoSuchAlertException' driver.alert.dismiss(); driver.switchTo().alert().dismiss(); --> For
The alert interface contains a number of API's to No/Cancel Alerts.
execute different actions. driver.switchTo().alert().getText(); --> text present
in alert
Alert alert = driver.switchTo().alert(); driver.switchTo().alert().sendKeys(); --> can write
also.

1) alert().dismiss();:
===============
This method is used when the ‘Cancel’ button is
clicked in the alert box.

2)alert.accept():
==============
This method is used when you click on the ‘OK’
button of the alert.

3) alert.getText():
================
This method is used to capture the alert
message.

4) alert.sendKeys(""Text"");
=================================
This is used when you want to send some data to
alert box.
driver.switchTo().alert().sendKeys(""Text"");
Delhi Pure software 15_P 5 Difference between findelement and findelements 1. findElements method returns the list of all findElement:used to find single element element FindElement provides only one element present findElement() is used to find single webElement findElement- returns first element encountered By using the find Element we get the first 5. find element locates 1 element from the web
matching elements whereas findElement method in webpage in DOM while findElements gives the list of based on locator passed as parameter and if on the webpage matching element from multiple elements.By page where as find elements locates all objects
returns the specified webelement findElements:used to find multiple similar elements present. element is not found it will throws findElements- returns list of all webelements using the findElements we will get the list of from the web page having a same locator."
2. The findElement method throws a elements in web page and can be stored into one FindElement returns NoSuchElement Exception NoSuchElementException present on that page matching elements"
NoSuchElementException exception when the List while FindElements return empty list if no findElements() is used to find the list of similar
element is not available on the page. Whereas, locators match." webElements and if no elements is found it will
the findElements method returns an empty list return a list of 0 elements.
when the element is not available or doesn't exist
on the page

LA, USA Eharmony 16_E 1 As a QA where do you see yourself in next 6 months Well I am really excited by this position in Eharmony. I see myself leading an automation team. I have
In the next 6 months, I would like to be seen as grown as an automation QA in last 6 months learning
someone with deep understanding and expertise of Selenium, Java, TestNG, Cucumber, RestAssured,
the Quality Assurance field. I am also very excited to RestAPI. I want to learn RPA, Pyhton and Cypress
take on the responsibility of the Senior QA and next.
looking forward to immensely contribute to the
company's success in the next few months. Along
with sharing my knowledge and also gaining more
advanced technical skills in this field.

Bangalore Publicis Sapient 17_P 1 How to find broken links in web page using selenium
(including frames).
Bangalore Publicis Sapient 17_P 2 How will you handle dynamic payloads in API.
Bangalore Publicis Sapient 17_P 3 How to download a file using selenium.
Bangalore Publicis Sapient 17_P 4 How will you handle dependencies in Maven at run time.
Bangalore Publicis Sapient 17_P 5 How to fetch coupon code from image file.

Kolkata Cognizant 18_C 1 How do you manage a set of Data Tables in selenium? WebElement htmltable=driver.findElement(By.
xpath("//*[@id='main']/table[1]/tbody"));
List<WebElement> rows=htmltable.findElements
(By.tagName("tr"));

for(int rnum=0;rnum<rows.size();rnum++)
{
List<WebElement> columns=rows.get(rnum).
findElements(By.tagName("th"));
System.out.println("Number of columns:"
+columns.size());

for(int cnum=0;cnum<columns.size();cnum++)
{
System.out.println(columns.get(cnum).getText());
}
}
Step 1: First get the entire HTML table and store
this in a variable ‘htmltable’ of type web element.

Step 2: Get all the rows with tag name ‘tr’ and
store all the elements in a list of web elements.
Now all the elements with tag ‘tr’ are stored in
‘rows’ list.

Step 3: Loop through each row and get the list of


elements with tag ‘th’. ‘rows.get(0)’ will give first
row and ‘findElements(By.tagName(“th”))’ will give
list of columns for the row.

Step 4: Iterate using ‘columns.getsize()’ and get


the details of each cell.

Chennai Photon interactive 19_P 1 About yourself. 1>1.Hi, I’m xxxxxxxxx About yourself.
2.I have x years of experience in IT industry which
is totally into QA testing
3.I worked in different domains such as Finance,
Health care and Insurance.
4.As part of testing, I was involved in manual and
automation testing and I performed various types
of testing’s like smoke, sanity, regression,
integration, functional and User Acceptance
Testing.
5.As part of the testing ,I was involved in writing
test cases and test scripts.
6.I have good hands on experience working with
selenium and different components of selenium
like IDE, Web driver, Grid and have ability to
integrate maven,selenium,testng with eclipse
7.I have experience in cross browser testing with
different browsers such as chrome, Firefox and IE,
on different platforms and different versions.
8.I worked with various methodologies such as
waterfall/agile methodologies.
9.In Agile, I was involved in various meetings like:
sprint planning, status meetings, scrum
standups, grooming meetings and meetings with
business analysts, project managers, software
developers and QA leads.
I have ability to priorize and schedule multiple
tasks on a day to day basis.
10.I have also performed database transactions
using SQL queries.
11.I have performed parallel testing using
selenium grid and testNG.
12.I used different unit testing frameworks like
Junit and testNG to generate my reports,
13.And Maven as the build dependency tool, GIT
for version control.
14.I have used different bug tracking tools like jira,
Bugzilla and rally to log the defects.
15.I have experience in designing and
implementing the frameworks such as BDD and
TDD using cucumber tool and gherkin language
with java, selenium, maven
and continuous integration tools like Jenkins.
16.And I also have experience working with
Appium for mobile automation testing.
17.I have knowledge in testing different open
source API’s like SOAP, POSTMAN and REST using
Ready API and Rest Assured.
18.And I also had experience in testing AngularJS
applications by using protractor
19.This is pretty much about what I have done in
the past years.

Chennai Photon interactive 19_P 2 About project. Not Answered About project.
Chennai Photon interactive 19_P 3 Source code management tool. 3> source code management tool is a central Source code management tool.->GitHub
repository which is used to maintain automation
code. The commonly used SCM tools are
bitbucket, Github, CVS. In my project we used
Github to maintain our code where we can add ,
commit, push, pull and merge the code.
Chennai Photon interactive 19_P 4 How will you resolve the conflicts. question is not clear Pull requests tab, Resolve cnflicts, decide whos
changes, delete markers, mark as resolved,
commit merge
Chennai Photon interactive 19_P 5 What is static and final in java? 5> static and final are the keywords used in java memory is allocated only once for static variable
The main difference between a static and final or method . It is a class variable or method.
keyword is that static is keyword is used to final -> when applied to a variable or method or
define the class member that can be used class, its value cannot be changed. It will be
independently of any object of that class. Final constant
keyword is used to declare, a constant variable, a
method which can not be overridden and a class
that can not be inherited.
Chennai Photon interactive 19_P 6 How will you prevent tge override method in java 6> In java, we know that child class can override use private or static or final modifier to avoid
the parent class methods. so in order to prevent overridding
the overriding in java , we need to make parent
class methods as static or final. why because
static and final methods can not be override.
Chennai Photon interactive 19_P 7 Explain about collections. Not Answered it is a framrwork of classes and interfaces to
make data manipulation easy
Chennai Photon interactive 19_P 8 Cucumber tags and Annotations 8> In Cucumber we use tags to group the similar used to group certain scenarios and run them
type of scenarios just like groups in testng. we together as tags. @tags
use this tags in .feature file above the scenario
or scenarioOutline.
In Cucumber we use variuos types of annotations
which are predefined text, which holds a specific
meaning. It lets the compiler/interpreter know,
what should be done upon execution.
Given −
It describes the pre-requisite for the test to be
executed.
When −
It defines the trigger point for any test scenario
execution.
Then −
Then holds the expected result for the test to be
executed.
And −
t provides the logical AND condition between any
two statements. AND can be used in conjunction
with GIVEN, WHEN and THEN statement.
But −
It signifies logical OR condition between any two
statements. OR can be used in conjunction with
GIVEN, WHEN and THEN statement
Background −
Background generally has the instruction on
what to setup before each scenario runs.

Chennai Photon interactive 19_P 9 How will you pass values in your project? Not Answered by using .properties file, using @dataProvider or
excel using APache POI
Chennai Photon interactive 19_P 10 What is hooks and explain hooks. Not Answered Hooks are like annotations. @Before, @After,
@BeforeStep , @AfterStep
Chennai Photon interactive 19_P 11 What is background?? 11> Background is a cucumber annotation which If multiple scenarios have same GIVEN
is used in .feature file. statements for a feature, they can be added
Background generally has the instruction on unde Background
what to setup before each scenario runs.
Chennai Photon interactive 19_P 12 How will u run the method again and again in testng? 12> we can use invocationCount helper attribute. @DataProvider annotation in TestNG. You can add
This is a TestNG attribute that defines number of multiple tests in testngSuite and execute. Under
times a test method should be invoked or all tests the classes names should be same
executed before executing any other test inorder to execute same script multiple number
method. If invocationCount = 5, then the test of times
method will be executed 5 times before
executing next test method.
Chennai Photon interactive 19_P 13 How the methods run in the order?? we can use priority helper attribute to run the Using priority near ever @Test method starting
methods in order. If we don’t mention any from 0 to later. 0 being highest.and in xml tag we
priority, testng will execute the @Test methods use <suite name=""suite1"">
based on alphabetical order of their method <test name=""test"" preserve-order=""true"">
names irrespective of their place of
implementation in the code.when we assign the
Priority to each test case then the lower priority
value will be executed first.
Chennai Photon interactive 19_P 14 Parallel tests about class method and tests. Not Answered <suite name=""Parallel test suite"" parallel=""
methods"" thread-count=""2"">
Chennai Photon interactive 19_P 15 What is actions class and the methods in actions?? Not Answered actions class for mouse hover actions. methods-
moveToElement, doubleClick, clickAndHold,
Release, DragAndDrop.
Chennai Photon interactive 19_P 16 What is the difference between build and perform? Not Answered Build-> sequence the number of actions. perform
is used to execute one action
Chennai Photon interactive 19_P 17 Difference between find element and find elements and its Not Answered findElement-> first webelement matching the
return type. locator, retunr type is webelement. FindElements
-> list of all webelements matching the locator.
returns the list of webelements.
Chennai Photon interactive 19_P 18 Explain concepts in collections and relate to ur project. Not Answered collections framework-> arraylist, list, set,
hashmap, hashtable, map
Chennai Photon interactive 19_P 19 Consider u have checkbox and I want to click the checkbox Not Answered explicit wait with try catch block
, how will u find the element is present or not at the same
time should not get any exceptions.(element may or may
not present).
Chennai Photon interactive 19_P 20 Attributes of css selector. Not Answered Attributes of css selector.id, name, width: 150px;
display: block;
margin-bottom: 10px;
background-color: yellow;
Chennai Photon interactive 19_P 21 Program to find the found of special character, numbers, Not Answered class Count
capital letter and small letter in a given string. {
public static void main(String args[])
{
String str = ""#GeeKs01fOr@gEEks07"";
int upper = 0, lower = 0, number = 0, special =
0;

for(int i = 0; i < str.length(); i++)


{
char ch = str.charAt(i);
if (ch >= 'A' && ch <= 'Z')
upper++;
else if (ch >= 'a' && ch <= 'z')
lower++;
else if (ch >= '0' && ch <= '9')
number++;
else
special++;
}

System.out.println(""Lower case letters : "" +


lower);
System.out.println(""Upper case letters : "" +
upper);
System.out.println(""Number : "" + number);
System.out.println(""Special characters : "" +
special);
}
}"

Chennai CNSI 20_C 1 What is Owasp concurrent testing

Pune Wipro 21_W 1 Write a program that reads objects from property file in 1>we know that in .properties file we store data in
page object model framework. the form of key value pair. Below is the Program
to read the data in .properties file

File file = new File("D:/Dev/ReadData/src/datafile.


properties");

FileInputStream fileInput = null;


try {
fileInput = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Properties prop = new Properties();

//load properties file


try {
prop.load(fileInput);
} catch (IOException e) {
e.printStackTrace();
}

WebDriver driver = new FirefoxDriver();


driver.get(prop.getProperty("URL"));
driver.findElement(By.id("Email")).sendKeys
(prop.getProperty("username"));
driver.findElement(By.id("Passwd")).sendKeys
(prop.getProperty("password"));
driver.findElement(By.id("SignIn")).click();

System.out.println("URL ::" + prop.


getProperty("URL"));
System.out.println("User name::" +prop.
getProperty("username"));
System.out.println("Password::" +prop.
getProperty("password"));
}
}
Pune Wipro 21_W 2 How to handle windows pop with selenium without using 2> the other way of handling windows popup
auto it. without using AutoIT is through Robot class which
is available Java.
Benefits of Robot class:
-Robot Class can simulate Keyboard and Mouse
Event
-Robot Class can help in upload/download of
files when using selenium web driver
-Robot Class can easily be integrated with
current automation framework (keyword, data-
driven or hybrid).

Some commonly and popular used methods of


Robot Class during web automation
*keyPress(): Example: robot.keyPress(KeyEvent.
VK_DOWN) : This method with press down arrow
key of Keyboard
*mousePress() : Example : robot.mousePress
(InputEvent.BUTTON3_DOWN_MASK) : This method
will press the right click of your mouse.
*mouseMove() : Example: robot.mouseMove(point.
getX(), point.getY()) : This will move mouse pointer
to the specified X and Y coordinates.
*keyRelease() : Example: robot.keyRelease
(KeyEvent.VK_DOWN) : This method with release
down arrow key of Keyboard
*mouseRelease() : Example: robot.mouseRelease
(InputEvent.BUTTON3_DOWN_MASK) : This method
will release the right click of your mouse

Bangalore MResult 23_M 1 What's the fastest locator in Selenium? 1> It depends on the element to be identified…
If you are asking about execution time for
different locators then id is the fastest.
If it is a matter of convenience, then you follow
this sequence.
Mostly used is -> id
If id is not unique, then prefer to use name as
locator.
If element is a link with simple text, use link text
or partial link text.
If element is difficult to identify with id, name or
links, then go for Css, xPath..
Bangalore MResult 23_M 2 What does ::(double colon) in sibling xpaths represent?
Bangalore MResult 23_M 3 What's the dependency to read/write excel documents in 3> we need Apache POI Api dependency to
Selenium? read/write excel documents in selenium.
Bangalore MResult 23_M 4 What's the difference between imports and extends? Import is used to import the predefined packages
to the program
extends keyword is used in inheritance to
acquiring the properties of parent class

Bangalore MResult 23_M 5 Why do we use extends when we have imports options ? 5> extends is used to inherit a particular class.
Like rather than importing all classes of package
we need only one class of that package. so we
use extend keyword.Extend is a term of
inheritance.
Bangalore MResult 23_M 6 How to add/remove test cases in Testng.xml? 6> we can use include and exclude tags in
testng.xml to add/remove testcases in testng.
xml.
Lets take an example: if a Class have three Test
Methods. In that we will include two test methods
and try to exclude one test method.
sample testng.xml file looks like:
<!DOCTYPE suite SYSTEM "http://testng.
org/testng-1.0.dtd" >
<suite name="Sample Test Suite" verbose="1" >
<test name="Method Test Cases" >
<classes>
<class name="com.easy.entry.AddTestCase">
<methods>
<include name="testCase1" />
<include name="testCase"2 />
<exclude name="testCase3" />
</methods>
</class>
</classes>
</test>
</suite>
Bangalore MResult 23_M 7 How to add waits in Selenium? 7> we can add implicit wait in selenium using
below code:
driver.manage().timeouts().implicitlyWait(30,
TimeUnit.SECONDS);
to add Explicit wait:
WebDriverWait wait = new WebDriverWait(driver,
30);
wait.until(ExpectedConditions.
visibilityOfElementLocated(By.xpath("//div)]")));

Hyderabad HCL 24_H 1 Move all zeroes to end of array- Given an array of integers, public class ZerosToEndInArray {
Move the all zero's to end of the array. Push all the zero’s
of a given array to the end of the array. // Function to move all zeros present in the
Example 1: INPUT: myArray={2,5,0,4,2,7,0,0,1,9,4} ---OUTPUT: array to the end
myArray={2,5,4,2,7,1,9,4,0,0,0} public static void reorder(int[] A)
{
// k stores index of next available
position
int k = 0;

// do for each element


for (int i: A)
{
// if current element is non-zero,
put the element at
// next free position in the array
if (i != 0) {
A[k++] = i;
}
}

// move all 0's to the end of the array


(remaining indices)
for (int i = k; i < A.length; i++) {
A[i] = 0;
}
}

// Move all zeros present in the array to


the end
public static void main(String[] args)
{
int[] A = { 6, 0, 8, 2, 3, 0, 4, 0, 1 };

reorder(A);
System.out.println(Arrays.toString
(A));

}
}
Hyderabad HCL 24_H 2 Print all the duplicate character and their count in the 2> public class PrintDuplicates {
given string.
Example 1: INPUT : String str="hcl-tech" ---OUTPUT :h-2,c-2 public static void main(String[] args) {
// TODO Auto-generated method stub
String input = "hcl-tech";
findDuplicates(input);
}

public static void findDuplicates(String input)


{
char[] ch = input.toCharArray();
HashMap<Character,Integer> map = new
HashMap<>();
for(Character c: ch) {
if(!map.containsKey(c)) {
map.put(c, 1);
}else {
map.put(c, map.get(c)+1);

}
}
Set<Map.Entry<Character,Integer>> set=
map.entrySet();
for(Map.Entry<Character,Integer>entry :
set) {
if(entry.getValue()>1){
System.out.printf("%s : %d %n", entry.
getKey(),entry.getValue());
}
}
}
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Hyderabad HCL 24_H 3 Reverse a string preserving space positions. INPUT : "Java 3> public class
is a programming language" ---OUTPUT : "egau gn a ReverseStringWithSpacePreserved {
lgnimmargor pasiavaJ"
public static void main(String[] args) {
// TODO Auto-generated method stub
String str= "Java is a Programming Language";
reverse(str);
}

// program to reverse a string preserving


space positions
public static void reverse(String str) {

char[] inputArray = str.toCharArray();


char[] result = new char[inputArray.length];

// Mark spaces in result


for (int i = 0; i < inputArray.length; i++) {
if (inputArray[i] == ' ') {
result[i] = ' ';
}
}

// Traverse input string from beginning


// and put characters in result from end
int j = result.length - 1;
for (int i = 0; i < inputArray.length; i++) {

// Ignore spaces in input string


if (inputArray[i] != ' ') {

// ignore spaces in result.


if (result[j] == ' ') {
j--;
}
result[j] = inputArray[i];
j--;
}
}
System.out.println(String.valueOf(result));
}
}

Mumbai Accenture 25_A 1 Can we over load main method in java? 1>Yes, We can overload the main method in java
but JVM only calls the original main method, it
will never call our overloaded main method. So,
to execute overloaded methods of main, we must
call them from the original main method.

Mumbai Accenture 25_A 2 Explain about final class? 2> When a class is declared with final keyword, it
is called a final class. A final class cannot be
extended(inherited).
Mumbai Accenture 25_A 3 Test life cycle 3> Software testing life cycle is a sequence of
different activities which is performed by the
testing team to ensure the quality of the
software.
it is a part of SDLC.
The various phases involved in this cycle are:
Requirement Analysis
Test Planning
Test case development
Test Environment setup
Test Execution
Test Cycle closure

Mumbai Accenture 25_A 4 How to handle drop down using selenium ? 4> Using Select class in Selenium we can handle
drop downs
Select dropdown = new Select(driver.findElement
(By.id("selectDropdown")));
WebDriver provides three ways to select an
option from the drop-down menu.
1. selectByIndex - It is used to select an option
based on its index, beginning with 0.
dropdown.selectByIndex(5);
2. selectByValue - It is used to select an option
based on its 'value' attribute.
dropdown.selectByValue("Database");
3. selectByVisibleText - It is used to select an
option based on the text over the option.
dropdown.selectByVisibleText("Database
Testing");
Mumbai Accenture 25_A 5 Using selenium can we automate desktop application's ? 5> No,Selenium does not have the capability to
automate the desktop applications.It cannot
recognize the objects in a desktop application.
Mumbai Accenture 25_A 6 About vmodel? 6> The V-model is an SDLC model where
execution of processes happens in a sequential
manner in a V-shape.
This model came up in order to overcome the
drawbacks of waterfall model.
Under the V-Model, the corresponding testing
phase of the development phase is planned in
parallel. So, there are Verification phases on one
side of the ‘V’ and Validation phases on the other
side. The Coding Phase joins the two sides of the
V-Model.
Mumbai Accenture 25_A 7 How many locators available in selenium and explain each 7> Locators in selenium are used to identify the
and every one ? webElements on the webpage.
there are 8 types of locators available in
selenium webdriver.
id Locator:
ID’s are unique for each element so it is common
way to locate elements using ID Locator.

Name Locator:
We sometimes use Name locator to identify the
elements on our webpage. Locating elements
using Name is same as locating elements using
ID locator.

Class Name Locator:


Class Name locator gives the element which
matches the values specified in the attribute
name “class”.

Tag Name Locator:


Tag Name locator is used to find the elements
matching the specified Tag Name. It is very
helpful when we want to extract the content
within a Tag.

Link Text Locator:


If there are multiple elements with the same link
text then the first one will be selected. This Link
Text locator works only on links (hyperlinks).

Partial Link Text:


In some situations, we may need to find links by a
portion of the text in a Link Text element. it
contains. In such situations, we use Partial Link
Text to locate elements.

CSS Selector Locator:


Following are the some of the mainly used
formats of CSS Selectors.
Tag and ID
findElement(By.cssSelector(tag#id))
Tag and Class
findElement(By.cssSelector(tag.class))
Tag and Attribute
findElement(By.cssSelector(tag[attribute=value]))

XPath Locator:
XPath is designed to allow the navigation of XML
documents, with the purpose of selecting
individual elements, attributes, or some other
part of an XML document for specific processing.
Compare to Css, Xpath is slow.

Hyderabad HCL 26_H 1 Difference between Given and When in cucumber feature 1> Given steps are used to describe the initial
file context of the system.
When steps are used to describe an event, or an
action. This can be a person interacting with the
system, or it can be an event triggered by
another system.
Hyderabad HCL 26_H 2 What is the purpose of Background in feature file 2>Background in Cucumber is used to define a
step or series of steps that are common to all the
tests in the feature file. It allows you to add some
context to the scenarios for a feature where it is
defined.
For example: In a .feature file if all the scenarios
have same Given Step. Then instead of repeating
the same step for all the scenarios we can put
that step under Background.
Hyderabad HCL 26_H 3 Can i give login username and password in And will it work? 3> yes to login username and password we can
give AND.
example:
Scenario:
Given I am on Facebook login page
When I enter username as "TOM"
And I enter password as "JERRY"
Then Login should fail

Hyderabad HCL 26_H 4 Which reporting standard you use in framework


Hyderabad HCL 26_H 5 Logic to reverse a string 5> we can reverse a string in two ways using
charAt() function and using reverse() which is
available in StringBuffer.

String class does not have reverse() method, we


need to convert the input string to StringBuilder,
which is achieved by using the append method of
StringBuilder. After that, print out the characters
of the reversed string by scanning from the first
till the last index.

class ReverseString
{
public static void main(String[] args)
{
String input = "Automation";

StringBuilder input1 = new StringBuilder();

// append a string into StringBuilder input1


input1.append(input);

// reverse StringBuilder input1


input1 = input1.reverse();

// print reversed String


System.out.println(input1);
}
Hyderabad HCL 26_H 6 i have seven checkboxes in a page every time my script 6> first we need find all the seven checkbox in a
should check last but one checkbox page using findElements() with the common
locator.once we get the list of checkboxes in a
page, find the total no.of checkboxes using size()
method. Then with the help of get(index) method
we can find the last but one checkbox in a page.

List<WebElement> checkBoxes = driver.


findElements(by.id("checkbox"));
int totalChkBx = checkBoxes.size();
// it will always select the last but one checkbox
checkBoxes.get(totalChkBx-1).click();
Hyderabad HCL 26_H 7 What exception will program throw when i use 7> When we use findElements() method, it will not
findelements and it do not identify element in a web page throw any exception when element is not identify
in a webpage. it just return 0 list of elements in
the console.
Hyderabad HCL 26_H 8 Jenkins CI/CD 8> Jenkins is an open source tool which is used
for continuous delivery and continuous
integration service for software development.
By using Jenkins, we can execute test cases on
daily basis and for nightly execution based on
the schedule.
Hyderabad HCL 26_H 9 Explain BDD framework in your project 9> To implement BDD framework we used
Cucumber tool.
Cucumber is a testing tool that supports
Behavior Driven Development (BDD). It offers a
way to write tests that anybody can understand,
regardless of their technical knowledge.
The main advantage of this framework is it
increase and improves collaboration between
different users.
the main components of this framework are
first one is .feature file in which we write the
scenarios using gherkin keywords like GIVEN,
WHEN,THEN,AND,Feature,Scenario,
ScenarioOutline which is a plain text.
second one is StepDefinition class, in which for
each feature step we maintain corresponding
selenium java code.
next is the TestRunner Class through which we
run the single or multiple feature files.

Pune Synechrone 27_S 1 Selenium webdriver architecture 1> Selenium WebDriver is a Client Server
Architecture
-In real time, we will write code in Eclipse IDE by
using any one of the supported Selenium client
libraries like Java, C#, Python, Ruby, Perl.
-Once we execute the scripts in Eclipse, the
selenium client library will communicate with
selenium API.
-Selenium API will send the command taken from
language level binding to browser driver with the
help of JSON wired protocol.
-Selenium API sends the request to Browser
Driver, it may be Firefox driver, IE driver, Chrome
driver.
-The browser driver will use the HTTP server for
getting the HTTP request and the HTTP Server
filter out all the commands which need to be
executed.
-Then the commands in your selenium script will
be executed on the browser.
-Finally, HTTP server sends the response back to
the automation test script.
Pune Synechrone 27_S 2 Explain automation framework 2> Explain about
- which framework approach you used
-what type of project you created(Maven or
Gradle)
-which technology you use(like java)
-Different folder structure you used
-what you used for reporting
-what you used to fetch data from excel or other
data files
-how you create the logs
-which CI tools you used
-which Bug reporting tool you used
-what are different dependencies you added
Pune Synechrone 27_S 3 Why Testng is used if there is cucumber used in your 3> for Parallel execution
framework
Pune Synechrone 27_S 4 Java program to find word count from the given string 4> we can use split() function which is available in
String s= "my name is umesh"; String class

public static int countWordsUsingSplit(String


input) {
//to check given string is null or empty
if (input == null || input.isEmpty()) {
return 0;
}
// it split the words based on white space
String[] words = input.split("\\s+");
return words.length;
}

Pune Synechrone 27_S 5 Which catch block will get execute first. 5> it will execute first catch block with generic
There are two catch blocks in first catch block have exception.
exception e and second catch block have arithmetic If an exception occurs in try block then the
expections and will expect arithmetic exception in try control of execution is passed to the
block then which catch block will get execute first? corresponding catch block. A single try block can
have multiple catch blocks associated with it,
you should place the catch blocks in such a way
that the generic exception handler catch block is
at the last.
The generic exception handler can handle all the
exceptions but you should place is at the end, if
you place it at the before all the catch blocks
then it will display the generic message. You
always want to give the user a meaningful
message for each type of exception rather then
a generic message.
ex: Right way to use Generic exception in java
code
class Example1{
public static void main(String args[]){
try{
int a[]=new int[7];
a[4]=30/0;
System.out.println("First print statement in
try block");
}
catch(ArithmeticException e){
System.out.println("Warning:
ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Warning:
ArrayIndexOutOfBoundsException");
}
catch(Exception e){
System.out.println("Warning: Some Other
exception");
}
System.out.println("Out of try-catch block...");
}
}
Pune Synechrone 27_S 6 6. String s1= "hello"; String s2="hello";
If(s1==s2) then tell me if it's true or false.
Pune Synechrone 27_S 7 String s ="hello"; s.concate("world"); 7> output : hello
What is the output? we know that In java, string objects are
immutable. Immutable simply means
unmodifiable or unchangeable.
Once string object is created its data or state
can't be changed but a new string object is
created.

Hyderabad Tessla 28_T 1 What do you mean by Enumeration in implicit wait? 1> Enumeration or Enum in Java is a data type
which contains a fixed set of constants.The Java
enum constants are static and final implicitly.
In implicit wait, TimeUnit is an Enum which
belongs to the package java.util.concurrent and
enumeration constants used in implicit wait are:
TimeUnit.DAYS
Time unit representing twenty four hours
TimeUnit.HOURS
Time unit representing sixty minutes
TimeUnit.MICROSECONDS
Time unit representing one thousandth of a
millisecond
TimeUnit.MILLISECONDS
Time unit representing one thousandth of a
second
TimeUnit.MINUTES
Time unit representing sixty seconds
TimeUnit.NANOSECONDS
Time unit representing one thousandth of a
microsecond
TimeUnit.SECONDS
Time unit representing one second

Hyderabad Tessla 28_T 2 Give example for Run time polymorphism? 2> Run Time Polymorphism / Dynamic
Polymorphism is also known as Method
Overriding.
Method overriding is a process where a method
in the child class has the same name and the
same parameters as that of the method in its
base class.
Hyderabad Tessla 28_T 3 Fluent wait? 3> Fluent wait is one of the wait available in
selenium webdriver and it same as explicit wait
but the only difference is it checks whether the
condition is satisfied and continues as per the
frequency.
// Waiting 30 seconds for an element to be
present on the page, checking
// for its presence once every 5 seconds.
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);

Hyderabad Tessla 28_T 4 Testng? 4> TestNG is an open-source test automation


framework for Java.
Advantages of Testng are:
It provides parallel execution of test methods.
It allows the dependency of one test method on
another test method.
It helps in prioritizing our test methods.
It allows grouping of test methods into test
groups.
It supports the parameterization of test cases
using @Parameters annotation.
It helps in Data-driven testing using
@DataProvider annotation.
It has different types of assertions that help in
validating the expected results with the actual
results.
It has different types of HTML reports, Extent
reports, etc. for a better and clear understanding
of our test summary.
It has listeners who help in creating logs.

Bangalore Blume Global 29_B 1 Explain Bug life cycle 1> Bug life cycle:

During the execution of testcases, if tester find


any defect, he will log that defect in the defect
tracking tool.

So, when the tester first time log the defect in


tool, then the initial status of the defect is new
and it will assign to test lead.

Then test lead will review the defect then he will


change the status to open and he will assign to
developer.

Then developer review the defect and if it is a


valid defect, he will fix it and change the status to
fixed and will assign back to the tester.

So, then tester will retest the defect and if it is


working as expected then he will close the
defect.

If a defect is partially fixed, then he will change


the status to reopen.

In other situations, like the defect which is


assigned to developer is not a valid defect then
he will change the status to rejected.

Or in some other situation, like if the defect is


valid and not of high priority and if they want to
fix it in future release then they will change the
status to differed.

And in few conditions if the same defect logged


again and again, the defect status will be
duplicate.
Bangalore Blume Global 29_B 2 Write test cases in given scenario 2> As per given scenarios , identify the test
cases which have high possibility to identify
defects by providing all probable negative and
positive conditions with more details.
Bangalore Blume Global 29_B 3 What is compatibility testing Testing the application in multiple browsers and
operating systems and check whether the
application is working as expected in all the
environments or not is known as compatibility
testing
Bangalore Blume Global 29_B 4 Difference between water fall model and agile 4> Waterfall is a Liner Sequential Life Cycle
methodology Model whereas Agile is a continuous iteration of
development and testing in the software
development process.
Agile methodology is known for its flexibility
whereas Waterfall is a structured software
development methodology.
Agile follows an incremental approach whereas
the Waterfall methodology is a sequential design
process.
Agile performs testing concurrently with software
development whereas in Waterfall methodology
testing comes after the “Build” phase.
Agile allows changes in project development
requirement whereas Waterfall has no scope of
changing the requirements once the project
development starts.
Bangalore Blume Global 29_B 5 Explain your project 5> explain about which project you worked on
explain about tools that you have used in the
project
explain about your roles like exactly what you
did in the project.
Bangalore Blume Global 29_B 6 write the xpath for given scenario
Bangalore Blume Global 29_B 7 Sql query to find out total salary for all employee 7> SELECT SUM(salary) AS Total Salary FROM
department wise employees WHERE department='HR';

Hyderabad Inspire infosol 30_I 1 How can you handle if application is opening in seperate
tab in same browser
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan

Bangalore FIS global 31_F 1 Explain about project and work experience. 1> given the ans above
Bangalore FIS global 31_F 2 Explain about the usage of Jira ? How add testcases and 2> we can use Jira for both test Management and
defects? defect tracking.
In Jira, we will be create test cases as issues,
first we need to add a new issue type to your Jira
account.
where we give the below details
issue type, summary, description, reporter,
steps to complete, expected outcome

To create a defect in jira we need to create an


issue of the type “Bug”.
where we give below details
Defect ID, Defect title, Defect description (steps
to reproduce), Environment information,
Screenshot(attachment), Severity, Assign it to
someone,
Status- All the statuses in the bug life cycle

Bangalore FIS global 31_F 3 Worked on any other defect tracking tool? Do you know 1> given the ans above
about Hp ALM?If explain
Bangalore FIS global 31_F 4 Explain about the framework used in your project 4> given the ans above
Bangalore FIS global 31_F 5 How do read data in data drivern framework? Write a we use Apache POI api's to read the data in data
program to read data from Excel sheet driven framework if the data is stored in excels
if the data is stored in databases then we use
JDBC driver api's.
code to read data from excel:
String FilePath = "d://filepath.xls";
FileInputStream fs = new FileInputStream
(FilePath);
Workbook wb = Workbook.getWorkbook(fs);
Or You can also directly send the file as below

Workbook wb = Workbook.getWorkbook(new File


("samplefile.xls"));
Now to get the access to the particular sheet, we
should use the below command:

Sheet sh = wb.getSheet(0); // this is to get the


access to Sheet1.
If you want to get the access to sheet2, you
should specify as below:

Sheet sh = wb.getSheet(1);
You can also get the sheet access by sheet
name, you should specify as below:

Sheet sh = wb.getSheet("sheet1");
Now we will get the content in particular location,
which will return contents as a string

String CellGetContent = sh.getCell(0,0).


getContents();
System.out.println(CellGetContent);
We can also write it as :

System.out.println(sh.getCell(0,0).getContents());
There is an other style to get the cell contents as
below:

Cell Row0Col0 = sheet.getCell(0,0);


Cell Row1Col1 = sheet.getCell(1,1);
String FirstRowFirstColumn = Row0Col0.
getContents();
String SecondRowSecondColumn = Row1Col1.
getcontents();
Bangalore FIS global 31_F 6 Write a program to check if a number is palindrome 6>
class PalindromeExample{
public static void main(String args[]){
int r,sum=0,temp;
int n=454;//It is the number variable to be
checked for palindrome

temp=n;
while(n>0){
r=n%10; //getting remainder
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
System.out.println("palindrome number ");
else
System.out.println("not palindrome");
}
}
Bangalore FIS global 31_F 7 Explain how to get the 5 th child window. To switch between windows

public void switchToNewWindow(int


windowNumber) {
Set < String > s = driver.getWindowHandles();
Iterator < String > ite = s.iterator();
int i = 1;
while (ite.hasNext() && i < 10) {
String popupHandle = ite.next().toString();
driver.switchTo().window(popupHandle);
System.out.println("Window title is : "+driver.
getTitle());
if (i == windowCount) break;
i++;
}
}
When you call this method just pass the number
of windows you want to switch. Say for 5th
window: switchToNewWindow(5);
Bangalore FIS global 31_F 8 What is polymorphism? 8> Polymorphism means "many forms", and it
occurs when we have many classes that are
related to each other by inheritance.
polymorphism is mainly divided into two types:
Compile time Polymorphism- it is also known as
static polymorphism/method overloading.
Runtime Polymorphism-- it is also know as
dynamic polymorphism/method overriding.

Bangalore FIS global 31_F 9 Difference between API and webservices 9> APIs and Web Services both serve as
platforms for interactions between systems or
applications
a) Web services are a type of API, which must be
accessed through a network connection.
APIs are application interfaces, implying that one
application can communicate with another
application in a standardized manner.
b) Web service is used for REST, SOAP and XML-
RPC for communication.
API is used for any style of communication.
c)All Web services are APIs.
APIs are not web services.
d)Web services doesn’t have lightweight design,
needs a SOAP convention to send or receive data
over the system.
API has a light-weight architecture furthermore,
useful for gadgets which have constrained
transmission capacity like smart phones.
e) WebService provides supports only for the
HTTP protocol.
API provides support for the HTTP/s protocol: URL
Request/Response Headers, and so on.
d)Web service supports only XML.
API supports XML and JSON.

Bangalore FIS global 31_F 10 How did you write testcase using soap UI for API testing 12> @BeforeSuite
@BeforeGroups
@BeforeTest
@BeforeClass
@BeforeMethod
@Test
@AfterMethod
@AfterClass
@AfterTest
@AfterGroups
@AfterSuite
Bangalore FIS global 31_F 11 Do you know about testing framework ? Write an XML to run 11> List of API Methods are
scripts?list of API methods GET
POST
PUT
HEAD
DELETE
PATCH
OPTIONS
Testng xml to run all scripts:

<suite name="Suite1" verbose="1" >


<test name="Regression1" >
<packages>
<package name="test.sample" />
</packages>
</test>
</suite>
Bangalore FIS global 31_F 12 Different annotations in testing in order

SFO, USA Roberthalf 32_R 32 How do you automate localization testing -diff languages
in UI What are the tools used and how did you do

TX, USA personal Intrest and interview 33_P 33 I am getting the below error in eclipse and could not able
preparation to run any class.
Error: Could not find or load main class learning_Java.
Callbyvalueandcallbyref
Caused by: java.lang.ClassNotFoundException:
learning_Java.Callbyvalueandcallbyref
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana
SFO, USA Roberthalf 32_R 32 How do you automate localization testing -diff languages
in UI What are the tools used and how did you do

TX, USA personal Intrest and interview 33_P 33 I am getting the below error in eclipse and could not able
preparation to run any class.
Error: Could not find or load main class learning_Java.
Callbyvalueandcallbyref
Caused by: java.lang.ClassNotFoundException:
learning_Java.Callbyvalueandcallbyref

You might also like