Advanced Selenium Interview Questions &
Answers (Python)
Q: How Selenium WebDriver works internally?
A: WebDriver sends commands to browser-specific drivers using JSON Wire Protocol / W3C
WebDriver protocol.
Q: What is Selenium Grid Architecture?
A: It follows Hub-Node architecture where Hub controls test execution and Nodes run tests on
browsers.
Q: How do you handle dynamic web elements?
A: By using dynamic XPath, CSS selectors, and explicit waits.
Q: What is Shadow DOM and how do you handle it?
A: Shadow DOM encapsulates elements. Use JavaScriptExecutor to access shadow roots.
Q: Difference between [Link]() and WebDriverWait?
A: [Link]() is static and blocks execution; WebDriverWait is dynamic and efficient.
Q: How to handle CAPTCHA in Selenium?
A: CAPTCHA cannot be automated; it should be disabled in test environments.
Q: What is Page Factory?
A: Page Factory initializes WebElements using @FindBy annotations.
Q: How do you implement POM with PyTest?
A: Create separate page classes and call them inside test classes using fixtures.
Q: What are synchronization issues?
A: Occurs when Selenium executes faster than page load; resolved using waits.
Q: How to handle file download?
A: By configuring browser preferences to auto-download files.
Q: How to handle authentication popup?
A: Using URL format: username:password@url
Q: What is headless testing?
A: Running browser tests without GUI using headless mode.
Q: How do you handle SSL certificate errors?
A: Using acceptInsecureCerts capability.
Q: What is Docker’s role in Selenium?
A: Docker is used to create isolated test environments for Selenium Grid.
Q: How do you capture network logs?
A: Using Chrome DevTools Protocol in Selenium 4.
Q: Difference between XPath and CSS Selector?
A: XPath can traverse DOM both ways; CSS is faster but limited.
Q: How do you retry failed test cases?
A: Using PyTest retry mechanisms or custom decorators.
Q: How to handle stale element exception?
A: Re-locate the element after DOM refresh.
Q: How do you improve Selenium test performance?
A: Parallel execution, headless mode, proper waits.
Q: What are Selenium limitations?
A: Cannot test desktop apps, CAPTCHA handling, image testing.
Q: How do you integrate Selenium with CI/CD?
A: Using Jenkins or GitHub Actions.
Q: How do you design a Selenium framework?
A: Using POM, utility classes, logging, reporting, and configuration files.
Q: What reporting tools are used with Selenium?
A: Allure, Extent Reports, PyTest HTML.
Q: How do you manage test data?
A: Using Excel, CSV, JSON, or databases.
Q: What is BDD and Selenium?
A: Using Cucumber/Behave to write tests in Gherkin language.