[go: up one dir, main page]

0% found this document useful (0 votes)
289 views96 pages

Interview Questions Selenium & Appium: Fresher Academy

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 96

Interview Questions

Fresher Academy
Selenium & Appium

1
Selenium Interview Questions
What is Automation Testing?

Automation testing is a Software testing technique to test and compare the


actual outcome with the expected outcome. This can be achieved by writing
test scripts or using any automation testing tool. Test automation is used to
automate repetitive tasks and other testing tasks which are difficult to
perform manually. 

Automation testing is the process of testing the software using an


automation tool to find the defects. In this process, executing the test
scripts and generating the results are performed automatically by
automation tools. Some most popular tools to do automation testing are HP
2
QTP/UFT, Selenium WebDriver, etc.
Selenium Interview Questions
What are the challenges and limitations of Selenium WebDriver?

Selenium is a free open source testing tool. Some of the challenges with
selenium webdriver are as:
1. We cannot test windows application
2. We cannot test mobile apps
3. Limited reporting
4. Handling dynamic Elements
5. Handling page load
6. Handling captcha

3
Selenium Interview Questions
What type of tests have you automated

Our main focus is to automate test cases to do Regression testing, Smoke


testing, and Sanity testing. Sometimes based on the project and the test
time estimation, we do focus on End to End testing.

4
Selenium Interview Questions
Why do you prefer Selenium Automation Tool?

1. Free and open source


2. Have large user base and helping communities
3. Cross-browser compatibility
4. Platform compatibility
5. Multiple programming languages support

5
Selenium Interview Questions
What is Selenium?

Selenium là một bộ kiểm thử tự động (mã nguồn mở) miễn phí cho các ứng dụng web
trên các trình duyệt và nền tảng khác nhau. Selenium chỉ tập trung vào việc tự động hóa
các ứng dụng dựa trên web.

Selenium IDE (Browser Addon - Record and Playback của trình duyệt)
Selenium WebDriver
Selenium Grid (Kiểm thử phân tán)

Selenium hỗ trợ kịch bản bằng các ngôn ngữ như Java, C #, Python, Ruby, PHP, Perl,
Javascript.

6
Selenium Interview Questions
What is Selenium IDE?

Selenium IDE (Integrated Development Environment) is a Firefox plugin. It is


the simplest framework in the Selenium Suite. It allows us to record and
playback the scripts. Even though we can create scripts using Selenium IDE,
we need to use Selenium RC or Selenium WebDriver to write more
advanced and robust test cases.

7
Selenium Interview Questions
Which is the only browser that supports Selenium IDE to be used?

Firefox and Chrome

8
Selenium Interview Questions
What is Selenium Grid?

Selenium Grid is a tool used together with Selenium RC to run tests


on different machines against different browsers in parallel. That is, running
multiple tests at the same time against different machines running different
browsers and operating systems.

9
Selenium Interview Questions
When do you use Selenium Grid?

Selenium Grid can be used to execute same or different test scripts on


multiple platforms and browsers concurrently so as to achieve distributed
test execution

10
Selenium Interview Questions
What are the advantages of Selenium Grid?

It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform

11
Selenium Interview Questions
What are the types of WebDriver APIs available in Selenium?

• Firefox Driver
• Gecko Driver
• InternetExplorer Driver
• Chrome Driver
• HTML Driver
• Opera Driver
• Safari Driver
• Android Driver
• iPhone Driver
• EventFiringWebDriver
12
Selenium Interview Questions
What are the Programming Languages supported by Selenium
WebDiver?

• Java
• C#
• Python
• Ruby
• Perl
• PHP

13
Selenium Interview Questions
What are the Locators available in Selenium?

Different types of locators are:


1. ID
2. ClassName
3. Name
4. TagName
5. LinkText
6. PartialLinkText
7. XPath
8. CSS Selector
14
Selenium Interview Questions
What is an XPath?

XPath is used to locate the elements. Using XPath, we could navigate


through elements and attributes in an XML document to locate web
elements such as textbox, button, checkbox, Image etc., in a web page.

15
Selenium Interview Questions
What is the difference between “/” and “//”

Single Slash “/” – Single slash is used to create XPath with absolute path
i.e. the XPath would be created to start selection from the document
node/start node.

Double Slash “//” – Double slash is used to create XPath with relative path
i.e. the XPath would be created to start selection from anywhere within the
document.

16
Selenium Interview Questions
What is the difference between Absolute Path and Relative Path?
Absolute XPath starts from the root node and ends with desired descendant
element’s node. It starts with a single forward slash(/).
/html/body/div[3]/div[1]/form/table/tbody/tr[1]/td/input

Relative XPath starts from any node in between the HTML page to the
current element’s node(last node of the element). It starts with a double
forward slash(//).
//input[@id='email']

17
Selenium Interview Questions
How to launch a browser using Selenium WebDriver?
WebDriver is an Interface. We create an Object of a required driver class
such as FirefoxDriver, ChromeDriver, InternetExplorerDriver etc.,

WebDriver driver = new FirefoxDriver();


WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

18
Selenium Interview Questions
What are the types of waits available in Selenium WebDriver?

In Selenium we could see three types of waits such as Implicit Waits, Explicit
Waits and Fluent Waits.
• Implicit Waits
• Explicit Waits
• Fluent Waits

19
Selenium Interview Questions
What is Implicit Wait In Selenium WebDriver?

Implicit waits tell to the WebDriver to wait for a certain amount of time
before it throws an exception.
WebDriver will wait for the element based on the time we set. The default
setting is 0 (zero) and we need to setup the required time

20
Selenium Interview Questions
What is WebDriver Wait In Selenium WebDriver?

WebDriverWait is applied on a certain element with defined expected


condition and time. This wait is only applied to the specified element. This
wait can also throw an exception when an element is not found.

21
Selenium Interview Questions
What is Fluent Wait In Selenium WebDriver?

FluentWait can define the maximum amount of time to wait for a specific
condition and frequency with which to check the condition before throwing
an “ElementNotVisibleException” exception.

22
Selenium Interview Questions
How to get a text of a web element?

By using getText() method

23
Selenium Interview Questions
What is the difference between driver.get() anddriver.navigate.to(“url”)?

driver.get(): To open an URL and it will wait till the whole page gets loaded

driver.navigate.get(): To navigate to an URL and It will not wait till the


whole page gets loaded

24
Selenium Interview Questions
Can I navigate back and forth in a browser in Selenium WebDriver?

We use Navigate interface to do navigate back and forth in a browser. It has


methods to move back, forward as well as to refresh a page.
driver.navigate().forward(); – to navigate to the next web page with
reference to the browser’s history
driver.navigate().back(); – takes back to the previous webpage with
reference to the browser’s history
driver.navigate().refresh(); – to refresh the current web page thereby
reloading all the web elements
driver.navigate().to(“url”); – to launch a new web browser window and
navigate to the specified URL 25
Selenium Interview Questions
How to fetch the current page URL in Selenium?

To fetch the current page URL, we use getCurrentURL()


driver.getCurrentUrl();

26
Selenium Interview Questions
How can we maximize browser window in Selenium?

To maximize browser window in selenium we use maximize() method. This


method maximizes the current window if it is not already
driver.manage().window().maximize();

27
Selenium Interview Questions
How to delete cookies in Selenium?

To delete cookies we use deleteAllCookies() method


driver.manage().deleteAllCookies();

28
Selenium Interview Questions
What is the difference between driver.getWindowHandle() and
driver.getWindowHandles() in Selenium WebDriver?

driver.getWindowHandle() –returns the window handle of currently


focused window. Its return type is String.

driver.getWindowHandles() – It returns a set of handles of the all the pages


Available by same driver instance. Its return type is Set<String>

29
Selenium Interview Questions
What is the difference between driver.close() and driver.quit()
methods?

driver.close(): To close current WebDriver instance

driver.quit(): To close all the opened WebDriver instances

30
Selenium Interview Questions
What is the difference between driver.findElement() and
driver.findElements() commands?

findElement() returns a single WebElement (found first) based on the


locator passed as parameter. Whereas findElements() returns a list of
WebElements, all satisfying the locator value passed.

Another difference between the two is- if no element is found then


findElement() throws NoSuchElementException whereas findElements()
returns a list of 0 elements.

31
Selenium Interview Questions
How can we handle web based pop-up?

To handle alerts popups we need to do switch to the alert window and call
Selenium WebDriver Alert API methods

32
Selenium Interview Questions
How to handle hidden elements in Selenium WebDriver?

We can handle hidden elements by using javaScript executor


(JavascriptExecutor(driver)).executeScript("document.getElementsByClassN
ame(ElementLocator).click();");

33
Selenium Interview Questions
List some scenarios which we cannot automate using Selenium
WebDriver?

1. Bitmap comparison Is not possible using Selenium WebDriver


2. Automating Captcha is not possible using Selenium WebDriver
3. We can not read bar code using Selenium WebDriver

34
Selenium Interview Questions
What is Object Repository in Selenium WebDriver?

Object Repository is used to store element locator values in a centralized


location instead of hard coding them within the scripts.
We do create a property file (.properties) to store all the element locators
and these property files act as an object repository in Selenium WebDriver.

35
Selenium Interview Questions
How to switch between frames in Selenium?

By using the following code, we could switch between frames.


driver.switchTo().frame();

36
Selenium Interview Questions
How To Perform Double Click Action In Selenium WebDriver?

We use Actions class to do Double click action in selenium.

37
Selenium Interview Questions
What is TestNG?

TestNG is a testing framework designed to simplify a broad range of testing


needs, from unit testing to integration testing.

38
Selenium Interview Questions
What are the annotations available in TestNG?
@BeforeTest
@AfterTest
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod
@BeforeSuite
@AfterSuite
@BeforeGroups
@AfterGroups
@Test 39
Selenium Interview Questions
What is TestNG Assert and list out some common Assertions
supported by TestNG?

• assertEqual(String actual,String expected)


• assertEqual(String actual,String expected, String message)
• assertEquals(boolean actual,boolean expected)
• assertTrue(condition)
• assertTrue(condition, message)
• assertFalse(condition)
• assertFalse(condition, message)

40
Selenium Interview Questions
Explain how you can find broken images in a page using Selenium Web
driver ?

To find the broken images in a page using Selenium web driver is


Get XPath and get all the links in the page using tag name
In the page click on each and every link
Look for 404/500 in the target page title

41
Selenium Interview Questions
Explain how you can handle colors in web driver?

To handle colors in web driver you can use


Use getCssValue(arg0) function to get the colors by sending ‘color’ string as
an argument

42
Selenium Interview Questions
Using web driver how you can store a value which is text box?

driver.findElement(By.id(“your Textbox”)).sendKeys(“your keyword”);

43
Selenium Interview Questions
Explain how you can switch between frames?

To switch between frames webdrivers [ driver.switchTo().frame() ] method


takes one of the three possible arguments
1. A number:  It selects the number by its (zero-based) index
2. A name or ID: Select a frame by its name or ID
3. Previously found WebElement: Using its previously located WebElement
select a frame

44
Selenium Interview Questions
Mention 5 different exceptions you had in Selenium web driver?

WebDriverException
NoAlertPresentException
NoSuchWindowException
NoSuchElementException
TimeoutException

45
Selenium Interview Questions
Explain using Webdriver how you can perform double click ?

Syntax- Actions act = new Actions (driver);


act.doubleClick(webelement);

46
Selenium Interview Questions
What is the difference between getWindowhandles() and
getwindowhandle() ?

getWindowHandle() returns the window handle of currently focused page.


Its return type is String

getWindowHandles() returns all page handles opened by same driver


instance. Its return type is Set<String>

47
Selenium Interview Questions
Explain how you can switch back from a frame?

Syntax-driver.switchTo().defaultContent();

48
Selenium Interview Questions
 How to select value in a dropdown?
selectByValue:
selectByValue.selectByValue(“greenvalue”);

selectByVisibleText:
selectByVisibleText.selectByVisibleText(“Lime”);

selectByIndex:
selectByIndex.selectByIndex(2);

49
Selenium Interview Questions
What are the different types of navigation commands?

navigate().back()
navigate().forward()
navigate().refresh()
navigate().to()

50
Selenium Interview Questions
How to click on a hyper link using linkText?

driver.findElement(By.linkText(“Google”)).click();

driver.findElement(By.partialLinkText(“Goo”)).click();

51
Selenium Interview Questions
How can we handle web-based pop-up?

1. void dismiss() – The dismiss() method clicks on the “Cancel” button as


soon as the pop-up window appears.
2. void accept() – The accept() method clicks on the “Ok” button as soon as
the pop-up window appears.
3. String getText() – The getText() method returns the text displayed on the
alert box.
4. void sendKeys(String stringToSend) – The sendKeys() method enters the
specified string pattern into the alert box.

52
Selenium Interview Questions
How to assert the title of the web page?

assertTrue(driver.getTitle().equals(“Title of the page”));

Or

assertEquals(expectedTitle, driver.getTitle());

53
Selenium Interview Questions
How to mouse hover on a web element using WebDriver?

54
Selenium Interview Questions
How to set test case priority in TestNG?

55
Selenium Interview Questions
What are the advantages of the Automation framework?

Reusability of code
More Test Coverage in less time
Reliability
Parallel execution of test cases
Fast
Minimal manual intervention
Easy Reporting

56
Selenium Interview Questions
How can I read test data from excels?

Test data can efficiently be read from excel using ApachePOI libraries API. It
support both xls and xlsx files.

57
Selenium Interview Questions
Can captcha be automated?

No, captcha and barcode reader cannot be automated.

58
Appium Interview Questions

59
Appium Interview Questions
 What is Appium?

• Appium is an open-source tool for automating Native, Mobile Web, and


Hybrid applications on iOS and Android platforms. 
• Appium is “cross-platform”: it allows us to write tests for multiple
platforms (iOS, Android), using the same API. This enables code reuse
between iOS and Android test suites.
• Appium was launched in 2012.

60
Appium Interview Questions
What are Native Apps?

Native apps are those written using the iOS or Android SDKs.

61
Appium Interview Questions
What are Mobile Web Apps?

Mobile web apps are web apps accessed using a mobile browser.

62
Appium Interview Questions
What are Hybrid Apps?

Hybrid apps - combine both web applications created for web browser and
native applications that are designed for a particular platform. They have a
wrapper around a “webview” — a native control that enables interaction
with web content.

63
Appium Interview Questions
What are the pre-requisite to use APPIUM?
re-requisite to use APPIUM is
• ANDROID SDK
• Eclipse IDE
• JDK
• Selenium Server JAR
• Webdriver Language Binding Library
• TestNG
• APPIUM for Windows
• APK App Info On Google Play

64
Appium Interview Questions
How Would You Retrieve A DOM Element Or The XPath In A Mobile App?
You have the <UIAutomateviewer>  or <Appium Inspector> tool to locate
any element for Android app.

65
Appium Interview Questions
What Are The Probable Errors You Might See While Working With Appium?
Answer.

Error#1: Missing desired capabilities e.g. Device Name, PlatformName.


Error#2: Couldn’t locate ADB. You may have missed setting
the <ANDROID_HOME> environment variable.
Error#3: Selenium
exception <openqa.selenium.SessionNotCreatedException>. It indicates a
failure in creating a new session.
Error#4: Failure in locating a DOM element or determining the XPath.

66
Appium Interview Questions
What Language Does Appium Support?

Appium support any language that support HTTP request like Java,
JavaScript with Node.js, Python, Ruby, PHP, Perl, etc.

67
Appium Interview Questions
What Language Does Appium Support?

Appium support any language that support HTTP request like Java,
JavaScript with Node.js, Python, Ruby, PHP, Perl, etc.

68
Performance Test Interview Questions

69
Performance Test Interview Questions
What is Performance Testing?

Performance Testing is a type of software testing which ensures that the


application is performing well under the workload. The goal of performance
testing is not to find bugs but to eliminate performance bottlenecks.

70
Performance Test Interview Questions
What are the different types of Performance Testing?
Load testing – It checks the application’s ability to perform under anticipated user loads. The objective is
to identify performance bottlenecks before the software application goes live.

Stress testing – This involves testing an application under extreme workloads to see how it handles high
traffic or data processing. The objective is to identify the breaking point of an application.

Endurance testing – It is done to make sure the software can handle the expected load over a long period
of time.

Spike testing – This tests the software’s reaction to sudden large spikes in the load generated by users.
Volume testing – Under Volume Testing large no. of. Data is populated in a database and the overall
software system’s behavior is monitored.

Scalability testing – The objective of scalability testing is to determine the software application’s
effectiveness in scaling up to support an increase in user load.
71
Performance Test Interview Questions
What is throughput in Performance Testing?

Throughput – indicates the number of transactions per


second an application can handle, the amount of transactions produced
over time during a test.

Performance of application depends on throughput value, higher the value


of throughput - higher the performance of the application.

72
Performance Test Interview Questions
What is concurrent user load in Performance Testing?

Concurrent user load in performance testing can be defined as something


when many users hit any functionality or operation at the same time.
Concurrent user load testing sends simultaneous artificial traffic to a web
application in order to stress the infrastructure and record system response
times during periods of sustained heavy load.

73
Performance Test Interview Questions
What is a Protocol? Name some Protocols.

A protocol is a defined as a set of various rules for the purpose of


information communication between the two or more systems.

HTTP
HTTPS
FTP
Web Services
Citrix
74
Performance Test Interview Questions
What are the types of Performance Tuning?

Hardware Tuning – Enhancing, adding or supplanting the hardware


components of the system under test and changes in the framework level
to augment the system’s performance is called hardware tuning.
Software Tuning – Identifying the software level bottlenecks by profiling the
code, database etc. Fine tuning or modifying the software to fix the
bottlenecks is called software tuning.

75
Performance Test Interview Questions
Explain what is JMeter?

JMeter is a Java tool, which is used for performance Load Testing.

76
Performance Test Interview Questions
Explain how JMeter works?

JMeter acts like a group of users sending requests to a target server. It


collects response from the target server and other statistics which show the
performance of the application or server via graphs or tables.

77
Performance Test Interview Questions
Explain what is Samplers and Thread groups?
Thread group: For any test plan, JMeter is the beginning part of thread
group elements. It is an important element of JMeter, where you can set a
number of users and time to load all the users given in the thread group

Samplers: Sampler generates one or more sample results; these sample


results have many attributes like elapsed time, data size, etc. Samplers allow
JMeter to send specific types of requests to the server, through samplers,
thread group decides which type of request it needs to make. Some of the
useful samplers are HTTP request, FTP request, JDBC request and so on.
78
Performance Test Interview Questions
Mention what are the types of a processor in JMeter?

Pre-processor

Post processor

79
Performance Test Interview Questions
Explain what are Pre-processor Elements? List some of the pre-processor
elements?
PreProcessors are JMeter elements that are used to execute actions before the sampler
requests are executed in the test scenario.For example, fetching data from a database,
setting a timeout between sampler execution or before test data generation.
To configure the sample request prior to its execution or to update variables that are not
extracted from response text pre-processor elements are used.

Some of the pre-processor elements are


JDBC Pre-processor
HTTP user parameter modifier
HTML link parser
BeanShell PreProcessor
80
Performance Test Interview Questions
Mention the execution order of Test Elements?

Configuration elements
Pre-processors
Timers
Samplers
Post-processors
Assertions
Listeners

81
Performance Test Interview Questions
Explain what is Assertion in JMeter? What are the types of assertion?

Assertion helps to verify that your server under test returns the expected
results
Some commonly used Assertion in JMeter are

Response Assertion
Duration Assertion
Size Assertion
XML Assertion
HTML Assertion

82
Performance Test Interview Questions
List out few JMeter Listeners?

Spline Visualizer
Aggregate Report
View Result Tree
View Result in Table
Monitor Results
Distribution Graph
BeanShell Listener
Summary Report and so on

83
Performance Test Interview Questions
In JMeter is it necessary to call embedded resources explicitly?

You can eliminate all embedded resources from being explicitly called.
Requests have a checkbox at the bottom that says “retrieve embedded
resources.” It would grab all CSS, JPG, etc. It is a brilliant way to find
resources and broken link in a web App.

84
Performance Test Interview Questions
Explain what is the role of Timer in JMeter?

With the help of a timer, JMeter can delay the time between each request,
which a thread makes. It can solve the overload problem of the server.

85
Performance Test Interview Questions
Explain what is Post-processor?

To perform any action after making a request, Post-processor is used. For


example, if JMeter sends an HTTP request to the web server, and if you
want JMeter to stop sending the request if the web server shows an error,
then you will use post-processor to perform this action.

86
Postman Interview Questions

87
Postman Interview Questions
What is Postman?

Postman is a rest client software which basically used for API testing with
different types of request method types like post, put etc and parameters,
headers and cookies.
Apart from setting the query parameters and checking the response,
postman also let us see different response stats like time, status, headers,
cookies...

88
Postman Interview Questions
What is a collection in Postman?

Postman Collections are a group of saved requests that can organize into
folders like folders in computer systems.
A collection is the grouping of requests, preferably of the similar types.

89
Postman Interview Questions
State any 5 types of Request Method types.

Get
Post
Put: update/replace all entire resource in the collection
Delete
Patch: modify the collection itself

90
Postman Interview Questions
Please define status code 401.
The HTTP 401 error status response code is referred for an unauthorized request . It
indicates that the request has not been applied because it lacks valid authentication
credentials for the target resource

91
Postman Interview Questions
What are different types by which we can see response body in Postman.

In Postman, a response body can be seen by three different types

Pretty: The pretty mode formats JSON or XML responses so they are easier
to view
Raw: The raw view is a large text area with the response body. It can
indicate whether your response is minified.
Preview: The preview tab renders the response in a sandboxed iframe.
Some web frameworks by default return HTML errors and the preview
mode is especially helpful. JavaScript and images are disabled in the iframe

92
Postman Interview Questions
What is Pre-Request Script in Postman?

A pre request script is a script that runs before the execution of a request. 

93
Postman Interview Questions
What are the two types of scripts in Postman?
There are two different types of scripts in POSTMAN. 
One is the pre-scripts and the other is the test scripts.

Pre-scripts get executed before the request is made to the server.

On the other hand, the test script gets executed after the request is sent to the server
and the response is received

94
Postman Interview Questions
What is Page Object Model?
Page Object Model, also known as POM, is a design pattern in Selenium which is
commonly used in Selenium for Automating the Test Cases. This design pattern can be
used with any kind of framework like keyword-driven, Data-driven, hybrid framework,
etc.
In Page Object Model, consider each web page of an application as a class file.
The Page object is an object-oriented class which acts as an interface for the page of
your Application under test. Page class contains web elements and methods to interact
with web elements

95
Fresher Academy Happy Coding!

96

You might also like