UrbanPro
true

Learn Personal Trainer from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Top 20 Selenium Interview Questions with Hands-on Practice

Pradeep Shankar Chate
5 days ago 0 0

1. What is Selenium? What are its components?
👉 Selenium is an open-source automation tool for web applications.
Components:

 

 

  • Selenium IDE – record & playback

  • Selenium WebDriver – automation with multiple browsers

  • Selenium Grid – run tests in parallel/distributed

2. Difference between Selenium 2 (WebDriver) and Selenium 3/4.
👉 Selenium 2 introduced WebDriver.
👉 Selenium 3/4 improved architecture, added W3C compliance, relative locators, Chrome DevTools integration.

3. What are different types of locators in Selenium?
👉 ID, Name, ClassName, TagName, LinkText, PartialLinkText, CSS Selector, XPath

4. Difference between findElement() and findElements().
👉 findElement() → returns first matching element (throws exception if not found).
👉 findElements() → returns a list of matching elements (empty list if not found).

5. Difference between driver.close() and driver.quit().
👉 close() → closes current browser window.
👉 quit() → closes all browser windows & ends session.

6. How do you handle dynamic web elements in Selenium?
👉 Use dynamic XPath, CSS with contains/starts-with, or by using unique attributes.

7. What is an XPath? Difference between Absolute and Relative XPath.
👉 XPath is used to locate elements in XML/HTML.

  • Absolute XPath → starts from root (/html/body/...)

  • Relative XPath → starts from anywhere (//div[@id='test'])

8. What are the different waits in Selenium?
👉 Implicit Wait – waits globally for elements.
👉 Explicit Wait – waits for a specific condition.
👉 Fluent Wait – waits with polling frequency & exception handling.

9. How to handle dropdowns in Selenium?
👉 Use Select class:

 
Select s = new Select(driver.findElement(By.id("dropdown"))); s.selectByVisibleText("Option1");

10. How do you handle multiple windows in Selenium?
👉 Use getWindowHandles() and switch with driver.switchTo().window(handle).


🔹 Intermediate Selenium Q&A

11. How do you handle alerts and popups in Selenium?
👉 Use driver.switchTo().alert() → accept()dismiss()getText()sendKeys().

12. How to perform mouse hover, right-click, and drag-and-drop?
👉 Use Actions class:

 
Actions a = new Actions(driver); a.moveToElement(element).perform(); // hover a.contextClick(element).perform(); // right-click a.dragAndDrop(src, dest).perform(); // drag-drop

13. How do you capture screenshots in Selenium?
👉 Use TakesScreenshot:

 
File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

14. Difference between WebDriver and WebElement.
👉 WebDriver → Interface for browser automation.
👉 WebElement → Represents elements inside the page.

15. How to handle frames/iframes in Selenium?
👉 Use driver.switchTo().frame(index/name/WebElement)
👉 Switch back: driver.switchTo().defaultContent()

16. What is Page Object Model (POM)? Why is it used?
👉 POM is a design pattern where each page has a separate class.
👉 Improves readability, reusability, and maintainability of test scripts.

17. Difference between getText() and getAttribute().
👉 getText() → Gets visible text.
👉 getAttribute("value") → Gets attribute/property value.

18. How do you handle synchronization issues?
👉 Use explicit waits with ExpectedConditions instead of Thread.sleep().


🔹 Advanced Selenium Q&A

19. What is Selenium Grid? How do you run tests in parallel?
👉 Selenium Grid allows distributed test execution across different browsers, OS, and machines.
👉 Parallel tests can be executed using TestNG parallel execution with Grid.

20. How do you integrate Selenium with TestNG/Maven/Jenkins?
👉 TestNG → test framework (annotations, assertions, reports).
👉 Maven → project management & dependency tool.
👉 Jenkins → CI/CD tool to trigger Selenium scripts automatically.

0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Interview Questions And Answer
Q1: What is Automation Testing? Answer: Automation Testing is the process of using tools and scripts to test software applications automatically. Instead of running test cases manually, scripts are executed...

Top 20 Selenium Interview Questions with Hands-on Practice
👉 Selenium is an open-source automation tool for web applications.Components: Selenium IDE – record & playback Selenium WebDriver – automation with multiple browsers Selenium...

Top 20 Selenium Interview Questions and Answer
1. What is Selenium? What are its components?👉 Selenium is an open-source automation tool for web applications.Components: Selenium IDE – record & playback Selenium WebDriver –...

Writing Your First Cucumber Test Scenario in Plain English
Description:Cucumber allows us to write test cases in plain English using Gherkin syntax. Example: Feature: Login functionality Scenario: Successful login with valid credentials Given User is on the...

Selenium Interview Practice Questions With Hands-On Examples
Description: Selenium is widely used for web automation. Practicing interview questions can help improve both concepts and practical skills. Q1: What are the different types of locators in Selenium? A1:...

Looking for Personal Trainer ?

Learn from Best Tutors on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Personal Trainer Classes?

The best tutors for Personal Trainer Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Personal Trainer with the Best Tutors

The best Tutors for Personal Trainer Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more