Selenium Interview Questions for Freshers

1. What is Selenium?

Selenium is a widely used tool for testing web-based applications that checks if they are doing as expected. It is a prominent preference amongst testers for cross-browser testing and is viewed as one of the most reliable systems for web application automation evaluation.

Selenium is also platform-independent, so it can provide distributed testing using the Selenium Network. Selenium is a powerful tool for controlling web browsers through programs and performing browser automation. It is functional for all browsers, works on all major OS and its scripts are written in various languages.

Selenium Features

2. What are the Selenium suite components?

Here are four major Components of Selenium

Components of Selenium

1. Selenium IDE

Selenium IDE serves as an innovative toolkit for web testing, allowing users to record interactions with web applications. Selenium-IDE was initially created by “Shinya Kasatani” in 2006. Selenium IDE also helps to simplify the testing process. It is a friendly space for testers and developers to team up. This helps everyone quickly share important testing information and results, making things work better and feel accomplished.

2. Selenium RC (Remote control)

Selenium Remote Control (RC) was one of the earliest Selenium tools, preceding WebDriver. It allowed testers to write automated web application tests in various programming languages like Java, C#, Python, etc. The key feature of Selenium RC was its ability to interact with web browsers using a server, which acted as an intermediary between the testing code and the browser.

3. Selenium Web Driver

Selenium WebDriver is a robust open-source framework for automating web browsers, primarily aimed at easing the testing and verification of web applications. As an important part of the Selenium suite, WebDriver offers a programming interface to interact with web browsers, allowing developers and testers to automate browser actions seamlessly.

4. Selenium GRID

Selenium Grid is a server that allows tests to use web browser instances running on remote machines. With Selenium Grid, one server acts as the hub. Tests contact the hub to obtain access to browser instances.

3. Mention the advantages of using Selenium as an automation tool.

Selenium mainly used among the automation tools due to its unique benefits, including with being the open-source framework, it will be supporting multiple languages and platforms, and offering easy compatibility with the various browsers, providing flexible frameworks for many more use of the same, It will benefit in enabling reusability, and improving the integrated and parallel test execution.

4. What is test automation or automation testing?

Automated Testing means using special software for tasks that people usually do when checking and testing a software product. Nowadays, many software projects use automation testing from start to end, especially in agile and DevOps methods

5. What are the advantages of automation testing?

  • Simplifies Test Case Execution: Automation testing can be left virtually unattended and thus it allows monitoring of the results at the end of the process. Thus, simplifying the overall test execution and increasing the efficiency of the application. 
  • Improves Reliability of Tests: Automation testing ensures that there is equal focus on all the areas of the testing, thus ensuring the best quality end product. 
  • Increases amount of test coverage: Using automation testing, more test cases can be created and executed for the application under test. Thus, resulting in higher test coverage and the detection of more bugs. This allows for the testing of more complex applications and more features can be tested. 
  • Minimizing Human Interaction: In automation testing, everything is automated from test case creation to execution thus there are no changes for human error due to neglect. This reduces the necessity for fixing glitches in the post-release phase. 
  • Saves Time and Money: The initial investment for automation testing is on the higher side but it is cost-efficient and time-efficient in the long run. This is due to the reduction in the amount of time required for test case creation and execution which contributes to the high quality of work.
  • Earlier detection of defects:  Automation testing documents the defects, thus making it easier for the development team to fix the defect and give a faster output. The earlier the defect is identified, the more easier and cost-efficient it is to fix the defects.

6. What is Selenese? How is it classified?

Selenese are the sets of commands that are used in Selenium ide to perform various operations on the web. It is majorly used to develop coding scripts in Selenium IDE. The element locator helps Selenium to decide which HTML element a command will refer to. 

Selenium commands

  • Actions: Actions are selenium IDE commands that control the status of an application.
  • Accessors: Accessors are the selenium commands that are used to check the state of the application and store the result in a variable.
  • Assertions: Assertions are the selenium commands that enable the testers to check/verify the status of an application.

7. What is the difference between Selenium 2.0 and Selenium 3.0? 

Selenium 2.0 streamlined creating automated tests for web applications by combining the original Selenium project with the WebDriver project. While Selenium Remote Control (RC) became outdated after the merge, it was still supported for a while to ensure existing tests wouldn’t break.

Selenium 2.0

Building upon Selenium 2.0, Selenium 3.0 brought a range of improvements. It seamlessly worked with older tests while completely removing reliance on Selenium RC. This new version also squashed bugs and made everything more reliable.

Selenium 3

In short, Selenium 3.0 took the strengths of Selenium 2.0, fixed its issues, and made it even better for automating web tests.

8. What are the testing types supported by Selenium? 

Selenium is a powerful tool for automated web application testing, supporting various testing types to ensure the quality and functionality of your web applications.

Selenium supports the Regression testing and Functional testing and the following key insight of the same. 

Regression testing – Regression Testing is the process of testing the modified parts of the code and the parts that might get affected due to the modifications to ensure that no new errors have been introduced in the software after the modifications have been made. 

The step involve in the Regression testing which are:

  • Identify relevant test cases from existing suites.
  • Prioritize test cases based on criticality and priority.
  • Execute selected test cases to detect regressions.
  • Analyze the test results for failures.
  • Report identified defects in bug tracking system.
  • Maintain regression test suites as needed.
  • Automate regression tests for efficiency.
  • Repeat regression testing after each software update.

Functional testing: Functional testing is defined as a type of testing that verifies that each function of the software application works in conformance with the requirement and specification. 

The step involve in the Functional testing which are:

  1. Identify test input: This step involves identifying the functionality that needs to be tested. This can vary from testing the usability functions, and main functions to error conditions. 
  2. Compute expected outcomes: Create input data based on the specifications of the function and determine the output based on these specifications.
  3. Execute test cases: This step involves executing the designed test cases and recording the output.
  4. Compare the actual and expected output:  In this step, the actual output obtained after executing the test cases is compared with the expected output to determine the amount of deviation in the results.

9. What are the different types of annotations which are used in Selenium?

These are the types of TestNG Annotations

  1. @BeforeSuite – Is executed before the execution of all the test cases inside a TestNG Suite. This annotation allows developers to specify various actions to be taken before the execution of all the test cases inside a TestNG Suite.
  2. @AfterSuite – This annotation allows developers to specify various actions to be taken after the execution of all the test cases inside a TestNG Suite.
  3. @BeforeTest – This annotation allows developers to specify various actions to be taken before the execution of all the @test annotated methods inside a TestNG Suite.
  4. @AfterTest – This annotation allows developers to specify various actions to be taken after the execution of all the @test annotated methods inside a TestNG Suite.
  5. @BeforeClass – This annotation allows developers to specify various actions to be taken before all the methods of the current class start their execution.
  6. @AfterClass – This annotation allows developers to specify various actions to be taken after all the methods of the current class finish their execution.
  7. @BeforeMethod – This annotation allows developers to specify various actions to be taken before test methods are run.
  8. @AfterMethod –  This annotation allows developers to specify various actions to be taken after test methods are run.
  9. @BeforeGroups – This annotation allows developers to specify various actions to be taken before all the methods of the current group within a class finish their execution.
  10. @AfterGroups – This annotation allows developers to specify various actions to be taken after all the test methods belonging to a specified group have been run.

10. What are the types of Web locating strategies?

Here are the 7 locating strategies:

Locating By IDId is a locator which is present under the By class. Id locator which is unique for every element in the DOM page that’s why an ID can uniquely identify an element.

Syntax:

element=driver.find_element(By.ID, “element_id”)

Locating By Class NameThe class attribute is one of the most commonly used in attribute in HTML .The class attribute allows multiple elements on a webpage to share a common styling. While classes can be shares with other elements , each element class value should be unique within its scope.

Syntax:

element=driver.find_element(By.CLASS_NAME, “element_class_name”)

Locating By Name – The name attribute of an HTML element is an identifier like a label . Unlike id ,class the name attribute doesn’t necessarily unique within a web page. They are often used for naming form elements and is used in HTML forms to handle form controls such as input fields , radio button etc. 

Syntax:

element=driver.find_element(By.NAME, “element_name”)

Locating By Tag NameEvery element in HTML document is identified by a TAG NAME. Tag Name are used to define the purpose and type of an element in a webpage.

Syntax:

element=driver.find_element(By.TAG_NAME, “element_tag_name”)

Locating By CSS Selector – CSS Selectors are the patterns that used to select and style HTML elements in web development. CSS selectors allows us to target elements in a web page by their attributes ,position and hierarchy on a web page.

Syntax:

driver.find_element(By.CSS_SELECTOR, “element_css_selector”)

XPath (XML Path Language) is a powerful and one of the best locating strategy in Selenium for identifying elements on a web page. XPath is a language used for navigating and querying XML documents but its widely used in web scrapping and automation.

Syntax-

element=driver.find_element(By.XPATH, “element_xpath”)

Locating By Link Text And Partial Link TextLink Texts as the name suggests are primarily used to locate anchor tags ‘<a>’ elements on a webpage . Anchor tags are primarily used for hyperlinks (those which navigate us to different page or resource on a website).

Syntax:

element = driver.find_element(By.LINK_TEXT, “element_link_text”)

11. What are the types of waits supported by WebDriver?

Selenium WebDriver provides three types of waits

Types of Waits

  • Implicit Waits – An implicit wait tells WebDriver to poll the DOM for a certain amount of time when trying to find any element (or elements) not immediately available. 
  • Explicit Waits – Explicit wait allows you to wait for a certain condition to be met before proceeding with the next steps in the test script. Unlike implicit wait, direct wait waits for a certain condition to be fulfilled within a certain time This is only used for certain elements where a condition is expected. 
  • Fluent Wait – Fluent Expectation is an enhancement to Explicit A wait that provides wait conditions over more flexibility and control. It is also known as Fluent Wait. It allows you to specify the maximum time to wait for a condition and the frequency of checking the condition.

12. Mention the types of navigation commands

The Navigation Command provides four methods: to(), back(), forward(), and refresh(). These methods allow the WebDriver to perform the following operations:

  1. to() Command: Loads a new web page in the current browser window. It accepts a string parameter that specifies the URL of the web page to be loaded.
  2. back() Command: Moves back one step in the browser’s history stack. It does not accept any parameters and does not return anything.
  3. forward() Command: Moves forward one step in the browser’s history stack. It does not accept any parameters and does not return anything.
  4. refresh() Command: Reloads the current web page in the browser window. It does not accept any parameters and does not return anything.

13. What is the Difference Between driver.close() and driver.quit() Commands.

Parameters

driver.close()

driver.quit()

Execution Scope

Window/Tab-specific

Session-specific

Effect on WebDriver Session

Doesn’t terminate

Terminates along with windows

Resource Release

Closes a specific window/tab in focus

Terminates WebDriver and associated windows/tabs

Effect on Active Window/Tab

Closes the active window/tab

Closes the active window/tab

Impact on Multiple Windows/Tabs

Doesn’t affect

Closes all windows/tabs

14. Differentiate Between Manual Testing and Automated Testing.

ParametersManual TestingAutomation Testing
DefinitionIn manual testing, the test cases are executed by the human tester.In automated testing, the test cases are executed by the software tools.
Processing Time Manual testing is time-consuming.Automation testing is faster than manual testing.
Resources requirementManual testing takes up human resources.Automation testing takes up automation tools and trained employees.
Exploratory testingExploratory testing is possible in manual testing.Exploratory testing is not possible in automation testing.
Framework requirementManual testing doesn’t use frameworks.Automation testing uses frameworks like Data Drive,

15. What is an Absolute XPath and Relative XPath?

Absolute XPath

  • An XPath Absolute Path is like giving the full address to find a specific location in an XML document.
  • It begins from the root (main) node or starts with a ‘/’ symbol.
  • To create an absolute path, you list every parent node in the hierarchy until you reach the desired node.
  • It’s like providing the complete route to get to a particular point in the XML structure.

Relative XPath

  • A relative path in XPath is like giving directions from your current location to a specific place without starting from the very beginning.
  • You don’t have to describe the whole journey from the starting point; instead, you begin from where you currently are.
  • This makes it simpler to find and pinpoint things in an XML document without having to spell out the entire path from the root.

Selenium Interview Questions and Answers

Selenium is an open-source automation testing tool primarily used for testing web applications. It allows testers to automate browser actions such as navigating through web pages, clicking buttons, entering text, and validating expected outcomes. Selenium provides a suite of tools and libraries that cater to different aspects of automated web testing. It offers a robust framework for testing web applications across different browsers and platforms.

Here, we’ve compiled over Top Selenium Interview Questions and Answers, curated for both Freshers and experienced professionals across various experience levels, including 3, 5, and 8 years. Our list of Selenium Interview Questions is here to help you in your next Interview.

Selenium Interview Questions 2024

Table of Content

  • Selenium Interview Questions for Freshers
  • Intermediate Selenium Interview Questions
  • Selenium Interview Questions for Experienced

Similar Reads

Selenium Interview Questions for Freshers

1. What is Selenium?...

Intermediate Selenium Interview Questions

Explore this section to get a hand on Selenium Interview Questions for Intermediate....

Selenium Interview Questions for Experienced

31. What are the limitations of Selenium testing?...

Conclusion

As we come to the end, you’ve got a bunch of Selenium interview questions and answers to help you nail your next automation testing interview. We covered everything from the basics to more advanced stuff, so you’re well-prepped....