Top 50 Selenium Interview Questions

Selenium is a highly popular automated testing framework that is widely used across multiple browsers and platforms. All the businesses across the world are now switching to the automatic testing framework to benefit from the convenience it provides.

Selenium is one of the most popular options and definitely is ruling the market. It is a collection of tools, each of which is meant for fulfilling specific requirements of the organization.

However, as it can be complicated, the interview will be tough. So before you go on for a job interview, you need to have some idea about the possible questions which the guide here will provide you help with.

 

Selenium interview questions

 

1. Selenium suite- what is it?  Name different components of Selenium.

Selenium, in simple words, is a package of different testing tools known as the Selenium suite, each of which is designed to get different testing requirements of the organization.

Selenium has got four major components, including

  1. Selenium integrated development environment
  2. Selenium remote control
  3. Selenium WebDriver
  4. Selenium grid

2. What is the meaning of automated testing?

Automatic testing, in simple words, is automating the testing process of an application using the testing tools, which allows the creation of a script that can easily be executed on a repeat base for generating detailed test reports of the application.

3. Why do you use Selenium as an automation tool?

A selenium automation tool is an open-source tool that provides great assistance. Besides, the language assistance on the application is wide, which includes Python, Java, Ruby, etc.

Not to mention it is quite compatible with a variety of operating systems, making it suitable for all organization needs.

4. What is any possible drawback of using Selenium as a testing tool?

Selenium supports the testing of only web-based applications, making it incompatible with integration method party tools. Besides, there is no built-in test management or reporting facility. The major problem found herein is the unavailability of reliable tech support.

5. Why must Selenium be used as a testing tool for web systems and applications?

Selenium is open-source software that has got a large user base that supports the community. The platform efficiently works across multiple operating systems like Linux, Windows, etc.

Not to mention it is compatible with multiple browsers like Chrome and Google. Also, it provides support for distributed testing, making it a perfect choice for web system testing.

6. Is Selenium suitable to launch web browsers?

Selenium is way too good to provide great support for launching web browsers like Firefox, Google, Chrome, etc.

7. What are the different types of Selenium commands?

The Selenium commands can be divided into three categories, namely actions, assertions, and accessors.

8. Name different locators present in Selenium.

There are different types of locators one can find in Selenium for identifying web elements accurately. This includes Name, ID, ClassName, LinkText, TagName, PartialLinkText, CSS Selector, Xpath, DOM.

9. How is the assert and verify command differently?

The assert condition is known for stopping the execution of the testing when the given condition is false.

At the same time, the verification doesn’t stop the execution flow irrespective of the condition being found.

10. How are the commands “type” and “type and wait” different in Selenium?

On one side, the type command is used for entering keyboard key values into the text box of the software web application.

On the other side, the type and wait command is used when one is finished typing and reloads the software page.

11. What are testing types supported by Selenium?

The Selenium support two types of testing, namely regression and functional testing.

12. When do you Selenium IDE?

It is the easiest and simplest flavor present within the Selenium Package. It helps record and playback the feature, which makes it quite easy to learn with minimal knowledge about the programming language, making it a perfect choice for a new user.

selenium

13. Selenese- what is it?

It is a language used in Selenium IDE to write a test script.

14. What is Xpath?

It is used for looking at a web element based on its XML path. It efficiently stores data in a key-value pair which is a lot more similar to HTML tags.

15. When to use the Selenium grid?

The element can be used to execute the same or different test scripts on multiple browsers and platforms to achieve distributed test execution.

16. Name the different types of drivers available in the web driver.

Herein the available drivers include ChromeDriver, OperaDriver, SafariDriver, iPhoneDriver, AndroidDriver, Internet explorer driver, FirefoxDriver, and HTML unit, driver.

 17. How can you type in a textbox using Selenium?

The user herein has the option to use the send key for entering the string in the textbox.

18. How to get a text of a web element?

The command is used for retrieving the text of a specific web element. It does not require any parameter but can return a string value.

Besides, it is also one of those extensively used commands for verification of the labels, messages, errors, etc.

19. Is it possible for WebDriver to test a mobile application?

The WebDriver is web-based testing. Therefore it is only possible to test the applications on the mobile browser.

20. Is it possible to automate captcha?

No, there is no possibility for the reader to automate barcode and captcha.

21. Name the programming language and operating system that are supported by Selenium?

  • Programming languages- C#, Java, PHO, Python, JavaScript, Ruby, Perl
  • Operating systems- iOS, Android, Linux, Windows, Solaris, Mac

22. Describe in simple words the assertion in Selenium?

It is used as a verification point that clearly specifies the state of the application conforms to what is expected.

23. How does / and // in XPath differ?

The single slash is used for creating the XPath without an absolute path. On the other hand, the double slash is mostly used to create XPath with the relative path.

24. How to launch different browsers in Selenium WebDriver?

For launching browsers in Selenium WebDriver, you need to create an instance of a driver of that particular browser.

WebDriver driver =newFirefoxDriver();

Herein WebDriver can be considered an interface, and you are responsible for creating a reference variable driver that is instantiated using FireFoxDriver class.

25. Write a snippet for performing right-click an element in WebDriver.

Herein you can make use of action class for generating user event like right click an element and WebDriver.

Actions action = newActions(driver);

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

action.contextClick(element).perform();

26. What will be the result of mixing both implicit wait and explicit wait in a Selenium script?

As per the Selenium documentation, it is suggested not to mix explicit and implicit wait, as when you go on to mix them, then it can lead to unpredictable wait.

This happens because the explicit wait will always get the first preference, and then only the implicit wait will be executed. Thus it will be a time-consuming process.

27. How to use a recovery scenario in Selenium WebDriver?

You can make use of the recovery scenarios by using the Try-Catch block within the Selenium drivers Java tests.try {driver.get(https://www.devlabsalliance.com);}

Catch{System.Out.printIn(e.getMessage());}

28. What do you know about desire capabilities?

They are used for handling the SSN certificate in the Chrome browser. However, to use it, one needs to create the instance of desired capabilities.

29. Which Selenium technology can be used for distributed data processing?

Selenium Grid is highly popular for distributed data processing. It helps distribute tests on multiple machines in parallel. The test can easily be executed in parallel on different operating systems and web browsers simultaneously with the single use of the Selenium Grid.

30. Name the most commonly used browser navigation commands for Selenium WebDriver.

  1. Navigation to command, which is used for loading a new web page in the current browser window and also for returning a string as a parameter
  2. A forward command is responsible for the same operations as the forward button present on any browser.
  3. The back command does the same operations as the back button available on any browser.
  4. The refresh command is meant for refreshing the current page.

31. How is page object different from page factory?

The page object model is a class that is meant to represent the web page and the functionalities and its member.

On the other side, the page factory is a way of initializing the web elements that one wants to interact with the page object while creating any instance of it.

32. How can you easily handle pop-ups in Selenium?

In Selenium, the robot class is used for handling keyboard and mouse functions. It closes a pop-up window by making use of the WimdowHandle() function.

You can easily handle the pop-up window in contrast by using third-party tools. One can also handle pop-ups and the other window-based features.

33. What are Junit annotations?

It is used for identifying method types defined in the test code for executing Selenium WebDriver testing. While using it, it is vital to add an annotation to the script.

34. When can one use the Selenium grid?

Selenium Grid is widely used for executing the same or different aspects on multiple browsers for the planned forms co-currently so that it is to achieve distributed test execution.

35. Which is the fastest WebDriver implementation?

In the case of WebDriver, the fastest implementation is of the HTMUnitDriver. This is because it does not execute a test in the browser.

No doubt, starting a browser and running some test cases can take more time when compared to running a strip without any availability of a browser.

Thus it is to customize the request-response mechanism for test case execution.

36. How many parameters do the Selenium commands have?

There are basically four parameters that you need to pass in Selenium, including Port, Number, Host URL, and Browser.

37. Name the locators available in Selenium.

There are 8 different types of locators available within Selenium- Name, ID, tagName, LinkText, className, partialLinkText, CSS selector and XPath.

38. When can you use the locator’s name, ID, XPath, or CSS selector?

In the case of name locators and ID, it can be used when there are unique names or identities available on the web page.

While CSS selector can be used for performance and when name and ID locators are not unique. Finally, XPath is used when there are no available locators.

39. What steps can be taken when expected functions cannot identify the web element?

The early software developers can change the elements and the identity issues quite often. While during the execution, the web elements change dynamically.

Thus we cannot identify the web elements. To overcome this, using XPath Axes along with XPath functions will be helpful.

40. Mention the verification points in Selenium

In the case of Selenium, IDE one makes use of assert commands and Selenese verify as verification points. While in the case of Selenium WebDriver, there are no built-in features that can be used for verification.

It depends entirely on the coding style. Herein some of the verification points are

  1. To check for the page title
  2. To check for a certain element
  3. To check for certain text

41. How to take a screenshot N Selenium WebDriver?

There is a possibility that the test cases can fail while executing the test scripts. While executing a test case manually, one can easily take a screenshot and place it in the resulting repository.

The same can be done while making use of Selenium WebDriver. There are certain cases where one needs to capture a screenshot using WebDriver

  1. Application issues
  2. Difficulty in finding web elements on the web page
  3. Assertion failure
  4. Time out for finding web elements on the web page

In Selenium, there is an interface called Take screenshot, which has a method getScreenShotAs that can be used for taking a screenshot of the application under a test.

In Selenium 3, there can be some issues while taking the screenshot. To overcome this, you can make use of aShot utility.

selenium

42. What are open-source frameworks supported by Selenium WebDiver?

Junit and TestNG

43. Advantages of Selenium Grid

It allows for running test cases simultaneously. This helps save the execution time for the developers. Besides, it also allows for multi-browser testing and for executing test cases on multiple platforms.

44. Which browser supports Selenium IDE?

Chrome and Firefox are the two browsers that are known to support Selenium IDE. However, Selenium IDE is a community-powered regular update that has compatibility with the new browser versions, which cannot be insured.

45. Why is Selenium automation preferable?

Selenium automation tools and outlets make things easy for businesses. But there are different other benefits that one can get with automation testing, which include.

  1. Selenium is a free and open-source tool
  2. Selenium has a large user base and helps communities
  3. It is a cross-platform compatibility
  4. It comes with cross-browser compatibility
  5. It supports multiple programming languages
  6. Continuous integration

46. What can test cases not be automated?

There are certain test cases that cannot be automated which includes

  1. New functionalities
  2. Quality control
  3. Subjective validation
  4. User experience
  5. Low return on investment
  6. Strategic development
  7. Complex functionality
  8. Installation and set up testing

47. What is StaleElementException?

It is an exception that is thrown when the element that was involved is no longer attached to the document object model for any specific reason. For instance, if the element which was found on a web page is not referenced as a web element in the web driver.

Now, if there are any changes noticed in the DOM, then the web element

will no longer be available. Thus the web element goes stale. Now it is vital to try interacting with the Stale element, and then it is thrown.

48. How to perform drag and drop action in Selenium WebDriver?

In some of the applications, there can be a situation for automating the drag and drop and item from one location to another location.

One can easily achieve these using basic elements. Selenium has provided action classes for handling such kinds of scenarios. You can overcome such kinds of scenarios using a drag and drop using the action class.

49. Mention types of data that can be handled in Selenium

  1. Excel
  2. SQL
  3. CSV
  4. JSON
  5. YAML

50. How can you run a group of test cases using TestNG?

TestNG allows the use of performance of the estimated grouping of test methods. One can not only declare that the methods belong to a group but also can also specify the groups that contain other groups.

Thus can be involved and asked to include a certain set of groups while excluding another set.

This provides maximum flexibility in how you can partition the test and doesn’t require any compliance or anything if you want to run two different sets of tests back to back.

51. How to create and run TestNG.xml?

In the case of TestNG, the framework, you need to create a TestNG.xml file for handling and creating multiple test classes.

52. How to achieve database testing in Selenium?

Selenium WebDriver is a tool to automate the user interface. However, you can only interact with the browser using Selenium WebDriver in certain cases. There can be some difficult situations in getting data from the database or modifying the data from the data.

If you plan to automate anything outside the vicinity of the browser, then you need to use other tools to achieve the task. Herein the use of the JDBC API driver can be extremely helpful.

It will provide universal data access to the Java programming language. Using this, you can access any data source only, from relational databases to spreadsheets and flat files. Besides, it also lets.

The user connects and interacts with the database to get the database on the queries we have in the automation script.

53. What is continuous integration?

It is a development practice that is meant for making the correctness of software; after each commitment, a suite test is run automatically and tested on the software to ensure whether the software is running without any brakes.

If any test face issues, then you will get immediate feedback which will state the build as broken. In simple terms, continuous integration is the process that is meant to verify the correctness of the software.

54. Advantages of page object model framework

  1. Using it, one can easily achieve code reusability by writing the quotes once and using them for different tests.
  2. There is a clean separation between the test code and the page-specific code, which becomes quite easy to maintain.
  3. Each page using the page object model will be defined as a Java class; for that, the fields will be defined as an interface for members.
  4. It will help improve the readability due to a clean separation test between test code and page-specific code.

Having a proper understanding of the possible questions that can be asked during the interview session is the key to clearing it well and presenting yourself as a confident candidate.

So make sure you prepare yourself well before you go for the interview. Preparation here is the key to getting ready for even the toughest of situations. So get ready with all the essentials to clear the interview in one attempt.

 

Conclusion

Clearing an interview for the software industry can be quite complicated. This is why you need to have a proper understanding of the latest automation tools. You can consider getting in touch with the Karthik Training center to get a proper certificate for the job.

They have got experienced professionals who will be there to provide the proper support and best software courses as and when required.

As a trusted online platform, they will guarantee you are able to understand the platform well and have a better chance of getting a good salary package.

 

Top Interview Questions for ServiceNow 2022

Top Interview Questions for ServiceNow 2022

ServiceNow is a highly popular tool that catalogs and processes customer service request. It provides technical management support, including the help desk functionality for IT operations. But as the use of an application can be quite complicated, getting a job is...

Selenium’s Different Flavors

Selenium’s Different Flavors

In the current scenario, Selenium is a highly popular automatic testing tool used for validating web applications across different platforms and browsers. Using the platform, one can make use of multiple programming languages like Python and Java for creating Selenium...

Salesforce Admin Interview Questions and Answers

Salesforce Admin Interview Questions and Answers

Someone who is interested in Salesforce must know that getting into the industry is the key to getting a good salary package and a better job profile. Given the complications of the platform, the interview session can be quite tough. You need to be prepared well in...