13 min read

Top 25 Selenium Tricky Interview Questions

Among the range of different Automation Testing Tools available in the market, Selenium has earned a remarkable reputation for itself.

It exists as a portable framework which bypasses the need to learn a specific test scripting language and can be used to test web applications. It provides testing on multiple browsers as well as supports most of the popular programming languages.

All these features taken together, contribute towards making Selenium, the first choice when it comes to Automation Testing. Given its utility and demand, many of you would definitely aspire to develop expertise in the handling of the tool.

Hence, if you wish to ace a Selenium interview like a pro, you have come to the right place. We shall provide you with a careful curated Selenium Tricky Interview Questions PDF.

This list of Selenium Tricky Interview Questions has been prepared in line with the existing demands of the industry.

In this blog, we shall look at the Top 25 Selenium Tricky Interview Questions for Experienced. These tricky Selenium Interview Questions have been carefully chosen from among those deemed to be most important for those at an advanced or experienced level.

So, without further ado, let us look at these:

Top 25 Selenium Tricky Interview Questions

1. How can tests be debugged in Selenium IDE?

This is one of the classic Selenium Tricky Interview Questions.

  • As a first step, you will be required to insert breakpoints where you want to debug and execute the test step by step
  • Then, you run the test case
  • Following this, the execution halts at the point where the breakpoint is kept
  • Post this, you can click on the Run button in order to continue with the execution of all the commands sequentially

2. What is the need to use TestNG with Selenium RC?

TestNG helps in providing much needed flexibility in specific situations. For instance, if the specification of the automation test suite is required to work against different client platforms and servers, we will be obliged to invoke the test cases from the command line.

Moreover, it will be required to provide for the periodic generation of reports as well as implement flexibility on how to create the tests. This is facilitated through TestNG.

Want to know more about TestNG Annotations, do read our blog on What are TestNG Annotations?


3. How do you handle a frame in Selenium WebDriver?

The inline frame or the iframe is used to insert another document within the existing HTML document.

Accordingly you have different options.

  • Selecting iframe by ID:

driver.switchTo().frame(ID of the frame);

  • Locating iframe by tagName:


  • Locating iframe using index:
  • frame(index)


  • frame(Name of the Frame)

driver.switchTo().frame(Name of the frame);

  • frame(WebElement element)

Select Parent Window


4. Consider a situation: Selenium Script runs in Chrome, but not in IE. How can you resolve the issue?

There can be different reasons which might inhibit the working of a script on IE. However, you can certainly attempt to resolve the issue through different ways.

  • Ensure that you are using the updated version of the Selenium IE Driver
  • Ensuring compatibility between the working environment and the IE driver
  • Assigning same value for the Enabled Protected Mode option for all zones from the Security Tab
  • Proceeding with the configuration of the IE driver with the setProperty method and by importing dependencies
  • Making use of CSS Selectors to minimise exceptions
  • Instituting a Registry Entry
  • Internet security settings in IE should be turned off while executing the script
  • Making use of latest Selenium jars
  • Making use of JavaScriptExecutor instead of native click when clicking elements
  • Allowing for JavaScript on the IE browser

5. Can you use Selenium to conduct responsive Web design testing?

The usage of applications, not just on laptops, but also on tabs or smartphones, has increased by leaps and bounds.

This has also increased the need for conducting responsive web design testing. However, if one is to manually test all applications across all different platforms, it will definitely be an extremely time-consuming and tedious task.

It could also result in unnecessary delays in the release of the product. Hence, it is only wise to automate RWD testing and in doing so, one can make use of the Galen framework.

It runs in Selenium Grid and with its help, one can run tests in a cloud as well as conduct parallel testing.

6. What are the types of listeners in TestNG?

The types of listeners in TestNG are:

  • IConfigurable
  • IExecutionListener
  • IAnnotationTransformer
  • IHookable
  • IInvokedMethodListener
  • IInvokedMethodListener2
  • IConfigurationListener
  • IReporter
  • ITestListener
  • IMethodInterceptor
  • ISuiteListener
types of listeners in TestNG

7. For database testing in Selenium WebDriver, which API is required?

For this, we will require the Java Database Connectivity (JDBC) API. It facilitates the execution of SQL statements.

8. Can window pop-ups be handled by Selenium?

Since Selenium solely provides for testing of web applications and not mobile or Window-based applications; it does not support handling of window pop-ups. In order to handle such pop-ups, third party intervention is required.

Examples of such external tools are Autolt and Robot Class. A pop-up window displaying a warning message is exhibited as an alert. Herein, few options are available.

  • Void dismiss()

This method is invoked when you click on the cancel button in the alert box

  • Void accept()

This method is invoked when you click on the ok button in the alert box

  • String getText()

This method is invoked to capture the alert message

  • Void sendKeys(String stringToSed)

This method is invoked when you want to send some data to alert box

9. Can you take screenshots in Selenium WebDriver?

The answer to the above question is a yes. Screenshot can be taken by making use of the TakeScreenshot function. Consequently, you can make use of the getScreenshotAs() method to save the screenshot.

File scrFile = ((TakeScreenshot)driver) .getScreenshotAs(outputType. FILE);

10. What is a Robot Class?

The Robot class helps in providing control over the mouse and keyboard devices. It includes:

  • KeyPress()

Invoked when you want to press any key

  • KeyRelease()

Invoked to release the pressed key on the keyboard

  • MouseMove()

Invoked to move the mouse pointer in the X and Y coordinates

  • MousePress()

Invoked to press the left button of the mouse

robot class

11. What are assertions in Selenium? What are its types?

Assertions are used as checkpoints which help in keeping track of the sequential flow of commands.

They act as validating tools which help in determining whether a test case is behaving as expected or not. There are certain test suites which run for long durations, such as a sanity suite or a regression suite.

In such cases, it might not be possible to continuously keep track of the execution manually. Assertions aid testers in marking the test cases as being passed or failed.

There are two major types of assertions. These are:

  • Soft Assert

This assertion only helps in verifying the condition and giving the result. However, it doesn’t result in abortion of the test case execution, in case of failure of the test case.

  • Hard Assert

This assertion looks out for the expected result and in case the condition fails to match, it aborts execution and display the java.lang.AssertionError exception.

The different types of Hard Assertions in Selenium are:

  • assertNull()
  • assertNotNull()
  • assertEquals()
  • assertNotEquals()
  • assertTrue()
  • assertFalse()

12. How to find broken links in Selenium?

This is one of the common Selenium tricky Interview Questions.

In order to detect broken links, you can proceed along the following steps.

  • You will be required to accumulate all the links present on a web page by making use of the <a> anchor tag. For each of the <a> tag, make use of the attribute, <href> value in order to obtain the hyperlink
  • Next, you have to send HTTP requests for each link and verify the HTTP response code
  • On the basis of this HTTP response code, you will be able to determine if the link is valid or broken. After this, you can make use of the driver.get() method in order to navigate to a URL, which should respond with a status of 200-OK. 200-OK indicates that the link is working. However, if you do happen to get any other status, then it would indicate that the link is broken.
  • You can repeat the process for all the captured links

13. What is Silk Test Tool?

Silk Test Tool is a medium for regression and automated function testing of enterprise applications. It allows the user to record sessions with their applications, in order to create tests.

Using the tool, users can also enhance the test by adding test logic and verifications, along with playing back tests in order to ensure the proper functioning of the applications.

14. What are the different types of navigation commands provided by Selenium?

The list includes the following commands:

  • navigate().forward()

The command helps in taking the user to the next web page on the basis of the browser history.

  • navigate().back()

The command helps in taking the user to the last used or the previous web page on the basis of the browser history.

  • navigate().to()

The command helps in taking the user to a new web page in a new window on the basis of the URL specified.

  • navigate().refresh()

The command helps the user in refreshing the current web page by reloading all the web elements.

navigation control commands

15. How to assert the title of the web page in WebDriver?

In order to achieve this objective, you need to follow the following steps.

  • Import Assert class in the import section: import org.testng.Assert;
  • You will be required to create a WebDriver object: WebDriver driver = new FirefoxDriver();
  • You can apply this to assert the title of the web page

16. How can you prepare a customized HTML report in TestNG using hybrid framework?

A customized HTML report can be prepared in the following manner:

  • Junit with the help of an Ant
  • TestNG using inbuild default file
  • Also use XSL file

17. How to skip a method or a code block in TestNG?

In order to skip a particular test method, you can set the enabled parameter in test annotation to false.

@Test(enabled = false)

The default value of the enabled parameter will be true. Hence, it is not required to define the annotation as true while defining it.

18. Explain the importance of testing.xml

The significance of using TestNG in Selenium is well established. However, how do you define the test suites and grouping of test classes in TestNG?

This is facilitated by acquiring instructions from the testing.xml file. A test suite cannot be defined in the testing source code.

On the contrary, it is represented in an XML file, as the suite is an important aspect of execution. In order to execute a group of test cases, i.e., test cases in a suite, you will be required to create a testing.xml file.

It would contain the name of all the methods and classes, which you would want to execute as a part of the execution flow.

Additionally, testing.xml file also provides for execution of multiple test cases from multiple classes, allows execution of test cases in groups as well as provides for parallel execution.

19. What is the difference between driver.close() and driver.quit() commands?

The similarity between the two is that both the commands do not accept any parameter and do not take any value.

20. What is the difference between findElement() and findElements() in Selenium?

findElement()findElements()The command helps in finding one particular element within the current page using the locating mechanism.

It returns the first element located by the locator.The command helps in finding all the elements within the current page using the locating mechanism. Consequently, it returns a list of matching web elements found by the locator.

21. How many parameters do Selenium commands have at minimum?

Selenium provides the option of four parameters. These are:

  • Host

Selenium can be bound to a specific IP address, instead of a local host.

  • Browser

Indicates the browser in which the selenium scripts have to be executed.

  • Port Number

The port number indicates the TCP/IP port which can be specified in order to connect the Selenium tests to the Grid hub.

Additionally, you should be sure that there is no other application with the same port number up in any other location within the same machine.

  • URL

The application URL helps in triggering the test cases within that.

22. As far as Selenium is concerned, how is the desired capability useful?

This is another classic tricky Selenium Interview Questions.

Desired Capability refers to a specific functionality or feature. It includes a series of key value pairs which can be used to store information like the browser name, the path of the browser driver in the system, the browser version and so on, which help in determining the behavior of the browser at the run-time.

In case of Selenium, the driver instance can be configured by making use of desired capability. It is especially helpful when you would like to run the test cases in different operating systems, versions and browsers.

23. What is Page Factory?

Page Factory provides an optimized way to execute the Page Object Model. The implementation is done in an object oriented manner. It serves as an inbuilt POM framework which is provided by Selenium WebDriver for supporting Page Object Design patterns.

POM implementation with Page Factory is carried out using the By() method and there are no imports needed or cache storage.

Page Factory is used to initialize the elements of the Page Object. One is not required to use FindElements. Instead, one can resort to annotations like @FindBy to find Web element and initElements method, in order to initialize web elements from the Page Factory class.

page factory in selenium

24. What is the utility of Database Automation Testing? Can Selenium be used to conduct database testing?

The utility of Database Automation Testing can be gauged from the significance of database itself. Database plays a crucial role in storing and sequencing data. Accordingly, automation testing of database helps in:

  • Precise storage and retrieval of values in and from the database
  • Defect free data processing
  • Detecting bugs which cannot be discerned in front-end testing
  • Validation of ACID properties (ACID implies Atomicity, Consistency, Isolation and Durability)
  • Proper Data Mapping and Data Integrity

Selenium can definitely be used to conduct Database testing. You will be required to establish a connection between the database and the server.

This can be facilitated through a JDBC connection. JDBC, as an SQL based Java API, helps in connecting with databases and executing queries. Post this, you can process the results. The prime components of JDBC are:

  • Driver Manager
  • Driver
  • Connection

25. What is Parameterization in TestNG?

Parameterization is essentially a strategy of defining values and sending them as parameters to the test class. It helps developers to run the same test over and over again using different values. It is useful when we are required to pass multiple login credentials of different test environments. TestNG facilitates the passing of parameters to the test methods in two ways: with Data Providers and with testng.xml.


I am sure that this Selenium Tricky Interview Questions PDF will serve as a useful guide for all those seeking to prepare for a Selenium Interview.

This list of Selenium Tricky Interview Questions, is quite likely to give a fair idea of some of the most important topics on which you might be questioned upon at an advanced level. The list might not be exhaustive, but it would certainly serve its bit in helping you in your preparation.

Being a highly preferred Automation Testing Tool, Selenium has become a favorite of Software Development Engineers in Test (SDET).

The SDET training course provided by Syntax Technologies, not only help you in acquiring skills in line with the designation of an SDET, but also helps you acquire hands-on experience in the usage of tools like Selenium.

SDET Automation Certification Course
Like what you read?
Share with your community!

Subscribe to our