You are on page 1of 27

TOP 25 SELENIUM INTERVIEW

QUESTIONS AND ANSWERS


PRESENTED BY TESTBYTES
1. What is Selenium?

>Selenium is a WebDriver Automation tool


which is used to test web-based
applications via automating the test
procedure.

>It supports various browsers,


programming languages, and platforms.

WWW.TESTBYTES.NET
2. What is Automation Testing?

>Automation Testing is a procedure for


automating the manual steps or process to
test the application or software.

>It requires an additional testing tool to


create test scripts that can be executed
repeatedly.

WWW.TESTBYTES.NET
3. Why do we need software testing?

>Once an application is developed, it is


mandatory to check whether that
application contains any errors or not.

>Software testing provides a tester to


check for substantial errors or bugs in the
application and resolves it

WWW.TESTBYTES.NET
4. When will you choose to use Selenium Grid?

>When there are multiple tests to be


executed, we will use selenium grid.

>It will enable us to run same test scripts


on multiple platforms simultaneously and
thus reducing the time consumption.

WWW.TESTBYTES.NET
5. Can you illustrate the drawbacks of Selenium?

>It cannot be used for desktop applications


testing.

>Also, it cannot perform on test on web


services.

>To create vigorous scripts, knowledge of


programming languages is required.

>External libraries are required to perform


tasks in Selenium.
WWW.TESTBYTES.NET
6. Name the types of testing in Selenium?

>Regression Testing

>Functional Testing

>Load Testing

WWW.TESTBYTES.NET
7. Can you test APIs or web services using Selenium
Web Driver and why?

>No, we cannot test web services using


Selenium.

>Web services are headless and it only


uses browser’s class method to automate
web applications. Thus it cannot automate
web services.

WWW.TESTBYTES.NET
8. When will you choose to use Selenium IDE?

>When there is repetition in the test


procedure and we want to run the same
sequence over and over again.

>Selenium IDE provides record and


playback feature which we can use to run
tests repeatedly in the same sequence.

WWW.TESTBYTES.NET
9. What is X Path in Selenium?

>X Path is a locator which uses XML path


to locate a web element in Selenium.

>It can also be used to locate HTML


elements. X Path uses references from
another element to find the specific
element in a web page.

WWW.TESTBYTES.NET
10. What is the basic difference between absolute
and relative X Path?
Absolute X Path: It uses a complete path
starting from the node of the root element
to go to the desired element.

Relative X Path: It only uses references


from another element to go to the desired
element.

WWW.TESTBYTES.NET
11. Have you ever automated test cases, If yes, how
many per day?

>Yes, I’ve automated test cases and on


average I can automate 3-5 test cases each
day.

>Although, these test cases can be


sometimes complex and lengthy that can
take a day to complete.

WWW.TESTBYTES.NET
12. Can you name the latest Selenium tool and its
use?
WebDriver is the latest selenium tool used
to automate web applications testing and
checks whether it is working as expected
or not.

WWW.TESTBYTES.NET
 13. Can you state the difference between regression
and functional testing?
>Regression Testing: Regression testing is
a repeated test of an already tested
program.

>Functional Testing: Functional testing


usually ensures the functionality of the
software program.

WWW.TESTBYTES.NET
14. What is the use of TestNG in Selenium?

>TestNG in Selenium is used to cover a


wide range of test categories such as
functional, unit, end-to-end etc.

>Using TestNG we can easily generate a


proper report of test cases and can easily
gather the information of how many test
cases were passed, failed or skipped.

WWW.TESTBYTES.NET
15. Can we verify the image using Selenium?

>No, we cannot verify the image in


Selenium but we can easily verify whether
the image is displayed or not using
properties.

WWW.TESTBYTES.NET
16. Can you state the difference between ‘Type’ and
‘TypeAndWait’ command?
>Type: When the user needs to enter the
text into a text field, type command is
used.

>TypeAndWait: This command is generally


used to reload the web page as soon as the
typing of text is completed.

WWW.TESTBYTES.NET
17. How will you take screenshots using Selenium?

We can easily take screenshot using


TakeScreenShot function with
getScreenshotAs() method.

>Example:File scrFile =
((TakeScreenshot)driver).getScreenshotAs(
screenshot.JPG);

WWW.TESTBYTES.NET
18. Can you go back and forth in the browser using
Selenium?

Yes, we can easily use the following


commands to move back and forth in the
browser using Selenium:

>navigate().back()
>navigate().forward()

WWW.TESTBYTES.NET
19. Can you go back and forth in the browser using
Selenium?

Yes, we can easily use the following


commands to move back and forth in the
browser using Selenium:

>navigate().back()
>navigate().forward()

WWW.TESTBYTES.NET
20. How would you delete the cookies using Selenium?

>To delete the cookies, we will use


deletedAllCookies() command.

Syntax: driver.manage().deleteAllCookies();

WWW.TESTBYTES.NET
21. Write the code to double-click an element?

Actions action = new Actions(driver);

WebElement element
=driver.findElement(By.id(“elementId”));

action.doubleClick(element).perform();

WWW.TESTBYTES.NET
22. Can you list all the navigations methods which are
used in Selenium?
Yes, the following are the different
navigation methods use in Selenium:

Syntax

driver.navigate().to(String
url);driver.navigate().refresh();
driver.navigate().forward();
driver.navigate().back();

WWW.TESTBYTES.NET
23. How will you perform drag and drop in Selenium?

Actions action = new Actions(WebDriver);

action.dragAndDrop(sourceWE, destWE)

WWW.TESTBYTES.NET
24. How will you verify whether the element is
visible or not?
To verify whether the element is visible or
not, we’ll use following syntax:

WebElement e = driver.findElement();
boolean result = e.isDisplayed();

WWW.TESTBYTES.NET
25. How will you clear the text which is written in a
textbox?
We will use clear() command to clear the
text which is written in a text box.

Syntax: driver.findElement(By.id(“element
Locator”)).clear();

WWW.TESTBYTES.NET
Contact Details

Mailing address
Kalas road, Vishrantwadi, Pune, Maharashtra-411015

Email address
info@testbytes.net

Phone number
+91 811 386 5000

You might also like