YouTube Link: https://youtu.be/4FCh1swt_hE
** Selenium Training: https://www.edureka.co/selenium-certification-training **
This Edureka PPT on "Selenium Interview Questions and Answers" will help both Freshers And Experienced professionals to prepare for Selenium interviews. Learn about the most important Selenium interview questions and answers and know what will set you apart in the Selenium interview process.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
7. www.edureka.co/testing-with-selenium-webdriver
Question 2
What is Selenium? What are its
different components?
Selenium
Interview Questions
Selenium
Selenium IDE
Selenium RC
Selenium WebDriver
Selenium Grid
• Directly communicates with browser
• Has more advantages over RC
8. www.edureka.co/testing-with-selenium-webdriver
Question 2
What is Selenium? What are its
different components?
Selenium
Interview Questions
Selenium
Selenium IDE
Selenium RC
Selenium WebDriver
Selenium Grid
• Used to distribute test execution
• Supports cross-browsing
10. www.edureka.co/testing-with-selenium-webdriver
Question 3
What is a Selenium framework?
Selenium
Interview Questions
It is a code structure for making code maintenance simpler, and code
readability better.
This framework involves breaking the entire code into smaller pieces
of code, which test a particular functionality.
It can also be structured in a way wherein, the test cases which need
to be executed are called (invoked) from an external application
12. www.edureka.co/testing-with-selenium-webdriver
Question 4
What are the different types of
frameworks in Selenium?
Selenium
Interview Questions
The technique of
separating the
“data set” from
the actual “test
case” (code).
Data Driven
The technique
wherein we can
make the best use
of both Data
Driven & Keyword
Driven framework
Hybrid
The technique in
which all the
operations to be
performed are written
separately from the
actual test case
Keyword driver
14. www.edureka.co/testing-with-selenium-webdriver
Question 5
What are the challenges and
limitations of Selenium
WebDriver?
Selenium
Interview Questions
Limitations
✓ Cannot test mobile applications
✓ Handling the pop-ups
✓ Dynamic content
✓ Limited reporting
Challenges
✓ Cannot perform tests on web services like SOAP or REST
using Selenium.
✓ It is difficult to test Image based application.
✓ Selenium need outside support for report generation
activity like dependence on TestNG or Jenkins.
16. www.edureka.co/testing-with-selenium-webdriver
What are the drawbacks of
Selenium RC?
Question 6
Selenium
Interview Questions
APIs are the less
object oriented
Server connection is
required before executing
the test script.
Selenium RC's architecture
is more complicated
Selenium RC is slower since it
uses a JavaScript program
22. www.edureka.co/testing-with-selenium-webdriver
Question 9
List out the different test types
that are supported by Selenium
Selenium
Interview Questions
For web-based application testing, Selenium can be used
Functional Testing Regression Testing
Selenium could be used with Jenkins ,Hudson, QuickBuild
26. www.edureka.co/testing-with-selenium-webdriver
Question 11
What is Selenese?
Different types of Selenese
commands used
Selenium
Interview Questions
Selenese is the set of selenium commands which are used to
test your web application
01
02
03
Actions
Used for performing
operations
Assertions
Used as
checkpoints
Accessors
Used for storing a
value in a particular
variable
28. www.edureka.co/testing-with-selenium-webdriver
Question 12
How to build the object repository?
Selenium
Interview Questions
An object repository is a common storage location for all objects. In
Selenium WebDriver context, objects would typically be the locators used
to uniquely identify web elements.
30. www.edureka.co/testing-with-selenium-webdriver
Question 13
Explain about the WAIT
statements
Selenium
Interview Questions Exception appears when there is a delay in loading time of the elements which we are
interacting. To overcome this issue we need to use Wait Commands.
IMPLICIT WAIT 01
EXPLICIT WAIT 02
31. www.edureka.co/testing-with-selenium-webdriver
Question 13
Explain about the WAIT
statements
Selenium
Interview Questions
The implicit wait tells to the WebDriver to wait for certain amount of time
before it throws an exception
Implicit Wait
Explicit waits are confined to a particular web element. Explicit Wait is code
you define to wait for a certain condition to occur before proceeding further
in the code.
Explicit Wait
driver.manage().timeouts().implicitlyWait(TimeOut,TimeUnit.SECONDS);
WebDriverWait wait = newWebDriverWait(WebDriverRefrence,TimeOut);
➢ WebDriver Wait
➢ Fluent Wait
39. www.edureka.co/testing-with-selenium-webdriver
Question 17
How to use FindElement and
FindElements in Selenium?
Selenium
Interview Questions FindElement command is used to uniquely identify a (one) web element within the
web page
Find Elements command is used to uniquely identify the list of web elements within
the web page
driver.findElement(By.id("pt1:_UIShome::icon"));
WebDriver <List>= driver.findElements(By.id(“ID"));
41. www.edureka.co/testing-with-selenium-webdriver
Question 18
How to select the size the browser
window?
Selenium
Interview Questions
Maximize, get the actual size, resize the window
Maximize() Driver.manage().window.maximize()
Window.getSize();
Driver.manage.window.setSize(d);
Resize the
current window
Set particular
size
(JavaScriptExecutor)driver.executeScript
(“window.resizeTo(x,y)”);
45. www.edureka.co/testing-with-selenium-webdriver
Question 20
What is a JavaScriptExecutor?
OR
How to scroll using Selenium?
Selenium
Interview Questions
01
JavaScriptExecutor is an Interface that helps to
execute JavaScript through Selenium WebDriver.
02
It provides two methods "executescript" &
"executeAsyncScript
03
It is used when Selenium WebDriver fails to
click on any element.
48. www.edureka.co/testing-with-selenium-webdriver
Question 21
What is POM? What are its
advantages?
Selenium
Interview Questions
Advantages
keeps the tests and
element locators
separately
Makes automation
framework friendly,
more durable and
comprehensive.
Repository is
Independent of
Automation
Tests.
Able to reuse page
object methods
POM is best
applicable for the
applications which
contain multiple
pages
Easier to write
because it uses the
business domain
language.
52. www.edureka.co/testing-with-selenium-webdriver
Question 23
What is the difference between
Page Object Model (POM) and Page
Factory?
Selenium
Interview Questions
PAGE OBJECT
MODEL PAGE FACTORY
It is a class which represents the
web page and holds the
functionalities
It is a way to initialize the web
elements within the page object
when the instance is created
54. www.edureka.co/testing-with-selenium-webdriver
Question 24
How to handle mouse and
keyboard and mouse actions?
Selenium
Interview Questions
Actions class
This includes
actions such as
drag and drop,
clicking multiple
elements.
perform() method
is used here to
execute the action.
Actions class is a
built-in ability to
handle various
types of keyboard
and mouse events.
It mainly contains
Actions and Action
classes
59. www.edureka.co/testing-with-selenium-webdriver
Question 26
Can Selenium handle window pop-
ups?
Selenium
Interview Questions
This method is called when you
click on the ‘OK’ button of the
alert.
This method is called when
the ‘Cancel’ button is clicked
in the alert box.
Void dismiss() Void accept() String getText()
This method is called to
capture the alert message.
Void
sendKeys(String
stringToSend)
This is called when you want to
send some data to alert box.
62. www.edureka.co/testing-with-selenium-webdriver
Question 27
What is a Robot class?
Selenium
Interview Questions This Robot class provides control over the mouse and keyboard
devices.
04
03
02
01
MousePress()
This is used to
press the left
button of the
mouse
KeyRelease()
This method is used to
release the pressed key
on the keyboardMouseMove()
This method is called
when you want to
move the mouse
pointer in the X and Y
co-ordinates
KeyPress()
This method is called
when you want to press
any key
05
MouseMove()
This method helps
in releasing the
pressed button of
the mouse
64. www.edureka.co/testing-with-selenium-webdriver
Question 28
How do you achieve
synchronization in WebDriver?
Selenium
Interview Questions It is a mechanism which involves more than one
components to work parallel with each other.
Synchronization can be classified into two categories:
01 02
In this we just specify
timeout value only.We
will make the tool to
wait until certain
amount of time and
then proceed further.
It specifies a condition
along with timeout
value, so that tool waits
to check for the
condition and then
come out if nothing
happens.
Unconditional Conditional
67. www.edureka.co/testing-with-selenium-webdriver
Question 29
How to take a screenshot in
Selenium?
Selenium
Interview Questions
Selenium has provided TakesScreenShot interface by which we can use
getScreenshotAs method which will help in capturing the entire
screenshot in form of file then using FileUtils we can copy screenshots
from one location to another location
File src= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
try {
// now copy the screenshot to desired location using copyFile //method
FileUtils.copyFile(src, new File("C:/selenium/error.png"));
69. www.edureka.co/testing-with-selenium-webdriver
Question 30
How to handle multiple windows in
Selenium?
Selenium
Interview Questions A window handle is a unique identifier that holds the address
of all the windows. This is basically a pointer to a window,
which returns the string value
• get.windowhandle(): helps in getting the window
handle of the current window
• get.windowhandles(): helps in getting the
handles of all the windows opened
• set: helps to set the window handles which is
in the form of a string.
• switch to: helps in switching between the
windows
• action: helps to perform certain actions on
the windows.
77. www.edureka.co/testing-with-selenium-webdriver
Question 34
What are Assert and Verify
commands?
Selenium
Interview Questions
There won’t be any halt in the test execution even though the verify
condition is true or false.
An assertion is used to compare the actual result of an application
with the expected result.
Assert
Verify
79. www.edureka.co/testing-with-selenium-webdriver
Question 35
How can you redirect browsing
from browser through PROXY
Selenium
Interview Questions
String PROXY = “199.201.125.147.80000”
Cap.setCapability(CapabilityType.PROXY,proxy);
Selenium provides PROXY class to redirect from a proxy
87. www.edureka.co/testing-with-selenium-webdriver
Question 39
What are Regular Expressions?
Selenium
Interview Questions
Regular expressions are a very useful technique for improving
Selenium WebDriver tests.
Regular expression patterns in Selenese need to be prefixed with either
regexp or regexpi. The former is case-sensitive; the latter is case-
insensitive
93. www.edureka.co/testing-with-selenium-webdriver
Question 42
What are Exceptions in Selenium?
Selenium
Interview Questions An exception is an event or a problem that arises during the execution of
a program
•WebDriverException
•NoSuchWindowException
•NoAlertPresentException
•NoSuchFrameException
•NoSuchElementException
100. www.edureka.co/testing-with-selenium-webdriver
Question 45
Difference between Selenium and
QTP
Selenium
Interview Questions
Browser compatibility
Cannot be run across different
browsers but only windows and it
can test web, mobile and desktop
applications
Run across different browsers
and can test only web
applications
Java
113. www.edureka.co/testing-with-selenium-webdriver
Question 49
Can I navigate back and forth the
webpage in Selenium?
Selenium
Interview Questions
Yes. You can navigate in the browser
01
02
03
04
Driver.navigate.forward
Driver.navigate.back
Driver.navigate.refresh
Driver.navigate.to(“url”)
115. www.edureka.co/testing-with-selenium-webdriver
Question 50
Why do you prefer Selenium?
Selenium
Interview Questions
It has a large user base and helping community
Cross-browsing capability
Platform compatibility
Support for different programming languages
Free and Open-source