Top 100 Selenium Interview Questions and Answers For 2023
Top 100 Selenium Interview Questions and Answers For 2023
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 1/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
EXPLORE MORE
Learn Java
Programming with
Beginners Tutorial
08:32
What is Integration
Testing Software
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 2/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
ID
Name
Tag
Attribute
CSS
Linktext
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 3/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
PartialLink Text
Xpath etc
b) Regression
For post release validation with continuous integration automation tool could be used
a) Jenkins
b) Hudson
c) Quick Build
d) CruiseCont
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 4/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 5/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
Verify: Verify command will check whether the element is on the page, if it is not then the
test will carry on executing. In verification, all the commands are going to run guaranteed
even if any of test fails.
Test
Before
After
Ignore
BeforeClass
AfterClass
RunWith
To click on specific part of element, you would need to use clickAT command. ClickAt
command accepts element locator and x, y co-ordinates as arguments-
Host
Port Number
Browser
URL
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 7/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
Thread.sleep () :
It will stop the current (java) thread for the specified period of time. Its done only once
SetSpeed () :
For specific amount of time it will stop the execution for every selenium command.
This command is useful for demonstration purpose or if you are using a slow web
application
18) What is same origin policy? How you can avoid same origin policy?
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 8/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
The “Same Origin Policy” is introduced for security reason, and it ensures that content of
your site will never be accessible by a script from another site. As per the policy, any code
loaded within the browser can only operate within that website’s domain.
To avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode
the Selenium Server acts as a client configured HTTP proxy , which sits between the
browser and application under test and then masks the AUT under a fictional URL
element.submit () ;
Alternatively you can use click method on the element which does form submission
21) What are the features of TestNG and list some of the functionality in
TestNG which makes it more effective?
TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of
testing needs, from Unit Testing to Integration Testing. And the functionality which makes
it efficient testing framework are
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 9/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
You will need to switch to each and every frame and search for locator which we want.
It finds the first element within the current page using the given “locating mechanism”. It
returns a single WebElement
findElements () : Using the given “locating mechanism” find all the elements within the
current page. It returns a list of web elements.
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 10/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
@Before public void method() – It will perform the method () before each test, this
method can prepare the test
@Test public void method() – Annotations @Test identifies that this method is a test
method environment
@After public void method()- To execute a method before this annotation is used,
test method must start with test@Before
27) Explain how you can login into any site if it’s showing any
authentication popup for password and username?
Pass the username and password with url
Syntax-http://username:password@url
ex- http://creyate:[email protected]
WebElement el = driver.findElement(By.id(“ElementID”))
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 11/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
Borland Silk test is not a free Selenium is completely free test automation
testing tool tool
Silk test uses test scripting Selenium suite has the flexibility to use many
language languages like Java, Ruby,Perl and so on
Silk test can be used for Selenium can be used for only web
client server applications application
Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver,
which launch the browser and run the test. With entire test suite, it allows for running
tests in parallel.
If you are using Selenium-WebDriver, you don’t need the Selenium Server as it is
using totally different technology
Selenium Server provides Selenium RC functionality which is used for Selenium 1.0
backwards compatibility
Selenium Web driver makes direct calls to browser using each browsers native
support for automation, while Selenium RC requires selenium server to inject
Javascript into the browser
Handling multiple frames, pop ups , multiple browser windows and alerts
Page navigation and drag & drop
Ajax based UI elements
Multi browser testing including improved functionality for browser not well
supported by Selenium 1.0
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 13/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
36) 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
Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument
38) Using web driver how you can store a value which is text box?
You can use following command to store a value which is text box using web driver
WebDriverException
NoAlertPresentException
NoSuchWindowException
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 14/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
NoSuchElementException
TimeoutException
driver.switchTo().frame(“frameName”);
driver.switchTo().frame(“parentFrame.4.frameName”);
This would bring control on frame named- “frameName” of the 4th sub frame names
“parentFrame”
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 15/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
getwindowhandles(): It is used to get the address of all the open browser and its return
type is Set <String>
getwindowhandle(): It is used to get the address of the current browser where the
control is and return type is string
Syntax-driver.switchTo().defaultContent();
By.id()
By.name()
By.tagName()
By.className()
By.linkText()
By.partialLinkText()
By.xpath
By.cssSelector()
In order to display a constant string, command can be used is echo <constant string>
If order to display the value of a variable you can use command like echo ${variable
name>>
Above is using PHP. If you are using Java, replace echo with System.out.println
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 16/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
Recovery scenarios depends upon the programming language you use. If you are using
Java then you can use exception handling to overcome same. By using “Try Catch Block”
within your Selenium WebDriver Java tests
51) How can you prepare customized html report using TestNG in hybrid
framework?
There are three ways
52) From your test script how you can create html test report?
To create html test report there are three ways
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 17/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
TestNG: Using inbuilt default.html to get the HTML report. Also XLST reports from
ANT, Selenium, TestNG combination
JUnit: With the help of ANT
Using our own customized reports using XSL jar for converting XML content to HTML
Select “Toggle break point” by right click on the command in Selenium IDE
Press “B” on the keyboard and select the command in Selenium IDE
Multiple break points can be set in Selenium IDE
Insert a break point from the location from where you want to execute test step by
step
Run the test case
At the given break point execution will be paused
To continue with the next statement click on the blue button
Click on the “Run” button to continue executing all the commands at a time
Actions: It is used for performing the operations and interactions with the target
elements
Assertions: It is used as a check points
Accessors: It is used for storing the values in a variable
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 18/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
58) In selenium IDE what are the element locators that can be used to
locate elements on web page?
In selenium there are mainly 4 locators that are used
X-path locators
Css locators
Html id
Html name
59) In Selenium IDE how you can generate random numbers and dates
for test data?
In Selenium IDE you can generate random numbers by using Java Script
type
css=input#s
javascript{Math.random()}
And for
type
css=input#s
javascript{new Date()}
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 19/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
60) How you can convert any Selenium IDE tests from Selenese to
another language?
You can use the format option of Selenium IDE to convert tests into another programming
language
storeTable
Css=#table 0.2
textFromCell
When a locator has changed and Selenium IDE cannot locate the element
When element Selenium IDE waiting to access did not appear on the web page and
the operation timed out
When element Selenium IDE was trying to access was not created
Insert a break point from the location where you want to execute step by step
Run the test case
At the given break point execution will be paused
To continues with the next step click on the Blue button
To run commands at a time click on run button
From Selenium IDE single line command can be executed in two ways
Select “Execute this command” by right clicking on the command in Selenium IDE
Press “X” key on the keyboard after selecting the command in Selenium IDE
65) In which format does source view shows your script in Selenium IDE?
In Selenium IDE source view shows your script in XML format
Press “S” key on the keyboard and select the command in Selenium IDE
In Seleniun IDE right click on the command and the select “Set / Clear Start Point”
67) What if you have written your own element locator and how would
you test it?
To test the locator one can use “Find Button” of Selenium IDE, as you click on it, you
would see on screen an element being highlighted provided your element locator is right
or or else an error message will be displayed
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 21/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
On different platforms and different web browser for automating web application
selenium RC is used with languages like Java, C#, Perl, Python
Selenium RC is a java based and using any language it can interact with the web
application
Using server you can bypass the restriction and run your automation script running
against any web application
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 22/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
The main difference between Selenium RC and Webdriver is that, selenium RC injects
javascript function into browsers when the page is loaded. On the other hand, Selenium
Webdriver drives the browser using browsers built in support
to do this. By using “parallel=test” attribute you can set tests to be executed in parallel
and can define two different tests, each using different browser.
82) Explain how you can capture server side log Selenium Server?
To capture server side log in Selenium Server, you can use command
83) Other than the default port 4444 how you can run Selenium Server?
You can run Selenium server on java-jar selenium-server.jar-port other than its default
port
86) To enter values onto text boxes what is the command that can be
used?
To enter values onto text boxes we can use command sendkeys()
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 24/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
isElementPresent(String locator)
Breakpoints: When you implement a breakpoint in your code, the execution will stop
right there. This helps you to verify that your code is working as expected.
StartpointsStartpoint indicates the point from where the execution should begin.
Startpoint can be used when you want to run the testscript from the middle of the
code or a breakpoint.
90) Mention what are the challenges in Handling Ajax Call in Selenium
Webdriver?
The challenges faced in Handling Ajax Call in Selenium Webdriver are
Using “pause” command for handling Ajax call is not completely reliable. Long pause
time makes the test unacceptably slow and increases the testing time. Instead,
“waitforcondition” will be more helpful in testing Ajax applications.
It is difficult to assess the risk associated with particular Ajax applications
Given full freedom to developers to modify Ajax application makes the testing
process challenging
Creating automated test request may be difficult for testing tools as such AJAX
application often use different encoding or serialization technique to submit POST
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 25/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
data.
IAnnotationTransformer
IAnnotationTransformer2
IConfigurable
IConfigurationListener
IExecutionListener
IHookable
IInvokedMethodListener
IInvokedMethodListener2
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 26/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
IMethodInterceptor
IReporter
ISuiteListener
ITestListener
For Selenium,
99) Mention why do you need Session Handling while working with
Selenium?
While working with Selenium, you need Session Handling. This is because, during test
execution, the Selenium WebDriver has to interact with the browser all the time to
execute given commands. At the time of execution, it is also possible that, before current
execution completes, someone else starts execution of another script, in the same
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 27/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
machine and in the same type of browser. So to avoid such situation you need Session
Handling.
100) Mention what are the advantages of Using Git Hub For Selenium?
The advantages of Using Git Hub for Selenium are
Multiple people when they work on the same project they can update project details
and inform other team members simultaneously.
Jenkins can help you to build the project from the remote repository regularly. This
helps you to keep track of failed builds.
This detailed Selenium with Java interview questions PDF will help you to clear the
doubts about Selenium testing interview questions and will also help you to crack the
interview.
How to use Selenium IDE with Scripts & Commands (Assert, Verify)
AutoIT in Selenium Tutorial: How to use it?
How to Execute Failed Test Cases in TestNG: Selenium WebDriver
How to Take Screenshot in Selenium WebDriver
Download Geckodriver: How to Install Firefox Driver for Selenium
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 28/29
4/7/23, 7:31 PM Top 100 Selenium Interview Questions and Answers for 2023
About
About Us
Advertise with Us
Write For Us
Contact Us
Career Suggestion
SAP Career Suggestion Tool
Software Testing as a Career
Interesting
eBook
Blog
Quiz
SAP eBook
Execute online
Execute Java Online
Execute Javascript
Execute HTML
Execute Python
© Copyright - Guru99 2023 Privacy Policy | Affiliate
Disclaimer | ToS
https://www.guru99.com/top-100-selenium-interview-questions-answers.html 29/29