complex / advanced Selenium interview questions



Here are complex / advanced Selenium interview questions (especially useful for 5–10+ years experience, automation architects, and SDET roles). I’ve grouped them by topic for better preparation.

Framework & Architecture Level

How would you design a scalable Selenium automation framework from scratch?

  • Explain hybrid framework (POM + Data-driven + Keyword-driven)

  • Reusable components

  • Reporting (Extent Reports / Allure)

  • Logging (Log4j / NLog)

  • CI/CD integration (Jenkins / Azure DevOps)

  • Parallel execution (TestNG / NUnit + Grid)


How do you handle test flakiness in Selenium?

  • Explicit waits vs Fluent waits

  • Avoid Thread.sleep()

  • Stable locators strategy

  • Retry logic

  • Handling dynamic elements

  • Synchronization best practices


How do you implement cross-browser and parallel execution?

  • Selenium Grid

  • Dockerized Grid

  • Cloud platforms (BrowserStack / LambdaTest)

  • ThreadLocal WebDriver

  • TestNG parallel modes


Explain Page Object Model limitations and how you improved it.

  • Tight coupling issue

  • Large page classes

  • Use Page Factory vs custom element wrappers

  • Implement Page Object + Component Object pattern


🔹 Advanced WebDriver Concepts

What happens internally when you call driver.findElement()?

  • WebDriver → JSON Wire Protocol / W3C Protocol

  • HTTP request to browser driver

  • Browser driver communicates with browser

  • DOM lookup

  • Response returned to client


Difference between:

  • findElement() vs findElements()

  • get() vs navigate().to()

  • close() vs quit()

  • Implicit wait vs Explicit wait vs Fluent wait


How do you handle dynamic web tables?

  • Identify dynamic rows

  • XPath axes usage

  • Loop through rows and columns

  • Handling pagination


How do you automate Shadow DOM elements?

  • JavaScript Executor

  • getShadowRoot() (Selenium 4)

  • Nested shadow roots handling


How do you handle stale element exception in complex apps?

  • Re-locate element

  • Explicit wait for refresh

  • Retry mechanism

  • Using ExpectedConditions.refreshed()


🔹 Real-Time Scenario Based Questions

How do you handle:

  • File upload?

  • File download validation?

  • CAPTCHA?

  • OTP?

  • Multi-factor authentication?

(Answer: Robot class, AutoIT, API bypass, test hooks, mock services)


How do you automate Angular/React applications?

  • Wait for AJAX calls

  • JS executor

  • Handling dynamic IDs

  • Using relative locators (Selenium 4)


How do you validate broken links on a webpage?

  • Extract all <a> tags

  • Use HttpURLConnection

  • Validate response code (200, 404, 500)


How do you integrate Selenium with API testing?

  • Use RestAssured before UI execution

  • Data setup via API

  • Validate backend response


🔹 Advanced C# Selenium Questions (Since you work with C#)

 How do you implement Singleton WebDriver in C#?

 How do you use:

  • NUnit fixtures?

  • Parallelizable attribute?

  • Dependency Injection in Selenium?

How do you manage configuration files?

  • appsettings.json

  • Environment switching (QA, UAT, PROD)


🔹 Selenium 4 Specific Questions

 What are new features in Selenium 4?

  • Relative Locators

  • W3C protocol

  • Improved Grid

  • DevTools integration


 How do you capture network logs using Selenium 4?

  • Chrome DevTools Protocol

  • Enable performance logging

  • Capture API calls


🔹 Coding Round Questions

 Write code to:

  • Sort web table and validate sorting

  • Handle multiple windows

  • Retry failed tests

  • Take screenshot on failure

  • Scroll to element


🔹 Design & Leadership Questions (For Senior Roles)

 How do you:

  • Reduce automation maintenance cost?

  • Improve execution time by 40%?

  • Decide what NOT to automate?

  • Measure ROI of automation?


🔹 Very Tough Scenario Question

Your automation suite takes 8 hours to run and is unstable. What steps will you take?

Expected Answer:

  • Analyze bottlenecks

  • Parallelize

  • Remove redundant tests

  • API-level testing for setup

  • Optimize waits

  • Refactor framework

  • Use cloud/grid

Tags:
Leave a comment

Your email address will not be published. Required fields are marked *

Subscribe now

Receive weekly newsletter with educational materials, new courses, most popular posts, popular books and much more!