Nov

Selenium Interview Questions
- Yogesh Sinha
- 08th Nov, 2022
- 694 Followers
Selenium Interview Questions
Selenium is a software–testing tool that is mainly used for web applications. Many organization prefers Selenium over others because of its flawless user experience. Some of the other benefits of Selenium include its flexibility and the wide range of programming languages and operating systems that can be incorporated with its use. Therefore, the use of the Selenium tool has increased the high level of job opportunities.
Organizations are in search of candidates who have well-versed knowledge and experience with this tool and can help in the progress of the organization. In order to succeed in this field, it is very important to have excellent interpersonal abilities along with good technical skills. Having a good knowledge of different programming languages such as Java, and C# also gives one an added advantage. In order to find the right candidate companies ask a diverse range of Selenium interview questions to not only freshers but also experienced individuals wishing to make a great career in this field. Finally, practice here 80+ Best Selenium Interview Questions and Answers for freshers & Experienced candidates that will not only give you a basic idea of the field but also help to clear the interview.
Selenium Tricky Interview Questions
1) Enlist major components of Selenium?
Selenium is consists of four major components that are Selenium IDE, Selenium RC, Selenium Web driver, Selenium GRID.
2) What are the advantages of Selenium?
The advantages of Selenium are:
- Language and Framework Support
- Open Source Availability
- Multi-Browser Support
- Support Across Various Operating Systems
- Ease Of Implementation
- Reusability and Integrations
3) List some programming languages supported by Selenium to write test cases?
Some of the programming languages supported by Selenium to write test cases are C#, Groovy, Java, Perl, PHP, Python, Ruby, and Scala.
4) What is Selenium WebDriver?
Selenium WebDriver is a collection of open-source APIs which are used to automate the testing of a web application. Basically, it is a tool used to automate web application testing to verify that it works as expected.
5) What is Automation Testing?
Automation Testing is the process of performing software testing activities that are done fully automated which means with little or no human interaction, in order to achieve greater speed and efficiency.
6) What are locators in Selenium? List different types of locators in Selenium?
In selenium, Locators provide a way to access the HTML elements from a web page. Some of the different locators in Selenium are:
- By CSS ID: find_element_by_id.
- By CSS class name: find_element_by_class_name.
- By name attribute: find_element_by_name.
- By DOM structure or xpath: find_element_by_xpath.
- By link text: find_element_by_link_text.
- By partial link text: find_element_by_partial_link_text.
7) Write an syntax to launch the browser using WebDriver?
The syntax to launch the browser using WebDriver are:
- // System Property for Chrome Driver.
- System. setProperty("webdriver. chrome. driver","D:\\ChromeDriver\\chromedriver.exe");
- // Instantiate a ChromeDriver class.
- WebDriver driver=new ChromeDriver();
8) List various types of Drivers and Waits available in Selenium WebDriver?
You can exclude URIs by defining their routes outside of the web middleware group that is included in the default routes.php file, or by adding the URIs to the $except property of the VerifyCsrfToken middleware.
9) What is JUnit? List various JUnit annotations.
A JUnit test is a method contained in a class that is only used for testing. Various types of JUnit annotations are:
- @DisplayName
- @BeforeEach
- @AfterEach
- @BeforeAll
- @AfterAll
- @Tag
10) List types of test supported by Selenium?
The types of test supported by Selenium are:
- Acceptance testing.
- Functional testing.
- Performance testing.
- Regression testing.
- Test driven development (TDD)
- Behavior-driven development (BDD)
11) What is the use of X-path?
XPath or XML Path Language that is used to provide a flexible way of addressing different parts of an XML document by using a non-XML syntax.
12) What is an Object Repository ?
An object repository is a collection of objects and properties that means basically it is a centralized storage of locators in the form of objects.
13) What is heightened privileges browsers?
The heightened privileges allow website to peform certain task which are not commonly permitted in simillar way as proxy injection.
14) What is Selenese?
Selenese is the language used to write Selenium Commands to test web applications. It is used to test the broken links, the existence of some object on the UI, Ajax functionality, Alerts, window, list options. It helps Selenium to understand what actions or operations to perform.
15) What is the difference between "/" and "//" in Xpath?
'/' in XPath signifies looking for the element immediately inside its parent element. Whereas '//' signifies to look for any child or any descendant element inside the parent element.
16) List different types of navigation commands available in Selenium?
The different types of navigation commands available in Selenium are:
- Navigate To Command - to(String arg0) : void
- Forward Command - to(String arg0) : void
- Back Command - back() : void
- Refresh Command - refresh() : void
17) What is use of driver.close() and driver.quit command in Selenium?
driver.Close() command is used to close the current browser window. Whereas driver.Quit() command is used to destroy the instance of WebDriver.
18) How to assert the title of the web page in WebDriver?
To assert the title of the web page in WebDriver you can follow the given steps:
- Import Assert class in the import section: `import org.testng.Assert;`
- Create a WebDriver object: WebDriver driver=new FirefoxDriver();
- Apply this to assert the title of the page:
19) Explain what is TestNG?
TestNG or Test Next Generation is an automation testing framework in selenium. TestNG is an open source framework which is inspired from the Java platform (JUnit) and NET platform (NUnit).It is designed with new functionality that makes this framework more powerful and easier as it covers all the categories of tests comprising unit, functional and integration.
20) What is Datadriven and Keyword driven framework?
In a Data-Driven framework you only need to plan for what test data and test scripts are needed such that we can run our tests on multiple data in multiple combinations with the help of parameterization. Whereas in Keyword Driven framework you need to plan for keywords and their implementations along with test data and test scripts such that the keywords that are developed represent an action.
21) What is Silk Test Tool?
Silk Test is a tool for automated function and regression testing of enterprise applications snd you can record user sessions with your applications to create tests, enhance the test by adding verifications and test logic, and play back tests to ensure that the applications work as expected.
22) How to insert a break point in Selenium IDE ?
You can insert a breakpoint in Selenium IDE by following the given steps:
- Right-click on the command in Selenium IDE and select “Toggle Break Point”.
- Select the command in Selenium IDE and press the “B” key on the keyboard.
- If you want to clear the breakpoint once again press the “B” key on the keyboard.
23) What is selenium RC?
Selenium RC is a testing framework of the Selenium test suite that injects JavaScript function into browsers when the web page is loaded. While the Web driver makes direct talks to the browser using the browser's built-in support. The RC server binds the Selenium Core and automatically injects the script into the browser.
24) What is IntelliJ?
IntelliJ IDEA is an Integrated Development Environment or IDE for JAVA or JVM that analyzes your code, looking for connections between symbols across all project files and languages. It is an Open Source platform developed by JetBrains.
25) How to type in a textbox in selenium?
You can type in a textbox in selenium by using the sendKeys() method.
26) What are Listeners in Selenium WebDriver?
WebDriver Listeners is an interface in sellenium that modifies the default TestNG's behavior. It helps testers analyze results and debug any resulting issues.
27) Can we handle colors in Web Driver?
Yes, we can handle colors in Web Driver. You can get the color of an element by simply using the getCssValue function.
28) What are the different exceptions in Selenium WebDriver?
The different types of exceptions in Selenium WebDriver:
- NoSuchElementException.
- NoSuchWindowException.
- NoSuchFrameException.
- NoAlertPresentException.
- InvalidSelectorException.
- ElementNotVisibleException.
- ElementNotSelectableException.
- TimeoutException.
29) What is an Accessor in Selenium?
Accessors are the selenium commands that evaluate and examine the state of the application and store the results in variables that are used in assertions.
30) What is stale reference element error?
The stale element reference error is a Selenium WebDriver error that occurs because the referenced web element is no longer attached to the DOM.
31) What is parameterization in TestNG?
Parameterized tests allow developers to run the same test over and over again using different values. TestNG lets you pass parameters directly to your test methods in two different ways − With testng.xml. With Data Providers.
32) List some waitfor command in Selenium?
Some of the waits for command in Selenium are:
- verifyElementPresent/ verifyElementNotPresent.
- verifyTextPresent/ verifyTextNotPresent.
- verifyElementPositionLeft/ verifyElementPositionTop.
33) What are the different mouse-hover operations in selenium?
The different mouse-hover operations in selenium are moveToElement(WebElement target) and moveToElement(WebElement target, int xOffset, int yOffset).
34) What is Page Factory?
Page Factory is an inbuilt Page Object Model framework provided by Selenium WebDriver to support Page Object Design patterns. It is used to initialize the elements of a Page class without using FindElement or FindElements.
35) What is regression testing?
Regression testing verifies that recent code changes haven't altered or destroyed the already existing functionality of a system that means it is basically used to catch the accidentally introduced bugs and to ensure that previously eliminated defects aren`t treatable.
36) What is a Robot class?
Robot Class is a separate class in JAVA that is used in Selenium to enable automated testing for implementations of the Java platform. It is basically used to perform multiple tasks and to simulate keyboard events in Selenium.
37) What is Equivalence partitioning?
Equivalence Class Partitioning is the most common technique in Black-box Testing Techniques used for test case design, such that in Equivalence Class Partitioning the input data is divided into partitions of valid and invalid values, and it is mandatory that all partitions must exhibit the same behavior.
38) How to take screenshots in Selenium WebDriver?
You can take screenshots in Selenium WebDriver with the help of the following steps:
- Create a class. Implement TestNG 'ITestListener'.
- Call the method 'onTestFailure'.
- Add the code to take a screenshot with this method.
- Get the Test method name and take a screenshot with the test name.
- Now, place it in the desired destination folder.
39) List some commonly used Automation Testing tools for Functional Automation?
Some of the commonly used Automation Testing tools for Functional Automation are:
- Appium
- Selenium WebDriver
- Cucumber
- Testim
- SmartBear TestComplete
- IBM Rational Functional Tester (RFT)
- Kobiton
- Worksoft Certify
40) What is Selenium Grid?
Selenium Grid is a smart proxy server that is used to run tests in parallel on multiple machines such that you can create a simple infrastructure of various browsers on different operating systems for distributing test load and giving the user a diversity of browsers to work with.
41) Which CI tool did you use?
There are various CI or continuous integration tools such as Jenkins, TeamCity, Buddy, GitLab CI, CircleCI, Bamboo, TravisCI that one can use.
42) What is Parallel Test Execution in Selenium?
Parallel Test Execution is a type of testing process in Selenium where you can run the same tests simultaneously in different environments therefore it reduces the overall time and efforts of automated browser testing while ensuring a quality product by using a Selenium Grid.
43) List types of synchronization in selenium?
The types of synchronization present in selenium are:
Unconditional Synchronization - Examples: Wait() and Thread.Sleep();
Conditional Synchronization - A condition is specified along with the timeout value.
44) What are actions classes in selenium?
Actions class is a class that has the ability provided by Selenium for handling keyboard and mouse events. Such that it performs actions given for Selenium WebDriver.
45) How can we maximize and minimize the browser window in Selenium?
The maximum command can be used in the Java Selenium to maximize the browser window in the initial phases.
driver.manage().window().maximize(); For minimizing the browser, we can use the setPosition command and set a new point to minimize the window in the browser. driver.manage().window().setPosition(new Point(0, -1000));
46) What Evaluation can Selenium Do?
47) Just how much does Selenium License cost per Customer Device?
48) Where to obtain Selenium ?
49) What is Selenium IDE?
50) What are the limitations of Selenium IDE?
51) What exactly is Selenium Remote-Control (RC) tool?
52) What programing language is most useful for creating Selenium Evaluations?
53) When should I use Selenium IDE?
Selenium IDE is the simplest and easiest of all of the software inside the Selenium Program. Its record and playback feature make it extremely simple to understand with minimal acquaintances to any programing language. Selenium IDE is an ideal tool to get a nave person.
54) What’s Selenese?
55) What will be the different kinds of locators in Selenium?
Locator might be known as a tackle that identifies an internet component uniquely within the web page. Hence, to identify internet elements correctly and exactly we’ve got different types of locators in Selenium:
- ID
- ClassName
- Name
- TagName
- link text
- PartialLinkText
- Xpath
- CSS Selector
- DOM
56) Why should Selenium be selected as a test program?
- Selenium is free and open source
- It has a big user base and assisting communities
- Cross Browser compatibility (Firefox, chrome, Ie, Safari etc.)
- Have amazing platform compatibility (Windows, Mac OS, Linux etc.)
- Supports numerous programming languages (Java, C#, Ruby, Python, Pearl etc.)
- Has clean and regular repository developments
- Supports dispersed testing
57) What is Selenium? What are different Selenium components?
The suite package makes up of the following sets of resources:
- Selenium Integrated Development Environment (IDE) Selenium IDE is a record and playback application. It is distributed as a Firefox Plugin.
- Selenium Remote Control (RC) Selenium RC is a host that allows user to create test scripts in a desired programming language. In addition, it enables executing test scripts inside the big spectrum of browsers.
- Selenium WebDriver WebDriver is not the same instrument totally that has numerous advantages over
- Selenium RC. WebDriver immediately communicates with all the browser and uses its native compatibility to automate.
- Selenium Grid Selenium Grid is utilized to distribute your test execution on several platforms and environments concurrently.
58) What are the testing kinds that can be supported by Selenium?
- Functional Testing
- Regression Testing
59) What will be the limits of Selenium?
- Selenium supports testing of only internet based applications
- Cellular applications cannot be examined using Selenium
- Captcha and bar-code readers are unable to be analyzed using Selenium
- Reports can only be generated using third party resources like TestNG or Junit.
- As Selenium is a totally free program, so there’s no ready seller support although the user can locate numerous helping communities.
- User is anticipated to possess previous programming language information.
60) What you say in regards to the flexibility of Selenium test suite?
61) What test can Selenium do?
62) What exactly is the price of Selenium test-suite?
63) What programming languages are you able to use in Selenium RC?
64) What is difference between QTP and Selenium?
65) What’s the difference between Borland Silk evaluation and Selenium?
66) What’s new in Selenium 3.0?
Selenium Interview questions | |
Beta 1 updates | Beta 2 updates (Only for Java) |
Minimum Java version is now 8+ | System property webdriver.firefox.marionette now forces the server in marionette or legacy firefox driver mode, ignoring any related Desired Capability |
It will support for Firefox Via Mozilla’s geckodriver | Grid fixes NPE’s on registration when -browser not specified |
Support for Edge is provided by MS It now supports Safari on MacOS via Apple’s own Safari driver |
Update GeckoDriver –port argument in all bindings |
67) What is Test Automation?
Test Automation/ Automation testing is a procedure that is used for the manual testing of different applications or systems. It consists of the creation of separate test tools that can be executed repeatedly without any manual intervention.
68) List some advantages of Test Automation
Some advantages of Test Automation include:
- It saves money and time
- It helps in the execution of unattended tasks
- Helps in testing large matrixes composed of different tests
- Supports the execution of test cases that occur repeatedly
- It also helps in parallel execution of tasks
- Helps in improving accuracy thus reducing human-generated mistakes
69) What is Selenium?
Selenium is a popular automated testing tool that is designed in such a manner that it encourages and supports multiple functions in relation to automation testing. It helps a browser to mimic real user actions that are taking place on the web.
70) What are the advantages of using Selenium as a test tool?
There are a number of advantages of using Selenium as a test tool, some of which include:
- It is an open-source that is free and user-friendly.
- It has a large user base that helps different communities.
- It has a large range of browser compatibility such as Chrome, Safari, Firefox, Internet Explorer, etc.
- It supports a multitude of programming languages such as C#, Java, Python, etc.
- A number of operating systems such as Windows, Linux Mac OS, etc. can also use it.
- Distribution testing is also supported by Selenium.
- It has regular repository developments.
71) What are the limitations of using Selenium as a test tool?
The limitations of using Selenium as a test tool are:
- It does not allow the testing of Windows applications.
- It does not allow the testing of mobile applications.
- There is difficulty in the loading of pages.
- There arise problems in handling popup windows and captcha.
- It has limited reporting options.
- There can also be trouble in handling different dynamic elements.
72) What are some of the different ways to find an element using Selenium as a tool?
Every object on a web page is termed as element while using Selenium as a tool. Different methodologies to find such elements include:
- Xpath
- PartialLink Text
- Attribute
- CSS
- Tag
- Link text
- ID
- Name
73) Enlist the components of Selenium.
The different components of Selenium are:
- Selenium Integrated Development Environment (IDE) – Selenium IDE is an essential record and playback component that is primarily distributed by Firefox Plugin.
- Selenium Web driver – Selenium Web driver is a tool that helps in direct communication with the web browser.
- Selenium Grid – Selenium Grid is utilized to distribute the test that is executed on multiple platforms and different environments synchronously.
- Selenium Remote Control (RC) – Selenium RC is a service, which allows its users to create test scripts within the desired programming language and also the execution of the same with a large range of browsers.
Also, Read Selenium Web driver Interview Questions
74) Describe a framework. List some of the common automation frameworks.
A framework is a set of rules and best practices that are followed in a systematic way in order to achieve the desired outcomes. Some of the common automation frameworks available to users are:
- Hybrid Testing Framework
- Data Driven Testing Framework
- Keyword Driven Testing Framework
75) List the different testing types supported by Selenium.
Different testing types essentially supported by Selenium are:
- Regression Testing
- Functional Testing
76) Describe the purpose of XPath.
XPath is a tool used to locate different web elements that are based on the XML path. XML is an acronym for Extensible Markup Language that helps its users to organize, store and transport various random data. It stores data in value pairs that are similar to HTML tags. XPath helps users to locate different elements by transferring across the entire page and finding the element with the reference of another element.
77) List the different types of drivers available in Web Drivers.
Different types of drivers available in Web Drivers are:
- HTMLUnit Driver
- Android Driver
- iPhone Driver
- Safari Driver
- Chrome Driver
- InternetExplorer Driver
- Firefox Driver
- Opera Driver
- EventFiringWebDriver
78) What are some of the advantages of Selenium Grid?
Some of the advantages of Selenium Grid include:
- It helps in running different test cases in parallel, therefore, saving execution time.
- It helps in the testing of multiple browsers.
- It also helps in the execution of different test cases on multiple platforms.
79) List some of the programming languages that are strongly supported by Selenium WebDriver.
Some of the programming languages supported by Selenium WebDriver are:
- Java.
- C#
- PHP
- Ruby
- Python
80) List some of the operating systems that are supported by Selenium WebDriver.
Some of the operating systems supported by Selenium WebDriver are:
- MAC
- Windows
- Linux
81) Differentiate between ‘/’ and ‘//’.
‘/’ – Single Slash is utilized in order to create XPath with an absolute path. Single Slash is used to create a start selection only from the start node or document node.
‘//’ – Double Slash is utilized in order to create XPath with a relative path. Double Slash is used to create a start selection from anywhere inside the document.
82) How to find Elements in Selenium WebDriver?
There is an essential role Web elements play when an application is tested. Identifying the location of these Web elements on the website is the first thing to do. To carry out a regression test or to load data automatically on a website, selenium is used. One of the ways of finding these elements is the find element command.
The find element command identifies one Web element while find elements identify multiple Web elements on the web page. The Link Text, Tag Name, Partial Link, Class Name, XPATH, ID are some of the ways to find elements or element on a web page.
83) What is sendKeys selenium?
A sendkeys() in selenium permits QAs to enter content into a field that can be edited automatically. The automatic typing of the content into an editable field is done when any tests are executed for forms. These editable fields are easily identified on a web page by making use of locators such as name, link, id, class name, and others. Assume a case after a web developer has developed a website and the functionality of the website needs to be tested. This is where we see the works of QAs. The QAs make use of selenium WebDriver to write test scripts to repeat the actions of a user on a web browser such as google chrome.
84) What is implicitlywait in selenium?
Implicit wait in Selenium directs WebDriver to pause for a certain duration of time before throwing an exception. Once this time is estimated, WebDriver will wait for the item before the exception occurs.
Once the command is in position, Implicit Wait waits in place for the whole duration for which the browser is accessible and it is default setting is 0, and the particular wait time needs to be set by the protocol. To calculate implicit waits in test scripts, import the package, import java.util.concurrent.TimeUnit;
85) How to find an element by Class Name in Selenium?
There are distinct ways to easily locate an element in Selenium. Some of the common ways of achieving this are through Tag name, id, class name, etc. A Class Name locator offers the web element which matches or suits the specified values in the attribute name "class". The first element that has the class attribute name that matches is returned. On the other hand, if there is no Web element that has the class attribute name that matches, a NoSuchElementException is raised.
Take a look at the code below to understand better
<html> <body> <p class="content">website content moves here. </body> </html>
You can easily locate the "p" element by:
Web content = driver.find_element_by_class_name('content')
Leave A Comment :
Valid name is required.
Valid name is required.
Valid email id is required.