SoftwareTestPilot
7 Q&A

Selenium Python Automation Interview: 25 Questions (2026)

25 most-asked Selenium Python automation interview questions for 2026. Includes setup, locators, waits, POM, pytest fixtures, parallel execution, CI/CD and behavioral questions.

  • 2 min read
  • Difficulty: Mixed (Easy → Hard)
  • Freshers → Experienced
  • Updated July 17, 2026
  • Avinash Kamble
0 / 7 reviewed
0%

Common Selenium Python Mistakes and Fixes

Medium Very Common 1 minQ1 / 7

Q1.1. Using time.sleep()

Asked byAccentureInfosysCognizantWipro
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 1. Using time.sleep() and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation
# BAD
time.sleep(5)
driver.find_element(...).click()

# GOOD
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.ID, "submit"))).click()
Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 1. Using time.sleep() over textbook wording.
  • Be ready to whiteboard the 1. Using time.sleep() snippet live — panels often ask you to type it, not describe it.
RelatedQ3
Medium Very Common 1 minQ2 / 7

Q2.2. Using absolute XPath

Asked byMicrosoftAccentureInfosysCognizant
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 2. Using absolute XPath and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation
# BAD
driver.find_element(By.XPATH, "/html/body/div[3]/form/input[1]")

# GOOD
driver.find_element(By.ID, "email")
Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 2. Using absolute XPath over textbook wording.
  • Be ready to whiteboard the 2. Using absolute XPath snippet live — panels often ask you to type it, not describe it.
  • Say explicitly that you prefer CSS/relative locators and only fall back to XPath for text or axes — panels grade locator hygiene here.
Medium Common 1 minQ3 / 7

Q3.3. Hardcoded URLs and credentials

Asked byCognizantWiproAmazonCapgemini
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 3. Hardcoded URLs and credentials and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation
BASE_URL = os.getenv("BASE_URL", "https://staging.example.com")
EMAIL = os.getenv("TEST_EMAIL")
Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 3. Hardcoded URLs and credentials over textbook wording.
  • Be ready to whiteboard the 3. Hardcoded URLs and credentials snippet live — panels often ask you to type it, not describe it.
Easy Common 1 minQ4 / 7

Q4.4. Sharing state across tests

Asked byInfosysCognizantWiproAmazon
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 4. Sharing state across tests and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation

Prefer pytest fixtures over class-level state — each test should be independent.

Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 4. Sharing state across tests over textbook wording.
  • Keep the answer to 60–90 seconds; anything longer signals you can't summarise 4. Sharing state across tests cleanly.
  • Explain setup/teardown ordering and what runs per-test vs per-suite; ordering mistakes are the follow-up question.
Medium Common 1 minQ5 / 7

Q5.5. Not capturing screenshots on failure

Asked byAmazonCapgeminiTCSMicrosoft
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 5. Not capturing screenshots on failure and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    rep = outcome.get_result()
    if rep.failed:
        driver = item.funcargs.get('driver')
        if driver:
            driver.save_screenshot(f"screenshots/{item.name}.png")
Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 5. Not capturing screenshots on failure over textbook wording.
  • Be ready to whiteboard the 5. Not capturing screenshots on failure snippet live — panels often ask you to type it, not describe it.
  • Explain setup/teardown ordering and what runs per-test vs per-suite; ordering mistakes are the follow-up question.
Medium Occasional 1 minQ6 / 7

Q6.6. Ignoring headless mode in CI

Asked byWiproAmazonCapgeminiTCS
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 6. Ignoring headless mode in CI and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation
options.add_argument("--headless=new")
options.add_argument("--no-sandbox")
Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 6. Ignoring headless mode in CI over textbook wording.
  • Be ready to whiteboard the 6. Ignoring headless mode in CI snippet live — panels often ask you to type it, not describe it.
Medium Occasional 1 minQ7 / 7

Q7.7. Not using explicit waits

Asked byTCSMicrosoftAccentureInfosys
Why interviewers ask this

This Selenium Python question checks whether you can go beyond textbook knowledge on 7. Not using explicit waits and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.

Detailed explanation

Always use WebDriverWait with expected_conditions. Never rely on implicit waits.

Tips to remember
  • Anchor the answer in a real Selenium Python project — panels reward specificity on 7. Not using explicit waits over textbook wording.
  • Be ready to whiteboard the 7. Not using explicit waits snippet live — panels often ask you to type it, not describe it.
  • State that you never mix wait strategies and never use a hard sleep, then give the timeout value you actually run in CI.
RelatedQ5
Confidence check

If you can confidently answer the Common Selenium Python Mistakes and Fixes questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

Quick revision

  1. Q1: 1. Using time.sleep() — # BAD time.sleep(5) driver.find_element(...).click() # GOOD wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable((By.ID, "submit"))).click()
  2. Q2: 2. Using absolute XPath — # BAD driver.find_element(By.XPATH, "/html/body/div[3]/form/input[1]") # GOOD driver.find_element(By.ID, "email")
  3. Q3: 3. Hardcoded URLs and credentials — BASE_URL = os.getenv("BASE_URL", "https://staging.example.com") EMAIL = os.getenv("TEST_EMAIL")
  4. Q4: 4. Sharing state across tests — Prefer pytest fixtures over class-level state — each test should be independent.
  5. Q5: 5. Not capturing screenshots on failure — @pytest.hookimpl(hookwrapper=True) def pytest_runtest_makereport(item, call): outcome = yield rep = outcome.get_result() if rep.failed: driver = item.funcargs.get('driver') if driv

Frequently asked questions

1.Is Selenium Python still relevant in 2026?
Yes — Python is the second most popular language for Selenium after Java. Selenium 4 with Python is actively maintained and widely used at startups and data-driven teams.
2.Selenium Python vs Java — which is better?
Java for large enterprise stacks with TestNG/Maven, Python for startups, data-driven testing and faster prototyping. Both are excellent choices.
3.How long does it take to learn Selenium Python?
For an experienced Python developer: 2–4 weeks to be productive. For a beginner: 6–10 weeks, including basic Python, pytest and the Page Object Model.
4.What's the most-asked Selenium Python interview question?
How do you handle flaky tests? Interviewers want to hear that you fix root causes (waits, locators, test data, isolation) instead of adding time.sleep().
5.Can Selenium Python test APIs?
Not directly — use the requests library for API calls. A common pattern is to use Selenium for UI flows and requests for setup, teardown and assertions in the same suite.
6.What's the best test runner for Selenium Python?
pytest is the de-facto standard in 2026 thanks to fixtures, parametrization, pytest-xdist for parallelism and a large plugin ecosystem.

Was this article helpful?

Cluster · Selenium

More from Selenium WebDriver Basics

Locators, waits, WebDriver setup — the foundation.

Pillar guide · 5 articles
More in this cluster
From the Selenium pillar
Topic mapConcepts · Tools · People · Standards

Related concepts, tools & standards around Selenium Python

A quick reference of the people, companies, frameworks and technologies most often mentioned alongside Selenium Python in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.

Core testing concepts
Explicit vs Implicit WaitsPageFactoryTest PyramidShift-Left TestingBehavior-Driven DevelopmentTest-Driven DevelopmentPage Object ModelContract TestingExploratory TestingRisk-Based Testing
Testing tools
Programming languages
JavaPythonJavaScriptTypeScriptC#SQL
Certifications worth knowing
ISTQB Foundation LevelISTQB Advanced — Test AnalystISTQB Agile TesterCertified Selenium ProfessionalAWS Certified DevOps EngineerCertified ScrumMaster (CSM)
Companies hiring for this skill
GoogleMicrosoftAmazonMetaNetflixAtlassianThoughtWorksInfosysTCSWipro

Key takeaways

  • Master the fundamentals before tackling advanced Selenium Python scenarios.
  • Always explain trade-offs — interviewers reward judgement, not memorisation.
  • Use real project examples; generic answers blend in.
  • Practice answers out loud — written prep doesn't transfer to live rounds.
  • Revise the 30-second cheat sheet the night before your interview.
  • Keep one strong scenario story ready for every section above.

Selenium Python jobs hiring now

Live, indexable Selenium Python openings — updated daily in Jobs Radar.

Browse all QA jobs on Jobs Radar

Loading current openings…

Home

Discussion

Ask a question, share your experience, or correct us. Be kind — real people are reading.