Selenium Interview Questions

Selenium Interview Questions: Selenium is a popular open-source automation testing tool for testing web applications across different browsers and platforms. It offers a wide range of features and capabilities, making it a go-to choice for many software testing professionals. As Selenium’s popularity grows, so does the need for experienced selenium testers.

To ensure that you have the necessary skills and knowledge to excel in a Selenium testing role, it’s crucial to prepare for interviews by reviewing commonly asked Selenium interview questions. This way, you can demonstrate your expertise and stand out from other candidates in the highly competitive job market. This article will provide an overview of some of the most commonly asked Selenium interview questions and offer insights into how best to answer them.

Selenium Interview Questions

Here we are to share some of the top Selenium interview questions, which will help you extend your knowledge of Selenium. As you can see, where you are trying to cover most asked Selenium interview questions in an interview point, it should be better if you decide to answer all of these Selenium interview questions.

  • Difference between maven test and install
  • In your framework, what is called first
  • Drop down handling
  • Maven cycle
  • What happens when we call MVN clean
  • TestNG parallel
  • TestNG priority
  • Data provider working
  • Working on ArrayList
  • What is the use of Thread count?
  • If I have not provided an XML suit file in surefire, then what kind of exception will it throw
  • Stale element exception
  • Invalid argument exception
  • Difference between no such element found exception and Stale element exception.
  • What kind of exception have you faced in selenium?
  • What is automation testing?
  • What are the types of automation testing?
  • What’s the difference between manual testing and automated testing?
  • When is a good time to automate a test?
  • When will you avoid automated testing?
  • How do you choose a tool/framework for automated testing?
  • What are the different parts of a test automation framework?
  • Should you automate all testing?
  • What is a test environment?
  • What is browser automation?
  • What is cross-browser testing?
  • Why do you need cross-browser testing?
  • What is automated regression testing?
  • What are some of the best practices in test automation?
  • What is the test automation pyramid?
  • Is automated testing making manual testing obsolete?
  • Who should be responsible for test automation? Developers or the QA?
  • What is Selenium? What are its pros and cons?
  • What are the different components of Selenium?
  • What is UI testing?
  • What is Protractor?
  • What is a test automation platform?
  • What are some of the alternatives to Selenium?
  • What is the Robot framework? Provide a brief overview of its architecture.
  • What are the test library APIs provided by the Robot Framework?
  • How will you automate the basic login in a web application?
  • What are some risks associated with automated testing?
  • What are the different phases in an automation testing life cycle?
  • What is CAPTCHA?
  • How do you automate the testing of CAPTCHA?
  • What are some development practices to follow when writing automated tests?
  • When selecting an automation tool, what features will you look for

Selenium Advanced Interview Questions

  • Actions in Selenium
  • Write positive and negative scenarios for Alerts
  • The syntax for Windows handler
  • Find odd number
  • Disadvantages of Selenium
  • Diff between get() and navigate().to()
  • Dynamic Table with the check box
  • Write the code for the Screenshot
  • Explain Maps in Java
  • Explain your project framework
  • What is Pom.xml
  • Tell the correct Xpath
  • Xpath methods
  • Explain the CSS selector
  • How to identify dynamic images
  • Print only integers from strings
  • Remove duplicates from ArrayList.
  • Print the frame names
  • How to read from XML or CSV file and store in hashmap
  • Get the value of a cell in the Dynamic table.
  • Burndown chart(Agile)
  • Print these characters from a given string and change them to uppercase.
  • Access specifiers in Java
  • Difference between Priority and Severity
  • Example for High Priority and Low Severity and vice versa
  • Difference between Test Strategy and Test Scenario
  • What are Software Metrics
  • How to handle Dynamic Elements, since the webpage is designed in Angular Js
  • Implicit and Explicit Waits
  • Cross Browser Testing
  • Method Overloading and Method Overriding
  • Static Method
  • Dependencies in Pom.xml
  • Write code for fetching data from Excel
  • Select Statement
  • Assert and Verify
  • Check if a string is Palindrome or not.
  • Remove duplicate characters from a string and print
  • Which Code Repository are you using(Ex: GitHub)
  • How will you estimate the time to automate a scenario
  • Right Click
  • In a dynamic Table, if I give one cell value, it should give me the values of other cells in that row.
  • Have you developed any Tools? If yes, explain
  • Frames
  • Read from a text file and store it in HashMap.
  • Print the occurrence of a character if it is present more than once in a string.
  • Write code for nested drop-down, and You have to check all the values in the dropdown.
  • Advantages of Selenium
  • Try Catch
  • How to check if a checkbox is displayed
  • What all exceptions have you faced
  • What all difficulties have you faced in Selenium
  • What all TestNG Annotations used in the project
  • Where will you maintain the code?
  • What are Explicit wait and Implicit wait?
  • What is a headless browser?
  • How to get a screenshot in Selenium? Can you write the syntax?
  • What are the different types of Locators in Selenium?
  • What is the best way to locate a web element without a unique XPath?
  • What is StaleElementReference Exception? Have you ever encountered it, and how do you handle it?
  • Do you run test cases in parallel with TestNG? If yes, how many threads, and does it cause any problems?
  • What is the most common locator you use in your project?
  • Have you ever done the profiling of a web page?
  • How frequently do you use Thread.Sleep()?
  • Suppose there are two elements on a web page with the same ids. How will you handle it?
  • Can we create an object for an interface?
  • What is the difference between @BeforeTest and @BeforeMethod in TestNG?
  • How does Selenium interact with the Web browser?
  • Can you make the constructor of a class static?
  • How do you maintain your test scripts, and how frequently do you modify them?
  • How to find all broken links on a webpage?
  • Explain your Automation Framework.
  • Write a dynamic XPath to locate a table’s 2nd-row 3rd-column data.
  • Hash map vs. Hash table.
  • What is the significance of a hash table?
  • What is the return type of findElements?
  • What’s the difference between a Maven project and a Java project?
  • Getwindowhandle vs Getwindowhandles and the return types.
  • Comparable vs comparator.
  • Explain the project along with how the Automation was done.
  • How to upload a file in Selenium?
  • How to upload a file without using Sendkeys?
  • How to connect to a Database using Selenium?
  • Any idea or experience with the Continuous Integration tool?
  • How to handle a drop-down in Selenium?
  • What is WebDriver – interface?
  • Why do we need Interface in a test?
  • How to integrate your test with Jenkins?
  • Any example or practical usage of Run time polymorphism?
  • How to find dynamic elements?
  • What is the difference between CSS selector and XPath? Which is better from a performance perspective?
  • Difference between Instantiate and Initialize in Java.
  • What is meant by fluent wait?
  • What kind of framework have you made?
  • What’s TestNG Listener Class & why do we use it?
  • Any idea about Selenium Grid? Or Parallel execution.
  • What are the challenges you face when running automation scripts?
  • Difference between == and =.
  • What’s Page Factory?
  • How do you click a button without using click() and CSS & XPath selectors?
  • Are multiple inheritances possible in Java? Why?
  • Are all methods in an abstract class abstract?
  • Can we make an Object of Abstract class or an Interface?
  • What’s the difference between method overloading and overriding?
  • What’s the use of the Java Static keyword?
  • Different types of polymorphism.
  • Can we write webdriver dr = new webdriver();
  • What are the different plugins used for Maven? And its use?
  • What is the difference between Abstract and Interface?
  • Try, Throw & Catch syntax. And why is it used?
  • How do you manage to re-run only failed test cases?
  • How to make TestNG.xml at run-time?
  • What’s Singleton’s class?
  • Can we have the Finally block without Try & catch blocks?
  • Use of Super and This keyword in Java.
  • What’s Data binding?
  • What’s the difference between Final, Finally, and Finalize?
  • What is the difference between Absolute and Relative XPath? Which is faster?
  • How to execute the Java program from the command prompt?
  • What is Continuous Integration?
  • What is the return type of DataProvider?
  • What’s Maven’s Life cycle?
  • What’s the difference between plug-ins and dependencies?
  • How to make a class immutable?
  • What do you mean by automation testing or test automation?
  • Are there any benefits of automation testing over manual testing?
  • Selenium is a single testing tool, then why it is taken as a suite by professionals?
  • What are selenium supporting testing types?
  • Are there any drawbacks of selenium testing tool?
  • What do you understand by the term “Selenese”?
  • How to identify web elements in Selenium?
  • Explain the meaning of XPath in Selenium?
  • How to count a number of elements on a page?
  • Can you name the popular selenium tool used by large industries worldwide?
  • Explain about the waiting methods in selenium Web Driver?
  • Where the implicit waiting method and explicit it waiting method can be used in your script?
  • Is there any technique to check either button is enabled on the page or not?
  • Is there any technique to check either particular element is visible on the page or not?
  • Name the different type of drivers available in Web Driver?
  • Name the different type of mobile testing drivers supported in Web Driver?
  • Name the programming languages that are used by Web Driver to write the test cases?
  • Do you know the difference between assert commands and verifying commands in Selenium Web Driver?
  • Explain the difference between”/” and “//”in XPath Selenium Web Driver?
  • Name the different type of annotations used in Selenium WebDriver?
  • Which selenium technology is useful for distributed data processing?
  • How will you check result of text execution in Selenium IDE?
  • How can you modify test cases in Selenium IDE?
  • Explain the significance of JUnit in Selenium testing tool?
  • How to add meta-data in JUnit selenium testing tool?
  • How will you explain the difference between quit () and close () methods in Selenium?
  • Why was the concept of waiting method introduced in Selenium? Name the type of waits in Selenium?
  • Is there any drawback of implementing implicit waits in Selenium?
  • Why Selenium tools fail sometimes?
  • Name the four parameters that have to be passed in Selenium?
  • How to handle an Authentication Pop-up using Selenium WebDriver?
  • The Selenium script runs in Chrome but not in IE. What can be done?
  • What is the difference between ChromeOptions and Desired Capabilities?
  • Is it possible to do responsive web design testing using Selenium?
  • What is the need of database automation testing? Is it possible to perform database testing with Selenium?
  • Why are assertions important in Selenium? What are different types of assertions?
  • What is a data-driven framework? How does data Provider help in data driven testing

Latest Selenium Interview Questions

  • Give an example of abstraction(writing program)
  • How many test cases have you written and automated?
  • What are the challenges you met while automating?
  • How will you handle the drop-down list?
  • How will you Download the popup?
  • What are the different browsers you have used
  • What are the settings to be done for IE chrome and Firefox browsers?
  • What’s Overloading and overriding n difference
  • How do you use selenium IDE
  • Three versions of selenium n drawbacks
  • In Eclipse, while automating how will b the file structure of your scripts
  • Explain your selenium profile
  • What is the difference between a data-driven and hybrid framework?
  • What is a hybrid framework?
  • Which framework have you used in your project?
  • Where do you add a test case?
  • What is // and /slash?
  • What are the challenges you have faced in your project?
  • What is XPath
  • Which selenium version is your working
  • How do you find the XPath
  • What is a regular expression?
  • How do you connect the database through selenium?
  • How do you connect the database through java?
  • Difference between verify and assert
  • Tell me about yourself
  • What is SDLC
  • Explain selenium architecture in your company
  • What is Selenium IDE
  • What is Selenium RC
  • What is Selenium Webdriver
  • Difference between RC and Webdriver
  • Write a program to reverse a string in java
  • Write an SQL query to list the first ten rows in two columns empname and salary.
  • What is Bug lifecycle?
  • What is the final method in java?
  • How do you call a function in java?
  • What kind of framework do you use?
  • What is JUnit, and how do you read data from Xls
  • Have you used TestNG?
  • How do you work on selenium?
  • How do you handle popups?
  • How do you handle the HTTPS website in selenium?
  • What is agile
  • What is sprint
  • How do you get the requirements?
  • How do you write functional test cases based on requirements?
  • How do you start a selenium server?
  • How do you download and use selenium?
  • What problems did you face with selenium?
  • How do you identify an element in Xpath?
  • What is the use of Xpath?
  • How much do you rate yourself in Java and SQL?
  • The aptitude test booklet consisted of 15 pages and 29 questions, and the few questions had five sub-questions, and the time limit was 1 hour.
  • Different types of locators?
  • Selenium Framework that you are using in your current project?
  • How do you identify the Xpath of an element on your browser?
  • Selenium function used for retrieving the attribute or value?
  • How do you differentiate checkboxes if multiple checkboxes exist in your application?
  • What is the difference between Assert and Verify?
  • Explain SDLC & STLC.
  • What is the alternate way to click on the login button?
  • How do you verify if the checkbox/radio is checked or not
  • How do you get the href of a link / get the source of an image?
  • Count the number of links on a page
  • How to check all checkboxes on a page.
  • What is the output of the below code? driver.findElements(By.tagName(“img”));
  • How do you handle browser popups?
  • How do you handle elements present inside the frame?
  • How do you handle the Javascript alert/confirmation popups?
  • How do you launch the IE/chrome browser?
  • How to perform right-click using WebDriver?
  • How do we perform drag and drop using WebDriver?
  • How to send ENTER/TAB keys in WebDriver?
  • Example of method overload in WebDriver
  • How do you upload a file?
  • How do you click on a menu item in a drop-down menu?
  • How do you work with a page onload authentication popup/windows-based popup?
  • How do you simulate the browser back and forward?
  • How do you get the current page URL?
  • What is an XPath?
  • What is the difference between ‘/’ and ‘//.’
  • What is the difference between findElement and findElements?
  • How do you achieve synchronization in WebDriver?
  • Explain implicit and explicit wait.
  • How do you handle untrusted certificates?
  • Write the code for Reading and Writing to Excel through Selenium
  • How do you get the typed text from a textbox?
  • What are the different exceptions you get when working with WebDriver?
    InvalidSwitchToTargetException [The frame or window target to be switched doesn’t exist.]
    NoSuchElementException
    NoSuchFrameException
    TimeoutException
    SessionNotFoundException
  • What is the current WebDriver version?
  • What is WebDriver
  • Explain the challenges you faced in automation
  • What are the languages supported by WebDriver?
  • What is the difference between verify and assert?
  • What are the limitations of Selenium IDE?
  • What are the browsers supported by Selenium IDE?
  • What are the disadvantages of Selenium?
  • How many ways can you identify an element using WebDriver / which are the locators used for recognizing the objects in Selenium WebDriver?
  • How do you clear the contents of a textbox in selenium?
  • Is it possible to interact with hidden elements using WebDriver?

Selenium Interview Questions For Experienced

  • What is a Framework?
  • What are the different kinds of Frameworks?
  • What is Keyword driven Framework?
  • What is the Hybrid Framework?
  • Different components of your framework?
  • Can you explain the Framework flow with a diagram?
  • How do you accommodate project-specific methods in your framework?
  • How is the failure handled in your framework?
  • What kind of reports are generated by your framework?
  • Explain your framework
  • Where you implemennt oops concept in ur framework
  • What if we use both explicit and implicit wait
  • Types of framework and difference b/w them
  • What is page object design pattern
  • Page Object model for Selenium using TestNG,
  • BDD framework using Gherkins,
  • Cypress Page Object Model with JS,
  • API testing Automation framework using KARATE
  • GraphQL testing framework
  • String is Palindrome or not
  • How to find all links / broken in webpage
  • Given one website and do some actions using selenium like (create user, delete item, etc)
  • HashMap uses
  • OOPS in POM
  • Framework explanation
  • HTTP methods
  • DOM means
  • Collections used in Selenium
  • Window Handles
  • Alerts
  • Authentication popup
  • Alerts using Auto IT
  • Keyboard actions
  • iframes
  • Exceptions in Selenium while coding
  • Access modifiers in Java
  • static block, static variable and static metho
  • Explain the Page Object Model (POM) in Selenium WebDriver and its advantages in test automation.
  • How do you handle dynamic elements or waits in Selenium WebDriver scripts?
  • What are the different locators used in Selenium WebDriver? When do you prefer one over the other?
  • Explain TestNG and its role in Selenium test automation. How do you manage test suites and dependencies?
  • How do you handle browser windows and pop-ups in Selenium WebDriver tests?
  • Describe how you handle data-driven testing in Selenium using TestNG Data Providers or other approaches.
  • How do you perform parallel test execution in Selenium WebDriver to expedite test runs?
  • Discuss the difference between findElement() and findElements() methods in Selenium WebDriver.
  • What is Test Automation Framework, and how have you implemented or contributed to it in your projects?
  • How do you handle handling test failures in Selenium WebDriver? Explain TestNG listeners or other techniques you’ve used

Selenium Interview Questions For 3 Years Experience

  • Which is the default port on which selenium RC runs?
  • What are the prerequisites to run a selenium web driver?
  • What is the difference between selenium 1.0 and web driver?
  • What are the advantages of the selenium web driver?
  • How to handle multiple windows in selenium webdriver?
  • Which locators are used for recognizing the objects in the selenium webdriver?
  • What is webdriver-backed selenium?
  • When to use web driver-backed selenium?
  • How to invoke an application in webdriver?
  • Where to download selenium webdriver?
  • Explain the technical problems that you had with the Selenium tool.
  • What is Selenium Grid?
  • How many browsers are supported by Selenium IDE?
  • Can Selenium test an application on iPhone’s Mobile Safari browser?
  • Can Selenium test an application on an Android browser?
  • How many programming languages can you use in the Selenium Web driver?
  • Have you read any good books on selenium?
  • Use of following-sibling?
  • What is the Page Object design pattern?
  • What is StaleElementException? When does it occur?
  • How to get the number of frames on a page?
  • How to verify that an element is not present on a page?
  • How do you simulate the scroll-down action?
  • What is the Robot class?
  • How do you verify that the given list of numbers on a web page is sorted in ascending order?
  • How to verify the presence of the success message on a page?
  • Which is the package which is to be imported while working with a webdriver?
  • Who was the first person who started working on selenium?
  • Who is the person who started on a webdriver?
  • How to verify whether the background color of a paragraph is green or not?
  • How to verify that the image changes on mouse hover?
  • How to log in to Facebook using webdriver?
  • How do you check that the pagination on the google search page is working fine or not?
  • How to check if an element is visible on the web page?
  • How to check if a button is enabled on the page?
  • How to check if a text is highlighted on the page?
  • What is selenium’s recording language?
  • What are the capabilities of Selenium IDE?
  • What are the selenium components?
  • How to insert a breakpoint in selenium IDE?
  • How to insert a comment in selenium IDE?
  • How do you handle Ajax controls using selenium?
  • How do you handle the secured connection error in HTTPS?
  • How do you compare two strings or values that are the same?
  • How to handle the dynamic alerts which don’t always appear?
  • How to upload a file using selenium?
  • How to navigate with browser buttons in selenium webdriver?
  • How to run the tests without a browser or with an HTML unit driver in selenium webdriver?
  • How to check if the checkbox or radio button is selected?
  • How do I get the title of the page?
  • How do you get the width of the textbox?
  • How do you get the attribute of the web element?
  • How do you read the text from the hidden elements?
  • What is the use of apache poi?
  • How to check whether a text is underlined or not?
  • How to verify whether the size of a div is 320px or not?
  • How to check the cursor type changes on hovering over a link?
  • How to verify that the font size of a text is 12px?
  • How to verify that an image is to the right of the text?
  • How to verify the presence of a horizontal line on a page?
  • How to change the URL on a web page using a selenium web driver?
  • How to get the CSS attribute of a web element using the web driver?
  • How to verify the presence of tooltips on a web page?
  • How to hover the mouse over an element?
  • What is the use of the getOptions() method?
  • What is the use of the deSelectAll() method?
  • Can you handle flash using a web driver?
  • Is WebElement an interface or a class?
  • FirefoxDriver is a class or an interface, and from where is it inherited?
  • Which is the super interface of the webdriver?
  • What is the difference b/w close() and quit()?
  • What is the difference b/w getWindowHandles() and getWindowHandle()?
  • What is the use of contextClick()?
  • How to press Shift+Tab?
  • How to enter :(colon using web driver)?
  • How to perform double click using webdriver?
  • How to check whether, on click of an element, a new tab will be open before clicking on that element?
  • What is the use of AutoIt?
  • What is the difference between dragAndDrop() and dragAndDropBy()?
  • How to type text in a new line inside of a text area?
  • How to switch back from a frame?
  • What is the use of getPageSource()?

Selenium Interview Questions For 5 Years Experience

  • Explain the Selenium Architecture
  • Difference between Selenium-IDE & Selenium RC, WebDriver
  • Difference between
    WebDriver driver = new FirefoxDriver()
    FirefoxDriver driver = new FirefoxDriver()
  • Difference between get(), navigate().to()
  • What is API, and where is it being used
  • Difference between quit() & close()
  • How to maximize & minimize the browser
  • What is webdriver “interface” or Class
  • What is a Super interface for WebDriver
  • What is WebElement & explain all the Mtds available in WebElement
  • How many locators are available in Webdriver, & which locator is preferred
  • How to check whether the object is available in GUI
  • How to check the text from the UI
  • How to capture color, height, width, font – the size of the Element
  • How to get the Location of the Web element
  • How to check whether the object is selected or not?
  • How to check whether the object is enabled in GUI
  • How to Delete All Cookies
  • Do we use any constructor in webdriver
  • How to compare Image
  • How to get the web element height & width
  • Question on WebDriver wait statement
  • What is Synchronization
  • How to handle Synchronization wait available in Webdriver
  • Which wait statement will be used to wait until the page load?
  • How to handle dynamic object
  • The difference between thread waits, implicitly wait, and explicitly wait.
  • What is a fluent wait?
  • Question DropDown & keyboard & mouse operation
  • How to handle drop-down
  • List out all ends available in the Select class
  • How to capture all the values from the drop-down
  • How to capture only Selected values from the drop-down
  • How to capture only non-selected values from the drop-down
  • How to how with the multi-select value from the drop-down
  • How to select all the similar values from the drop-down
  • EG, we have a multi-select drop-down, like automation testing, manual testing, SQL testing, and Java, we should have all the option which contains the “testing” word
  • How to work with custom select dropdown/ autosuggest dropDown
  • How to take mouse over operation on the element
  • How to perform keyboard operation
  • How to perform “control+c.”
  • Difference between build() & perform()
  • How to perform drogAndDrop Operation
  • How to perform right-click operation

Selenium Webdriver Interview Questions on Window Handling

  • How to work with a new Tab, new Browse-window
  • How to work with the new Tab, and new Browse-window with our GetWindowHAnles() Ltd
  • How to handle Alert popup
  • How to work Calender POP-up
  • How to work with advertisement popup
  • How to work with SSL pop-up
  • How to File Download PopUP
  • How to handle File Upload Pop-up using AutoIT
  • How to Handle File Upload Pop-up using ROBOT class
  • How to Handle Browser Scroll-bar
  • How to execute javascript
  • What are the different types of assertions you use in your framework?
  • What type of error do you get when assertions get fail?
  • Explain where you use encapsulation and polymorphism in your project.
  • What are the different design patterns that you use in your automation framework?
  • What is Static in Java? Explain at least 7 points about it.
  • How do you use a simple text file and JSON file in your project?
  • What are the different components of a Header in any request?
  • Who assigned test cases to your team, you, or your test leads?
  • What is test estimation? What approach did you use for test estimation?
  • How do you measure the cost of quality?
  • What are the main tasks of Test Closure Activities?
  • What is Project Risk, what are some of the common project risks

Selenium Interview Questions On Frame Handle

  • How to work with frame-Window
  • How to Work with nested Frame
  • How to work with multiple frames
  • How many ways to work with a frame
  • How to work frame when the frame does not have the id & @name attribute

Selenium Interview Questions For Multiple Browser

  • What is IllegalState Exception
  • How to work with IE, Chrome browser
  • How to write XPath in IE & chrome browser

Selenium Interview Questions For 2 Years Experience

  • What is a framework? Explain types of framework.
  • Which framework have you used & WHY?
  • Explain the framework with components.
  • What are Explicit wait and Implicit wait?
  • What is a headless browser?
  • How to get a screenshot in Selenium? Can you write the syntax?
  • What are the different types of Locators in Selenium?
  • What is the best way to locate a web element without a unique XPath?
  • What is StaleElementReference Exception? Have you ever encountered it, and how have you handled it?
  • Do you test cases in parallel with TestNG? If yes, how many threads, and does it cause any problems?
  • What is the most common locator you use in your project?
  • Have you ever done the profiling of a web page?
  • How frequently do you use Thread.Sleep()?
  • Suppose two elements on a web page have the same ids; how will you handle it?
  • Can we create an object for an interface?
  • What is the difference between @BeforeTest and @BeforeMethod in TestNG?
  • How does Selenium interact with the Web browser?
  • Can you make the constructor of a class static?
  • How do you maintain your test scripts, and how frequently do you modify them?
  • How to find all broken links on a webpage?
  • Explain your Automation Framework.
  • Write a dynamic XPath to locate a table’s 2nd-row 3rd-column data.
  • Hash map vs. Hash table.
  • What is the significance of the hash table?
  • What is the return type of findElements?
  • What’s the difference between a Maven project and a Java project?
  • Getwindowhandle vs. Getwindowhandles and the return types.
  • Comparable vs. comparator.
  • Explain the project along with how the Automation was done.
  • How to upload a file in Selenium?
  • How to upload a file without using Sendkeys?
  • How to connect to a Database using Selenium?
  • Any idea or experience with the Continuous Integration tool?
  • How to handle a drop-down in Selenium?
  • What is the advantage of selenium Webdriver
  • What is the difference between findelements and findelement
  • How do you locate elements on a web page using Selenium WebDriver?
  • What are the different types of locators supported by Selenium WebDriver?
  • How do you handle dynamic elements on a web page in Selenium?
  • What is the importance of implicit and explicit waits in Selenium WebDriver?
  • How do you handle multiple windows and frames using Selenium WebDriver?
  • Explain the concept of TestNG and how it is used with Selenium for test automation.
  • How do you perform mouse and keyboard actions using Selenium WebDriver?
  • What are the advantages and limitations of Selenium for test automation?
  • How do you handle SSL certificates and security-related issues in Selenium?
  • Can you automate testing for mobile applications using Selenium? If yes, how?
  • How do you manage test data and test configurations in Selenium tests?
  • What is Page Object Model (POM), and why is it used in Selenium automation?
  • How do you handle exceptions and errors in Selenium WebDriver scripts?
  • How to take screenshot in selenium ?
  • Data provider in the TESTNG?
  • How to validate links are valid or not on the webpage?
  • How you manage drag and drop activity in selenium ?
  • What is the use of testng.xml file

Selenium Automation Testing Interview Questions

  • Is Selenium 2.0 different from Selenium 3.0? If so, how?
  • Explain XPath?
  • What are the test types supported by Selenium?
  • How many types of WebDriver APIs are available in Selenium?
  • What is an exceptional test in Selenium?
  • What is POM (Page Object Model)? What are its advantages?
  • What are the different types of annotations used in Selenium? Explain the JUnit annotation linked with Selenium.
  • What are the four elements that you have to pass in Selenium?
  • What are the data-driven frameworks and keyword-driven frameworks?
  • Difference between getwindowhandles() and getwindowhandle() ?
  • Can you arrange the below testng.xml tags from parent to child?
  • How to pass parameters through the testng.xml file to a test case?
  • What is TestNG Assert and list out common TestNG Assertions?
  • How can we create a data-driven framework using TestNG?
  • Explain Java Main Method public static void main (String[] args)
  • Explain OOPS concepts in Java?
  • Explain the Java Collections Framework.
  • What do you know about the Hierarchy of Collections in Java?
  • Are you aware of the uses of the List Interface?
  • How will you convert a string array to an ArrayList?
  • intpasrcomvert
  • intparconvert
  • I want to add a null element to HashSet and TreeSet. Can I?
  • What do you know about LinkedHashSet?
  • Write a java program to find the highest occurrence of characters in a given word for example if the word is Nayar the output is a:2 and if the word is “aabbc” the output is “a:2,b:2”.
  • How do you handle windows in selenium?
  • The login should be done manually, from the home page u need to execute the scripts, how?

Java Automation Testing Interview Questions

  • What is an abstract class?
  • What is the difference between abstract and interface?
  • Purpose of constructor in Java?
  • Can abstract class have a constructor?
  • Is it possible to create an object for abstract class?
  • What is the difference between collection and collections?
  • What is set?
  • What is the difference between Hast Set and Tree Set?
  • What is the difference between Hashmap and Linked Hashmap?
  • How do you initiate a therad?
  • Do you know threads concepts?
  • What are the Selenium suite components?
  • What are the limitations of Selenium testing?
  • What are the testing types supported by Selenium? 
  • What is the difference between Selenium 3.0 and Selenium 4.0? 
  • What is the same-origin policy and how is it handled?
  • What is Selenese? How is it classified?
  • Mention the types of Web locators.
  • What are the types of waits supported by WebDriver?
  • Mention the types of navigation commands 
  • What is the major difference between driver.close() and driver.quit()?
  • What makes Selenium such a widely used testing tool? Give reasons.
  • How to type text in an input box using Selenium?
  • How to click on a hyperlink in Selenium?
  • How to scroll down a page using JavaScript?
  • How to assert the title of a webpage? 
  • How to mouse hover over a web element? 
  • How to retrieve CSS properties of an element?
  • What is POM (Page Object Model)?
  • Can Captcha be automated?
  • How does Selenium handle Windows-based pop-ups?
  • How to take screenshots in WebDriver?
  • Is there a way to type in a textbox without using sendKeys()?
  • How to select a value from a dropdown in Selenium WebDriver?
  • What does the switchTo() command do? 
  • How to upload a file in Selenium WebDriver? 
  • How to set browser window size in Selenium?
  • When do we use findElement() and findElements()?
  • What is a pause on an exception in Selenium IDE? 
  • How to login to any site if it is showing an Authentication Pop-Up for Username and Password?
  • What is the difference between single and double slash in Xpath?
  • How do you find broken links in Selenium WebDriver?
  • What is test automation or automation testing?
  • What are the advantages of automation testing?
  • Name some of the commonly used automation testing tools that are used for functional automation.
  • Name some of the commonly used automation testing tools that are used for non-functional automation.
  • List out some of the automation tools which could be integrated with Selenium to achieve continuous testing.
  • What do you mean by the assertion in Selenium?
  • Explain the difference between assert and verify commands.
  • What do you mean by XPath?
  • Explain XPath Absolute and XPath attributes.
  • What is the difference between “/” and “//” in XPath?
  • What are the different types of annotations which are used in Selenium?
  • What are the WebDriver supported Mobile Testing Drivers?
  • What is the difference between type keys and type commands?
  • What is the difference between “type” and “typeAndWait” command?
  • What is the main disadvantage of implicit wait?
  • How can we launch different browsers in Selenium WebDriver?
  • Write a code snippet to launch Firefox browser in WebDriver.
  • Write a code snippet to launch Chrome browser in WebDriver.
  • Write a code snippet to launch Internet Explorer browser in WebDriver.
  • How do you perform drag and drop operations in WebDriver?
  • What are the different methods to refresh a web page in WebDriver?
  • How to invoke an application in WebDriver?
  • What are the benefits of automation testing?
  • Is there an HtmlUnitDriver for .NET?
  • How can you redirect browsing from a browser through some proxy

Selenium Interview Questions I faced in a recent interview.

  • How to Exclude test cases which don’t want to run.
  • How to Iterate Map.
  • String str=” this is your order number 123456″
  • How to fetch the only number from this string.
  • How to handle steal element exception.what you will write in the catch block
  • How to find 2 maximum number from the array.
  • How to remove all space from the array.
  • Difference between ArrayList and Map
  • If sendkeys is not working what you will do any other alternative?
  • How to remove duplicate from the string.
<div>
<button id="sdf"> 
<div id="vxvxcv"> 
</div>
  • Write XPath to find the first div.
  • Write code that gets all the links and click on every link.
  • 5 Exception in selenium.
  • Rest Assured code.
  • The SQL query to find the top 10 rows from the table.
  • Advantage of cucumber framework
  • Other BBD tools apart from the cucumber.
  • How to achieve parametrization in cucumber.
  • How to get all links from a webpage
  • How to get all broken links from the webpage
  • How to find hidden elements from UI
  • Use of robot class.
  • How to convert date in another formate .20192207- 2019-22-07
  • WebDriver Listeners and TestNG Listeners
  • Taking data from an excel sheet is slow so what is the alternative.
  • Cucumber dependency is language-specific or not?
  • Protector.?
  • TestNG Annotation order.

Automation Testing Interview Questions For Freshers

  • Write code for Action class
  • Write code for positive and negative scenarios for Alerts
  • Write code for handling multiple windows
  • Find an odd number
  • Disadvantages of Selenium
  • Difference between get() and navigate().to()
  • Write code to click on the Checkbox which is inside the Dynamic Table
  • Write code for taking Screenshot
  • Explains Maps in Java
  • Explain framework (Questions based on your framework explanation)
  • What is Pom.xml
  • Which is the correct Xpath for this code (Lot of questions on Xpath)
  • Xpath methods Ex: Starts-with & Contains
  • The syntax for a CSS selector
  • How to identify dynamic images
  • From a given string, separate characters, integers, and special characters and store in a separate variable and print them
  • Remove duplicates from ArrayList
  • Print all the frame names
  • How to read from XML or CSV file and store in hashmap
  • Get the value of a cell in the Dynamic table
  • What is the Burndown chart (Agile)
  • Print these characters from a given string and change them to uppercase
  • Explain Access specifiers
  • Difference between Priority and Severity
  • Example of High Priority and Low Severity and vice versa
  • Difference between Test Strategy and Test Scenario
  • What Software Metrics you have used in your project
  • How to handle Dynamic Elements, since the webpage is designed in Angular Js
  • Implicit and Explicit Waits
  • Write code for Cross Browser Testing
  • Explain Method Overloading and Method Overriding with Example
  • What is Static Keyword
  • Dependencies in Pom.xml
  • Write code for fetching data from Excel
  • Select this value in the dropdown and hover to this element and click
  • Assert and Verify
  • Check if a given string is Palindrome or not
  • Remove duplicate characters from a string and print
  • Which Code Repository you are using (Ex: GitHub)
  • What is Software testing?
  • What are the different types of testing?
  • What are the principles of software testing?
  • What is regression testing in software testing?
  • What is exploratory testing?
  • What is end-to-end testing?
  • What is unit testing?
  • What is an API?
  • What is a test environment?
  • Explain how does a test coverage tool work?
  • Can you describe the different types of test coverage techniques?
  • Explain black-box testing, white-box testing, and grey-box testing.
  • Is Automation testing in agile methodology useful?
  • Explain test scenarios, test scripts, and test cases in software testing.
  • What is a bug in software testing?
  • State the difference between bugs and errors
  • What is a Test Plan? What does it include?
  • What is a Test Report? What does it include?
  • What do you mean by Test Deliverables?
  • What are different categories of debugging?
  • Write some common mistakes that lead to major issues.
  • What is a user story?
  • List some of the popular software testing tools/frameworks, providing a brief description of each.
  • What is A/B testing?
  • What is defects in software testing?
  • What is spice in software testing?
  • What do you mean by latent defect and masked defect?
  • Can you explain sanity testing in software testing?
  • What is the purpose of TestNG?
  • Is it possible to skip a method or a code block in TestNG?
  • What is the best way to set priority for test cases in TestNG?
  • What is Object Repository?
  • What are the valuable steps to resolve issues while testing?
  • What qualities a software tester should have?
  • Explain boundary value analysis in software testing.
  • Explain the role of testing in software development?
  • How much testing is sufficient? Or, is it possible to do exhaustive testing of the software?
  • Why developers shouldn’t test the software they wrote?
  • What is SDLC in software testing?
  • What is the software testing life cycle?
  • What is functional testing?
  • What is non-functional testing?
  • What is a bug report?
  • What are some important testing metrics?
  • What is Test-Driven-Development?
  • What is Selenium? What are its benefits?
  • What are the various components of Selenium?
  • What is cross-browser testing?
  • What are the different HTTP status codes that a server can return?
  • What is automated testing?
  • What is the most effective way to map automation testing success?
  • What are the different types of severity you can assign to a bug?
  • Which test cases are written first: white boxes or black boxes?
  • What is alpha testing?
  • What is beta testing?
  • What is meant by browser automation?
  • What do you mean by Test Matrix and Traceability Matrix?
  • What is the V model in software testing?
  • State difference between verification and validation in software testing.
  • What is static software testing?
  • What is dynamic software testing?
  • What do you mean by confirmation testing in software testing?
  • What is the defect life cycle?
  • What is defect cascading in Software testing?
  • A defect that could have been removed during the initial stage is later removed. What effect does this have on the cost?
  • What is meant by the workbench concept?
  • When there is neither a frame ID nor a frame name, what technique should be considered in the script?
  • How can Selenium WebDriver be used to detect broken links

Automation Testing Interview Questions For 5 Years Experience

  • What is the use of the ‘super’ keyword inside a constructor?
  • Explain the concept of proper inheritance?
  • What are abstract classes and anonymous classes?
  • When should a function throw an exception?
  • How can you insert values in multiple rows using one Insert statement?
  • Explain access specifiers?
  • What are TCP/IP protocols?
  • What are near, far, and huge pointers?
  • Explain the waterfall model?
  • Difference between Linked list and Queue?
  • What are bitfields? What is the use of bit fields in a Structure declaration?
  • Write an algorithm for quick sort?
  • What is cursor?
  • Difference between rowid and rownum in SQL?
  • What are the different synchronization mechanisms?
  • Can a static member function access the member variable of an object?
  • What is the difference between the member variable’s initialization and assignment in a constructor?
  • What is the use of the ‘classpath’ environment variable?
  • What is the use of StringTokenizer class?
  • Today is Monday. After 61 days, it will be?
  • Difference between operator overloading and function overloading
  • Can you instantiate an abstract class and what is an inner class?
  • When do you call copy constructor?
  • How can you swap values between two rows in a table using a single- SQL statement?
  • What is the type of this pointer?
  • What do you mean by data hiding?
  • What is Function Overloading?
  • What is SDLC?
  • Explain the key functions of data binding.
  • We know that we can maximize or minimize the browser window. However, we need to test the responsiveness of the UAT in different browser screen sizes. Can this be done in Selenium?
  • How to send ALT/SHIFT/CONTROL keys at once in Selenium WebDriver?
  • How can you upload a file using Selenium WebDriver?
  • What technique should you use throughout the script if there is neither a frame id nor a frame name?
  • You have written an automation code with both implicit and explicit wait commands. However, the elementNotVisible exception is still thrown. How do you fix this issue, without extending the wait timings in implicit or explicit waits?
  • How can you use regular expressions in Selenium?
  • You need to retrieve the message in an alert box, without using the getText() method. How will you handle this situation?
  • Consider a website that requires a username, password and a captcha for the user to log in. Your colleague suggests that this test execution can be redirected to the manual testing team? Do you agree with them? If yes, why?
  • Can you explain how you can handle colors in a web driver?
  • You are given a set of automated scripts that are highly confidential and must be run on the client’s remote server only. You are asked to modify the scripts based on privacy needs, what will you do?
  • A fresher in your team encounters a ‘StaleElement’ exception while executing an automated test suite. How will you help them solve this issue?
  • How is network data capturing done in Selenium?
  • You have been asked to perform automation testing on a website that loads at a slow pace. You are able to execute the scenario manually without any impediments other than the speed issue. But while automation, NoSuchElementFound exception is thrown.
  • Your test lead suggests making a change in the navigation commands. How will you handle this situation?
  • Which command takes you forward by one page in the browser history?
  • How will you enable a disabled textbox?
  • There are failures in your suite execution, where only a few test cases have passed. How will you optimize your upcoming test runs in Selenium?
  • How can you debug the tests in the Selenium IDE?
  • How to verify the specific position of a web element?
  • How is desired capability useful in terms of Selenium?
  • John is not sure if the warning text label is displayed on the web page of a blog. How will you help him using Selenium?
  • Your team needs to check if a warning message is displayed when the password entered by the user is moderately secure.
  • There are different datasets, where some passwords entered by the user are secure, so the warning message does not appear on the page. This should not halt the execution of the next steps in the test script. Can we use Assert commands to test this scenario?
  • Which type command should you use if there is a reload event once your typing is completed?
  • The Selenium script runs in Chrome but not in IE. What can be done?
  • How do you write an Xpath locator to identify paragraph elements that are the immediate child of a div element, or the descendent of a div element?
  • How do you take a screenshot with Selenium Webdriver?

Selenium Java Interview Questions

What is Automation Testing?
Ans: Automation testing or Test Automation is a process of automating the manual process to test the application/system under test. Automation testing involves the use of a separate testing tool which lets you create test scripts which can be executed repeatedly and doesn’t require any manual intervention.

What are the benefits of Automation Testing?
Ans: Benefits of Automation testing are:

  • Supports execution of repeated test cases
  • Aids in testing a large test matrix
  • Enables parallel execution
  • Encourages unattended execution
  • Improves accuracy thereby reducing human-generated errors
  • Saves time and money

Why should Selenium be selected as a test tool?
Ans: Selenium is a free and open-source have a large user base and helping communities have cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.) have great platform compatibility (Windows, Mac OS, Linux etc.) supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) has fresh and regular repository developments supports distributed testing

What is Selenium? What are the different Selenium components?
Ans: Selenium is one of the most popular automated testing suites. Selenium is designed in a way to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms. Due to its existence in the open-source community, it has become one of the most accepted tools amongst the testing professionals. Selenium is not just a single tool or a utility, rather a package of several testing tools and for the same reason, it is referred to as a Suite. Each of these tools is designed to cater to different testing and test environment requirements. The suite package constitutes the following sets of tools:

  • Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback tool. It is distributed as a Firefox Plugin.
  • Selenium Remote Control (RC) – Selenium RC is a server that allows a user to create test scripts in the desired programming language. It also allows executing test scripts within the large spectrum of browsers.
  • Selenium WebDriver – WebDriver is a different tool altogether that has various advantages over Selenium RC. WebDriver directly communicates with the web browser and uses its native compatibility to automate.
  • Selenium Grid – Selenium Grid is used to distribute your test execution on multiple platforms and environments concurrently.

What are the testing types that can be supported by Selenium?
Ans: Selenium supports the following types of testing:
Functional Testing
Regression Testing

What are the limitations of Selenium?
Ans: Following are the limitations of Selenium:

  • Selenium supports the testing of only web-based applications
  • Mobile applications cannot be tested using Selenium
  • Captcha and Barcode readers cannot be tested using Selenium
  • Reports can only be generated using third-party tools like TestNG or Junit.
  • Selenium is a free tool. Thus there is no ready vendor support through the user can find numerous helping communities.
  • A user is expected to possess prior programming language knowledge.

When should I use Selenium IDE?
Ans: Selenium IDE is the simplest and easiest of all the tools within the Selenium Package. Its record and playback feature make it exceptionally easy to learn with minimal acquaintances to any programming language. Selenium IDE is an ideal tool for a naïve user.

What is Selenese?
Ans: Selenese is the language which is used to write test scripts in Selenium IDE.

What are the different types of locators in Selenium?
Ans: Locator can be termed as an address that identifies a web element uniquely within the webpage. Thus, to identify web elements accurately and precisely, we have different types of locators in Selenium:

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

What is the difference between Assert and verify commands?
Ans:

  • Assert: Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true, then the program control will execute the next test step, but if the condition is false, the execution will stop, and no further test would be executed.
  • Verify: Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halt, i.e. any failure during verification would not stop the execution, and all the test steps would be executed.

What is an XPath?
Ans: XPath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organise and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, XPath can be used to locate HTML elements.

The fundamental behind locating elements using XPath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

What is the difference between “/” and “//” in XPath?
Ans:

  • Single Slash “/” – Single slash is used to create XPath with an absolute path, i.e. the XPath would be created to start selection from the document node/start node.
  • Double Slash “//” – Double slash is used to create XPath with a relative path, i.e. the XPath would be created to start selection from anywhere within the document.

What is the Same-origin policy and how it can be handled?
Ans: The problem of same-origin policy disallows to access the DOM of a document from an origin that is different from the origin we are trying to access the document.
Origin is a sequential combination of scheme, host, and port of the URL. For example, for a URL HTTP:// http://www.softwaretestingo.com/selenium/, the origin is a combination of HTTP, softwaretestingo.com, 80 correspondingly.
Thus the Selenium Core (JavaScript Program) cannot access the elements from an origin that is different from where it was launched. For Example, if I have launched the JavaScript Program from “http://www.softwaretestingo.com”, then I would be able to access the pages within the same domain such as “http://www.softwaretestingblog.in/selenium” or “http://www.softwaretestingo.com/manual/”. The other domains, like google.com, seleniumhq.org would no more be accessible.
So, To handle the same-origin policy, Selenium Remote Control was introduced.

When should I use Selenium Grid?
Ans: Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently to achieve distributed test execution, testing under different environments and saving execution time remarkably.

What do we mean by Selenium 1 and Selenium 2?
Ans: Selenium RC and WebDriver, in a combination, are popularly known as Selenium 2. Selenium RC alone is also referred to as Selenium 1.

Which is the latest Selenium tool?
Ans: WebDriver

How do I launch the browser using WebDriver?
Ans: The following syntax can be used to launch Browser:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

What are the different types of Drivers available in WebDriver?
Ans: The different drivers available in WebDriver are:

  • FirefoxDriver
  • InternetExplorerDriver
  • ChromeDriver
  • SafariDriver
  • OperaDriver
  • AndroidDriver
  • IPhoneDriver
  • HtmlUnitDriver

What are the different types of waits available in WebDriver?
Ans: There are two types of waits available in WebDriver:
Implicit Wait
Explicit Wait

  • Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, the subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.
  • Explicit Wait: Explicit waits are used to halt the execution until the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.

How to type in a textbox using Selenium?
Ans: User can use sendKeys(“String to be entered”) to enter the string in the textbox.
Syntax:
WebElement username = drv.findElement(By.id(“Email”));
// entering username
username.sendKeys(“sth”);

How can you find if an element in displayed on the screen?
Ans: WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.
isDisplayed()
isSelected()
isEnabled()
Syntax:

isDisplayed():

boolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();

isSelected():

boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

isEnabled():

boolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();

How can we get a text of a web element?
Ans: Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc. displayed on the web pages.
Syntax:
String Text = driver.findElement(By.id(“Text”)).getText();

How to select value in a dropdown?
Ans: Value in the dropdown can be selected using WebDriver’s Select class.
Syntax:

selectByValue:

Select selectByValue = new Select(driver.findElement(By.id(“SelectID_One”))); selectByValue.selectByValue(“greenvalue”); 

selectByVisibleText:

Select selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”))); selectByVisibleText.selectByVisibleText(“Lime”);

selectByIndex:

Select selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”))); selectByIndex.selectByIndex(2);

What are the different types of navigation commands?
Ans: Following are the navigation commands:

  • navigate().back() – The above command requires no parameters and takes back the user to the previous webpage in the web browser’s history.
    Sample code:
    driver.navigate().back();
  • navigate().forward() – This command lets the user to navigate to the next web page with reference to the browser’s history.
    Sample code:
    driver.navigate().forward();
  • navigate().refresh() – This command lets the user to refresh the current web page there by reloading all the web elements.
    Sample code:
    driver.navigate().refresh();
  • navigate().to() – This command lets the user to launch a new web browser window and navigate to the specified URL.
    Sample code:
    driver.navigate().to(“https://google.com”);

How to click on a hyperlink using linkText?
Ans: driver.findElement(By.linkText(“Google”)).click();
The command finds the element using link text and then click on that element, and thus the user would be re-directed to the corresponding page.
The above-mentioned link can also be accessed by using the following command.
driver.findElement (By.partialLinkText(“Goo”)).click();
The above command finds the element based on the substring of the link provided in the parenthesis and thus partialLinkText() finds the web element with the specified substring and then clicks on it.

How to handle frame in WebDriver?
Ans: An inline frame acronym as iframe is used to insert another document within the current HTML document or simply a web page into a web page by enabling nesting.

  • Select iframe by id
    driver.switchTo().frame(“ID of the frame“);
  • Locating iframe using tagName
    driver.switchTo().frame (driver.findElements (By.tagName(“iframe”).get(0));
  • Locating iframe using index
    frame(index)
    driver.switchTo().frame(0);
  • frame(Name of Frame)
    driver.switchTo().frame(“name of the frame”);
    frame(WebElement element)
    Select Parent Window
    driver.switchTo().defaultContent();

When do we use findElement() and findElements()?
Ans:

findElement(): findElement() is used to find the first element in the current web page matching the specified locator value. Take note that only the first matching element would be fetched.
Syntax:

WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

findElements(): findElements() is used to find all the elements in the current web page matching to the specified locator value. Take a note that all the matching elements would be fetched and stored in the list of WebElements.
Syntax:

List <WebElement> elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

How to find more than one web element in the list?
Ans: At times, we may come across elements of the same type of multiple hyperlinks, images etc. arranged in an ordered or unordered list. Thus, it makes absolute sense to deal with such elements by a single piece of code, and this can be done using the WebElement List.
Sample Code

// Storing the list
List <WebElement> elementList = driver.findElements(By.xpath("//div[@id='example']//ul//li"));
// Fetching the size of the list
int listSize = elementList.size();
for (int i=0; i<listSize; i++)
{
   // Clicking on each service provider link
   serviceProviderLinks.get(i).click();
   // Navigating back to the previous page that stores link to service providers
   driver.navigate().back();
}

What is the difference between driver.close() and driver.quit command?
Ans:

  • Close (): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the WebDriver. The command neither requires any parameter, nor does it return any value.
  • Quit (): Unlike a close() method, quit() method closes down all the windows that the program has opened. The same as the close() method, the command neither requires any parameter nor does it return any value.

Can Selenium handle windows based pop up?
Ans: Selenium is an automation testing tool which supports only web application testing. Therefore, windows pop up cannot be handled using Selenium.

How can we handle web-based pop-up?
Ans: WebDriver offers the users with a very efficient way to handle these pop-ups using Alert interface. There are four methods that we would be using along with the Alert interface.

  • Void dismiss() – The accept() method clicks on the “Cancel” button as soon as the pop-up window appears.
  • Void accept() – The accept() method clicks on the “Ok” button as soon as the pop-up window appears.
  • String getText() – The getText() method returns

Final Words

By reviewing common Selenium interview questions and practicing your answers, you can demonstrate your expertise and showcase your ability to perform well in a Selenium testing role. It’s important to remember that every interviewer will have unique preferences and expectations, so your responses must also be flexible and adaptable.

By mastering the art of answering Selenium interview questions, you can increase your chances of landing your dream job and jumpstarting your career in software testing. With continued practice and dedication, you can become a skilled and valuable Selenium tester, contributing to the success of your organization and ensuring that web applications function smoothly and efficiently.

If you have any suggestions, feedback, or questions about Selenium Interview Questions, please feel free to ask in the comment section below. We value your opinion and would love to hear from you. Our team of experts is here to provide you with the best possible guidance and assistance.

Your feedback will help us improve and update our content to provide the most relevant and up-to-date information on Selenium interview questions. So, don’t hesitate to leave your questions or comments below, and we will get back to you as soon as possible.

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

2 thoughts on “Selenium Interview Questions”

  1. These all are very helpful to us….thanks a lot….can you do interview questions on selenium python please I m on that domain…can you please do that article on selenium python….real time interview questions

    Reply
    • Thanks Archana, for such kind words and selenium python interview questions also in our list will try to update those as well in our platform

      Reply

Leave a Comment