Top 50 Selenium Interview Questions And Answers For 2022

  • What is Selenium?
  • What are the components of the Selenium suite?
  • Why is it important to use Selenium?
  • What’s the major difference between Selenium 3.0 & Selenium 2.0?
  • What is Automation testing and what are its benefits?
  • What are the benefits of Selenium as an Automation Tool?
  • What are the drawbacks to using Selenium for testing?
  • Why should Selenium not be used as a web application or system testing tool?
  • Is it possible to use selenium to launch web browsers?
  • What does Selenese mean?
  • What does it mean to be a locator?
  • Identify the main difference between “assert”, and “verify” commands within Selenium
  • What does an exception test in Selenium mean?
  • What does XPath mean in Selenium? Describe XPath Absolute & XPath Relation
  • What is the difference in Xpath between “//”? and “/”?
  • What is the difference between “type” and the “typeAndWait” commands within Selenium?
  • Distinguish between findElement() & findElements() in context of Selenium
  • How long will Selenium wait before a website is loaded fully?
  • What is the difference between the driver.close() and driver.quit() commands in Selenium?
  • Describe the different navigation commands that Selenium supports
  • What is Selenium’s approach to the same-origin policy?
  • Explain the difference between findElement() in Selenium and findElements()
  • Explain the pause function in SeleniumIDE
  • Explain the differences between different frameworks and how they are connected to Selenium’s Robot Framework
  • What are your thoughts on the Page Object Model within the context of Selenium
  • What are your thoughts on Jenkins?
  • What are the parameters that selenium commands come with a minimum?
  • How can you tell the differences in the Absolute pathway as well as Relative Path?
  • What’s the distinction in Assert or Verify declarations within Selenium?
  • What are the points of verification that are in Selenium?
  • Define Implicit wait, Explicit wait, and Fluent
  • Can Selenium manage windows-based pop-ups?
  • What’s the definition of an Object Repository?
  • What is the main difference between obtainwindowhandle() as well as the getwindowhandles ()?
  • What are the various types of Annotations that are used in Selenium?
  • What is the main difference in the setsSpeed() or sleep() methods?
  • What is the way to retrieve the alert message?
  • How do you determine the exact location of an element on the web?
  • Why do we use Selenium RC?
  • What are the benefits or advantages of Selenium RC?
  • Do you have a list of the technical limitations when making use of Selenium RC? Selenium RC?
  • What’s the reason to utilize the TestNG together with Selenium?
  • What Language do you prefer to use to build test case sets in Selenium?
  • What are Start and Breakpoints?
  • What is the purpose of this capability relevant in relation to Selenium?
  • When do you use AutoIT?
  • Do you have a reason why you require Session management in Selenium?
  • Are you able to automatize CAPTCHA?
  • How can we launch various browsers on Selenium?
  • Why should you select Selenium rather than QTP (Quick Test Professional)?

1. What is Selenium?

  • Selenium Remote Control (RC)
  • Selenium WebDriver
  • Selenium Grid

2. What are the components of the Selenium suite?

1. Selenium Integrated Developer Environment (IDE)

2. Selenium Remote Control (RC)

3. Selenium Web driver

4. Selenium Grid

3. Why is it important to use Selenium?

  • Open-source
  • The community and users show great support.
  • Cross-browser compatibility (Firefox, Chrome, Edge, etc.,)
  • Multiple programming language support (Python, Java, Perl, etc.,)
  • Daily or weekly repository developments
  • Distributed testing is also possible.

4. What’s the major difference between Selenium 3.0 & Selenium 2.0?

5. What is Automation testing and what are its benefits?

  • It allows for both performance and functional testing of a system or application.
  • It allows for repeated testing.
  • It allows the parallel execution of test cases.
  • This reduces the need for humans to create test cases and improves the system’s accuracy and efficiency.
  • It is used for regression testing.
  • It is useful in the testing of large-scale test matrixes.
  • This saves time and money for all the testers involved in the project.

6. What are the benefits of Selenium as an Automation Tool?

  • Open Source: Selenium is a freeware and a portable tool. There are no extra costs. You can download the utility for free for the user base. Community-based assistance is also available.
  • Language assistance: Java and Perl, Python, C# Ruby, Ruby, Groovy, and JavaScript are all supported by Selenium. It is independent of any script and has no limitations. It can be used with many languages depending on the preferences of developers and testers.
  • Compatible with a variety of operating systems: Selenium can be used on a number of operating systems including Windows, Mac OS X, and Linux. Selenium Suite of Products allows you to create a customized testing suite on any platform. Then, you can execute it on another platform. You can write test cases in Windows, and then run them on Linux.
  • Browser compatibility. Selenium works with many web browsers including Internet Explorer, Chrome Firefox, Opera, Safari, Opera, Safari, Opera, Safari, Opera, Firefox, Opera, and Safari. This is very useful when you run tests and test them across multiple browsers simultaneously.
  • Framework support and programming languages: Selenium can be used with many programming languages and frameworks. It can integrate with ANT and Maven frameworks to compile source code. It can also be used to test applications and generate reports with the TestNG framework. Continuous Integration (CI) can be integrated with Hudson or Jenkins, and can also integrate with other open-source tools to provide additional functionalities.
  • Testing on various devices: For Android, iPhone, and Blackberry users, Selenium test automation can be used to automate the testing of mobile web applications. This will allow for the creation of the necessary results as well as the continual resolution of bugs in the application.
  • Selenium support is based on a community that allows for regular updates and upgrades. These upgrades are easy to install and do not require any special training. Selenium is therefore both cost-effective and resourceful.
  • Selenium Suites with lots of content: Selenium can be more than a tool or utility. It’s a complete set of many testing tools, which is why it’s called a “Suite”. Each tool can be tailored to meet specific testing requirements and test environment constraints. Selenium includes Selenium IDE and Selenium Grid as well as Selenium Remote Control (RC).
  • It’s easy to implement: Selenium offers a user-friendly interface, making it simple to create and run tests. Open-source features allow users to write their own extensions. This makes it easy to modify actions and manipulate them to a high degree. Selenium’s reporting capabilities are another reason for its popularity. They allow testers to extract data and take actions based on it.

7. What are the drawbacks to using Selenium for testing?

  • Tests web apps only: Selenium allows the testing only of web-based applications. Selenium cannot test mobile applications, Captcha, and Barcode readers unless they are integrated with third-party tools such as Appium or TestNG.
  • Selenium does not have a built-in reporting or test management facility. Selenium can only generate reports using third-party tools such as TestNG and JUnit.
  • Inability to provide reliable tech support: Selenium is an open-source tool. This means that there is no support available for users with specific issues.
  • may require knowledge of programming languages. Selenium requires some programming knowledge.

8. Why should Selenium not be used as a web application or system testing tool?

  • It is open-source and free software. There are many users and a community that supports it.
  • It supports cross-browser compatibility with multiple browsers, including Google Chrome, Mozilla Firefox, and Internet Explorer.
  • It supports many operating systems, including Windows, Linux, and macOS.
  • It allows you to use multiple programming languages, including Scala, Ruby and Python, PHP, Perl Java, Groovy, C#, and others.
  • It also supports distributed testing

9. Is it possible to use selenium to launch web browsers

  • WebDriver driver = new FirefoxDriver();
  • WebDriver driver = new ChromeDriver();
  • WebDriver driver = new InternetExplorerDriver();

10. What does Selenese mean? Describe the different types of Selenium commands.

  • Actions These commands allow you to interact directly with web applications.
  • Accessors These commands allow users to store values in a user-defined variable.
  • Assertions These allow you to compare the current state and the expected state of your application.

11. What does it mean to be a locator? Name a few types of locators found in Selenium.

  • ID
  • ClassName
  • Name
  • TagName
  • LinkText
  • PartialLinkText
  • Xpath
  • CSS Selector
  • DOM.

12. Identify the main difference between “assert”, and “verify” commands within Selenium.

  • Assert: Assert conditions that stop the execution of the tests if they are false. Otherwise, the tests would continue.
  • Verify that the condition does not stop the execution, regardless of whether it is true or false.

13. What does an exception test in Selenium mean?

14. What does XPath mean in Selenium? Describe XPath Absolute & XPath Relation.

15. What is the difference in Xpath between “//”? and “/”?

16. What is the difference between “type” and the “typeAndWait” commands within Selenium?

17. Distinguish between findElement() & findElements() in context of Selenium.

18. How long will Selenium wait before a website is loaded fully?

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

  • driver.close() closes the currently active window that the user is currently using or the window currently accessed via the web driver. The current window can be closed by this command.
  • driver.quit() Command, unlike the drivers.close() Command closes all windows that have been opened by the program.

20. Describe the different navigation commands that Selenium supports?

  • navigate().back() This command takes the user to the most recent page in the browser history.
  • navigate().forward(): This command is used for taking the user to the next web page of the browser history.
  • navigate().refresh(): Used for reloading the web components of a webpage by refreshing it.
  • navigate().to() : This command allows you to navigate to a specific URL using a new browser. As a parameter, it takes the URL to be moved to.

21. What is Selenium’s approach to the same-origin policy?

22. Explain the difference between findElement() in Selenium and findElements().

23. Explain the pause function in SeleniumIDE.

24. Explain the differences between different frameworks and how they are connected to Selenium’s Robot Framework.

  • Behavior-Driven Development Framework This framework is readable and easy to understand for Business Analysts, Developers, and Testers.
  • Data-Driven Testing FrameworkThis framework allows you to separate the test data and the test-script logic. It stores test data in an external database using key-value pairs. These keys can be used to access and populate data into test scripts.
  • Keyword-Driven Test Framework: This framework is an extension to the data-driven test framework. It not only separates test data from test-script logic but also stores a portion of test script code in an external file.
  • Library Architecture Testing Framework This type of framework breaks down common steps into functions that are part of a library and then calls those functions when needed.
  • Module Based Testing Framework: This framework breaks down each test application into multiple isolated and logically distinct modules. Each module has its own test script.
  • Hybrid Testing Framework This type of hybrid framework combines all the best features of the frameworks mentioned above.
  • The data-Driven framework generates external files like XML, CSV. Data-driven framework in selenium to separate a dataset from the actual test case.
  • Robot Framework is an open-source modular automation framework that can interact with third-party libraries and functions. Robot Framework provides a test automation runner, or an automation wrapper, to execute Selenium’s web testing library. MSTest and TestNG are popular alternatives that serve the same purpose.

25. What are your thoughts on the Page Object Model within the context of Selenium What are its benefits?

  • The Page Object Design Pattern states that user interface activities and flows must be kept separate from verification. This idea makes our code clearer and more comprehensible.
  • Another advantage is the fact that the object repository can be used independently of test cases. This allows us to reuse the same repository with different tools. Selenium can be used to combine Page Object Model and TestNG/JUnit in functional testing, and JBehave/Cucumber in acceptability testing.
  • The reusable page methods within the POM classes make code less efficient.
  • Methods are given realistic names so that they can be associated with the UI operation. After clicking the button, we will land on the homepage. The function name is ‘goto homepage()’.

26. What are your thoughts on Jenkins? What are the benefits of using Jenkins with Selenium

  • Jenkins creates a list of changes made to SVN repositories.
  • Jenkins provides permanent links to the most current build or failed build. This can be used for easy communication.
  • Jenkins is easy to install via either an executable file (exe), or a war file that can be deployed via the application server.
  • Jenkins can be configured to send the contents of the build status to an address via email.
  • Jenkins is simple to configure multiple windows in selenium.
  • Jenkins can be configured so that it will run an automated TestNg build after every SVN build.
  • Jenkins records the details of each jar, its version, and the mappings of build and number.
  • Jenkins can be configured to use plugins and other functionality that are provided by third-party plug-ins.
  • Selenium tests can be run in Jenkins every time your program is modified. If the tests pass you may deploy the software into a new environment.
  • Jenkins could execute your tests at a predetermined moment.
  • You can save both the execution history and Test Reports.
  • Jenkins lets you develop and test projects in continuous integration with Maven.

27. What are the parameters that selenium commands come with a minimum?

  • Host
  • Port Number
  • Browser
  • URL

28. How can you tell the differences in the Absolute pathway as well as Relative Path?

  • The path begins at the root node and finishes at the desired element node.
  • It begins with the single Slash (/)
  • Example: /html.body/div/td/input
  • The path can be started from any node between and ends at the element node you want to connect to.
  • It begins with an apostrophe and double slash (//)
  • Example: //input/example[@id=name]

29. What’s the distinction in Assert or Verify declarations within Selenium?

  • It is possible to determine if an element is present on the page or not.
  • The test fails, and it is ended when there is a failure of the test. The program control flow ceases.
  • It’s only about stating the condition that is true or not.
  • The program control flow will not cease due to this.

30. What are the points of verification that are in Selenium?

  • Selenium IDE: Check and apply commands
  • Selenium Web Driver It does not provide built-in features to assist with verification, and it is dependent on the style of coding we use. A few examples include looking up the page’s title or specific texts on the page, or checking for specific elements like dropdown, textbox field, and so on.,

31. Define Implicit wait, Explicit wait, and Fluent

  • Implicit Wait:
  • Explicate Wait:
  • Fluent Wait:

32. Can Selenium manage windows-based pop-ups?

33. What’s the definition of an Object Repository and explain how we can build the Object Repository within Selenium?

34. What is the main difference between obtainwindowhandle() as well as the getwindowhandles ()?

35. What are the various types of Annotations that are used in Selenium?

36. What is the main difference in the setsSpeed() or sleep() methods?

37. What is the way to retrieve the alert message? the box alert or alert box be found?

38. How do you determine the exact location of an element on the web?

39. Why do we use Selenium RC?

  • Selenium IDE has the limitations of selenium that Selenium RC can diminish in terms of browser support as well as language support.
  • IDE is not able to provide many functions such as logging, iterations and tests, conditional statements reports on results, and so on. It does not support HTML Language.
  • This is why Selenium RC is used to communicate with other languages such as Perl, Python, etc.,

40. What are the benefits or advantages of Selenium RC?

  • The data can read write to or .xlsx, .csv, .txt etc.,
  • Dynamic objects, as well as Ajax-related UI elements, are able to be handled.
  • Iterations and conditional statements are a great way to improve performance and flexibility.
  • Support for all programming languages and operating systems.
  • Selenium can be used with any browser that is compatible with Javascript.

41. Do you have a list of the technical limitations when making use of Selenium RC? Selenium RC?

  • Same-origin policy
  • Anything that is not in the browser’s scope is also restricted to the execution of the test scenario.

42. What’s the reason to utilize the TestNG together with Selenium What is the reason to use RC with Selenium?

43. What Language do you prefer to use to build test case sets in Selenium?

  • Java programs run slower than Python software.
  • The way to implement and the level of complexity are different, but Python is a great choice.
  • Python can be dynamically typed, whereas Java can be statically typed.
  • Java isn’t as simple or easy to write test cases in comparison to Python.

44. What are Start and Breakpoints? in Selenium?

  • Breakpoints
  • Starting points

45. What is the purpose of this capability? relevant in relation to Selenium?

46. When do you use AutoIT?

47. Do you have a reason why you require Session management in Selenium?

48. Are you able to automatize CAPTCHA?

49. How can we launch various browsers on Selenium?

  • A driver instance needs to be developed for a specific browser that we have to work on.
  • WebDriver driver = new FireFoxDriver();
  • WebDriver driver = new ChromeDriver();
  • The selenium WebDriver is the user interface through which the Firefox Chrome, Firefox, and another driver for browsers implementations are created.
  • Not compatible to test Desktop applications.
  • WebDriver’s Select class’s values of the dropdown can be selected by this.

50. Why should you select Selenium rather than QTP (Quick Test Professional)?

Summing up…

  1. Difference Between Scripting And Programming Language | Why Scripting Language Is Considered A Programming Language But Not Vice-Versa?
  2. An Overview Of The Assembly Language
  3. What Is C Programming? Know The History, Basics, And Importance
  4. Encryption Vs. Decryption | Know How Your Data Is Protected On Internet

--

--

Unstop (formerly Dare2Compete) enables companies to engage with candidates in the most interactive way to discover, assess, and hire the best talent.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store