QA Interview
Selenium Interview Questions for 2 Years Experience (2026)
Practice selenium interview questions 2 years experience roles use, with Python code, Page Objects, pytest, dynamic waits, CI, and debugging model answers.
25 min read | 3,508 words
TL;DR
A two-year Selenium candidate should show independent ownership of focused UI automation, maintainable components, explicit synchronization, pytest structure, CI execution, and root-cause debugging. Strong answers combine code with test-layer judgment and evidence.
Key Takeaways
- Choose UI automation from product risk and keep broad rule combinations at lower test layers.
- Scope stable locators to domain components and verify uniqueness.
- Synchronize with observable states, including re-render and multiple-outcome scenarios.
- Keep Page Objects focused on page or component behavior and locators.
- Use pytest fixtures, parameters, and markers only where their lifecycle and meaning are clear.
- Compare CI and local environments with evidence before changing timeouts.
- Treat retries, quarantine, data isolation, and failure artifacts as explicit reliability decisions.
A useful guide to selenium interview questions 2 years experience must test more than basic browser commands. After about two years, interviewers expect you to own small automation features, design maintainable page or component objects, handle dynamic UI states, use a test runner effectively, debug intermittent failures, and explain how tests fit into CI.
You are still not expected to solve every architecture problem. The difference from a junior candidate is independence. You should be able to turn a story into test scenarios, choose what to automate, build the test and data setup, review its reliability, and investigate failures without reaching first for a hard sleep.
This 2026 guide focuses on current Selenium 4 with Python and pytest. It includes runnable code, intermediate scenario questions, and model answers. Use the Selenium automation framework tutorial if you need to build a small practice repository alongside the questions.
TL;DR
For a two-year Selenium role, demonstrate working depth in these areas:
| Capability | Expected evidence |
|---|---|
| Test design | Converts acceptance criteria into focused positive, negative, and boundary scenarios |
| Locator design | Uses stable attributes, scopes locators, and handles repeated components |
| Synchronization | Chooses precise conditions and understands stale references |
| Framework use | Creates fixtures, Page Objects, parameterized tests, and configuration |
| Browser context | Handles tabs, frames, alerts, actions, cookies, and uploads safely |
| Reliability | Collects artifacts, classifies failures, and removes root causes |
| Delivery | Runs selected tests in CI and explains headless and cross-browser tradeoffs |
Use a four-part answer: state the principle, show how you applied it, mention a failure mode, and explain the verification. That structure reveals practical experience without turning every response into a long lecture.
1. Selenium Interview Questions 2 Years Experience Candidates Should Expect
A two-year interview often begins with fundamentals and quickly adds constraints. Instead of "What is an explicit wait?" you may hear, "A toast sometimes appears after Save, and sometimes the page navigates. How would you synchronize and verify success?" The interviewer wants both API knowledge and scenario reasoning.
Expect questions about your framework. Be ready to draw the flow from a pytest test to a fixture, page object, WebDriver, browser, application, and report. Explain where configuration and test data live. If your project uses Java instead, translate these concepts to JUnit or TestNG without pretending Python details are universal.
Resume claims create the question bank. If you say you reduced flakiness, define flaky, describe the dominant root cause, show what changed, and explain how you knew reliability improved. If you list parallel execution, explain driver and data isolation. If you mention Jenkins or another CI tool, explain trigger, command, environment inputs, artifacts, and failure ownership.
At two years, interviewers also notice test judgment. A candidate who automates every acceptance criterion through the browser may know Selenium but not efficient testing. Explain when an API or unit test is better, which critical user paths still need browser confidence, and what requires exploratory testing.
Do not confuse years with title. Some two-year engineers have substantial framework depth, while others have maintained a small suite. Answer from your real scope, then demonstrate how you reason about the next level.
2. Convert Requirements Into Valuable Automated Tests
Before code, identify behavior, risk, preconditions, inputs, observable outputs, and cleanup. Suppose a profile form accepts a display name with a documented length limit. Useful scenarios might include a normal name, boundary lengths, required-field behavior, unsupported characters if specified, authorization, persistence after reload, and server error handling. Not all need UI automation.
Allocate cases by layer:
| Test concern | Preferred layer | Why |
|---|---|---|
| Many input combinations | Unit or API | Fast, precise feedback |
| Browser validation message | UI component or Selenium | Requires rendered behavior |
| Permission contract | API plus one UI check | Broad rules below, user visibility above |
| Save and reload journey | Selenium | Validates integrated user workflow |
| Visual spacing | Visual or exploratory testing | DOM assertions are a poor proxy |
| Unknown usability risks | Exploratory session | Requires human investigation |
A focused Selenium test should control its preconditions, perform a coherent user behavior, and assert a business-visible outcome. "No exception occurred" is not an outcome. A Save test can assert the success status and reload the page to verify persistence if persistence is the contract.
Think about data before execution. Reusing one shared customer creates ordering and parallel failures. Prefer unique data through an approved API or fixture. Cleanup should be idempotent, meaning it can safely run even when setup or the test stops halfway.
Know the difference between verification and validation in practical terms. Verification asks whether the implementation meets specified requirements. Validation asks whether the behavior solves the intended user need. Automation is strong at repeatable verification, while exploratory testing contributes heavily to validation and unknown-risk discovery.
3. Build Stable Locators for Dynamic Components
Intermediate locator questions involve repeated rows, generated markup, and component boundaries. A stable locator relies on durable semantics or an agreed test contract. Scope from a meaningful container so a repeated button is associated with the correct item.
For a table row, locate the row by domain identity, then find the action inside it:
from selenium.webdriver.common.by import By
def row_for_order(driver, order_id: str):
rows = driver.find_elements(By.CSS_SELECTOR, "table#orders tbody tr")
for row in rows:
cell = row.find_element(By.CSS_SELECTOR, "[data-column='order-id']")
if cell.text.strip() == order_id:
return row
raise AssertionError(f"Order row not found: {order_id}")
row = row_for_order(driver, "ORD-1042")
row.find_element(By.CSS_SELECTOR, "button[data-action='details']").click()
If the application can expose data-order-id on the row, the locator becomes simpler and avoids walking all rows. Work with developers on stable attributes where accessible names or domain attributes are insufficient.
Avoid selectors based on generated CSS classes, absolute DOM paths, or indexes such as the third button. Indexes are acceptable only when position itself is the requirement and you verify the collection ordering.
CSS and XPath are tools, not competing religions. CSS is concise for attributes and hierarchy. XPath is useful for text and relationships such as an ancestor row. Neither makes a weak attribute stable. Use normalize-space() carefully when user-visible text is the intended contract.
Also verify uniqueness. find_element returns the first match, so a duplicate locator can pass against the wrong control. During component development or debugging, count matches and inspect them. Production tests can rely on a documented unique contract once the page enforces it.
4. Synchronize With States, Re-renders, and Multiple Outcomes
Set implicit wait to zero in an explicit-wait framework. An explicit condition tells the reader what state matters and returns as soon as it succeeds. Do not mix nonzero implicit waits with explicit waits because element lookup inside the condition can distort total timing.
This runnable example creates and then replaces a status element. It demonstrates why locating after a transition is safer than caching a WebElement:
from urllib.parse import quote
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
html = """
<div id="status">Draft</div>
<button id="publish" onclick="
const oldStatus = document.querySelector('#status');
setTimeout(() => {
const replacement = document.createElement('div');
replacement.id = 'status';
replacement.textContent = 'Published';
oldStatus.replaceWith(replacement);
}, 600);
">Publish</button>
"""
driver = webdriver.Chrome()
try:
driver.implicitly_wait(0)
driver.get("data:text/html;charset=utf-8," + quote(html))
wait = WebDriverWait(driver, 5)
old_status = driver.find_element(By.ID, "status")
driver.find_element(By.ID, "publish").click()
wait.until(EC.staleness_of(old_status))
published = wait.until(
EC.text_to_be_present_in_element((By.ID, "status"), "Published")
)
assert published
finally:
driver.quit()
A custom condition is appropriate when built-ins do not express the business state. It should observe, not mutate, because WebDriverWait can call it multiple times.
For multiple legitimate outcomes, make the condition return structured evidence. A login request may result in a dashboard or a visible error. Poll for either, then assert which result is expected for the test data. Do not use try with a long wait for the first outcome followed by another long wait for the second, because failures take the sum of both timeouts.
A timeout value is a failure ceiling, not a sleep. Select it from observed environment behavior and operation expectations. Add a meaningful message or wrapper label so the report says "profile save confirmation" rather than only "condition timed out." See Selenium explicit wait examples for more state patterns.
5. Design Maintainable Page and Component Objects
A Page Object encapsulates locators and behavior for a page or meaningful component. It should make tests read in domain language without hiding every decision. At two years, show that you understand both the benefit and the failure modes.
This self-contained component can run against Selenium's public form:
from dataclasses import dataclass
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
@dataclass
class WebFormPage:
driver: WebDriver
timeout: float = 5
URL = "https://www.selenium.dev/selenium/web/web-form.html"
TEXT = (By.NAME, "my-text")
SUBMIT = (By.CSS_SELECTOR, "button")
MESSAGE = (By.ID, "message")
def open(self) -> "WebFormPage":
self.driver.get(self.URL)
return self
def submit(self, value: str) -> str:
wait = WebDriverWait(self.driver, self.timeout)
wait.until(EC.visibility_of_element_located(self.TEXT)).send_keys(value)
wait.until(EC.element_to_be_clickable(self.SUBMIT)).click()
return wait.until(
EC.visibility_of_element_located(self.MESSAGE)
).text
The page owns its URL, locators, and form behavior. It receives the driver rather than creating it, so lifecycle remains in the test fixture. It returns the observable message, letting the test decide the expected value.
Component objects are useful for shared navigation, modals, date pickers, and tables. Composition is usually clearer than making every page inherit dozens of generic helpers from BasePage.
Avoid these Page Object problems:
- Public locators that force tests to reimplement behavior.
- Assertions for unrelated business scenarios hidden inside page methods.
- Cached elements on frequently re-rendered pages.
- Generic methods such as
click_anything(locator)that add no domain meaning. - Driver setup, test data, API clients, and reporting mixed into one class.
- One object representing several unrelated pages.
A good boundary localizes UI change. If a modal's close behavior changes, its component changes while tests continue to express "cancel editing."
6. Use Pytest Fixtures, Parameters, and Markers With Intent
Pytest fixtures manage reusable setup and teardown. Parameterization runs the same behavior with multiple named inputs. Markers select meaningful test groups. These are more maintainable than loops and global setup hidden inside tests.
This file is runnable after python -m pip install selenium pytest:
import pytest
from selenium import webdriver
@pytest.fixture
def driver():
browser = webdriver.Chrome()
browser.implicitly_wait(0)
yield browser
browser.quit()
@pytest.mark.parametrize(
("value", "expected"),
[
pytest.param("QA", "Received!", id="short-text"),
pytest.param("SDET interview", "Received!", id="normal-text"),
],
)
def test_web_form_submission(driver, value, expected):
page = WebFormPage(driver).open()
assert page.submit(value) == expected
Place the WebFormPage class above the test or import it from your page module. Each parameter has an ID that appears in reports. The fixture has function scope by default, giving each test case a fresh browser.
Do not parameterize unrelated workflows merely to reduce line count. Parameters should represent variations of one behavior. If setup, action, or expected outcome changes substantially, separate tests communicate better.
Use fixture scopes carefully. A session-scoped browser may reduce startup time but increases shared state and makes parallel execution harder. Prefer isolation, then optimize from evidence. API clients or immutable configuration may safely use broader scope.
Register custom markers in pytest configuration so selection is explicit. Tags such as smoke, regression, or checkout should have a documented meaning. A smoke suite is not simply the shortest tests. It covers the smallest useful set of critical risks for rapid feedback.
On failure, a hook or reporting plugin can attach screenshots and page source. Keep artifact collection outside page objects so every failure path receives consistent evidence.
7. Handle Browser Context and Advanced Interactions Safely
Many two-year interviews ask about context switching because it exposes whether the candidate understands where WebDriver commands execute.
For a new tab, current Selenium Python supports creating a context directly:
original = driver.current_window_handle
driver.switch_to.new_window("tab")
driver.get("https://www.selenium.dev/")
assert "Selenium" in driver.title
driver.close()
driver.switch_to.window(original)
When the application opens the tab, wait for the expected window count and find the handle that was not present before. Do not assume window_handles[1] in a test that may have other contexts.
For frames, wait and switch with a built-in condition:
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
WebDriverWait(driver, 5).until(
EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe"))
)
# Interact inside the frame.
driver.switch_to.default_content()
For hover, drag, key chords, or composite pointer behavior, use ActionChains:
from selenium.webdriver import ActionChains
menu = driver.find_element(By.CSS_SELECTOR, "[data-menu='account']")
ActionChains(driver).move_to_element(menu).perform()
Do not use actions for a normal click when element.click() expresses the interaction. Use the simplest user-like command that matches the behavior.
For file upload, send an absolute path to an input[type='file']. For cookies, navigate to the relevant domain before add_cookie, because WebDriver enforces the current domain context. For alerts, switch to the alert, inspect text, and accept or dismiss it. Each operation has a context precondition worth explaining.
Shadow DOM support and browser downloads require product and environment-specific design. If your project uses them, explain the actual API and limitations you tested rather than giving a generic claim.
8. Run Tests in Headless, Cross-Browser, and CI Environments
Headless mode runs a browser without a visible desktop window, but it is still a real browser engine. Differences can arise from viewport size, fonts, GPU behavior, downloads, permissions, and environment. Configure a deterministic window size when layout matters and reproduce failures with the same browser version and capabilities.
Current Chrome setup can use:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,900")
driver = webdriver.Chrome(options=options)
Do not add old container flags automatically. Each flag should address a known environment constraint and pass security review.
A useful CI job defines:
- Trigger and test selection.
- Browser and version or controlled image.
- Base URL and environment configuration.
- Secrets from the CI secret store.
- Dependency installation and exact command.
- Timeout at job and test levels.
- Reports, screenshots, and logs retained on failure.
- Ownership for red builds.
Cross-browser strategy should follow supported users and browser-sensitive risk. Run a focused critical set across required browser engines. Avoid multiplying every data combination across all browsers when the variation belongs at an API layer.
When CI fails but local execution passes, compare facts: browser version, headless state, viewport, CPU and memory, network route, locale, timezone, test data, concurrency, and environment. "CI is slow" is a hypothesis, not a diagnosis.
At two years, you should be able to describe your pipeline even if a DevOps engineer authored it. Know how tests start, which inputs they receive, where artifacts go, and who acts on failures.
9. Diagnose Flaky Tests With a Repeatable Process
A flaky test produces different outcomes without an intentional relevant change. Do not label every intermittent red build as a test issue. The cause may be a real race condition, environment instability, data collision, browser failure, or poor test synchronization.
Use this workflow:
- Preserve the first failing artifacts and exact environment.
- Group failures by exception, message, locator, and application step.
- Reproduce with the same data and concurrency where possible.
- Determine whether the failure is product, test, environment, or infrastructure.
- Fix the state model, data ownership, locator, or capacity issue.
- Run focused repetition to challenge the fix.
- Monitor recurrence without hiding the original signal.
A screenshot shows visible state, but add the current URL, relevant DOM, browser capabilities, console or network evidence available through your approved tooling, and timestamps. A TimeoutException means the condition did not become true before the boundary. It does not prove the environment was merely slow.
Retries need caution. An automatic retry can be useful for a narrowly classified session-start failure, but retrying every assertion creates false confidence. If a retry exists, report it distinctly and preserve the first failure.
Quarantine should have an owner, reason, risk, and removal target. A permanently skipped test is missing coverage, not a passing test.
For a deeper diagnostic catalog, use the Selenium exceptions and fixes guide.
10. Solve Intermediate Coding Scenarios
Scenario: Wait for either a success toast or an error alert.
Return a result that identifies the observed state:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
SUCCESS = (By.CSS_SELECTOR, "[role='status']")
ERROR = (By.CSS_SELECTOR, "[role='alert']")
def save_outcome(driver):
successes = driver.find_elements(*SUCCESS)
if successes and successes[0].is_displayed():
return ("success", successes[0].text)
errors = driver.find_elements(*ERROR)
if errors and errors[0].is_displayed():
return ("error", errors[0].text)
return False
kind, message = WebDriverWait(driver, 10).until(save_outcome)
assert kind == "success", message
The condition only observes. It avoids waiting ten seconds for success before starting another ten-second wait for error.
Scenario: Verify a sorted numeric column.
Extract displayed values, normalize them according to the product format, then compare with Python's sorted result:
price_cells = driver.find_elements(
By.CSS_SELECTOR, "table#products td[data-column='price']"
)
actual = [float(cell.text.replace("quot;, "").replace(",", "")) for cell in price_cells]
assert actual == sorted(actual)
Clarify currency, locale, blank values, and sort direction in a real interview.
Scenario: Click a button after a loading mask disappears.
Wait for the blocker and target separately:
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, ".loading-mask")))
wait.until(EC.element_to_be_clickable((By.ID, "save"))).click()
Then assert the save result. Click success alone does not prove business success.
Scenario: Test many login combinations.
Put validation-rule combinations at API or unit level. Keep a small UI set for rendered errors and critical login journeys. Use pytest parameters only for variations that truly share setup and behavior.
11. Practice Selenium Interview Questions 2 Years Experience Effectively
Build a two-week practice plan around evidence.
Days 1 and 2: create five focused Selenium tests from acceptance criteria. Explain why each belongs at UI level. Days 3 and 4: replace weak locators, add a reusable component, and verify locator uniqueness. Days 5 and 6: simulate delayed, hidden, disabled, and replaced elements with data URLs, then select explicit conditions.
Days 7 and 8: add pytest fixtures, parameters, markers, configuration, and failure screenshots. Days 9 and 10: run headless and another supported browser, then document any capability differences. Day 11: introduce a shared-data collision, diagnose it, and create unique setup. Day 12: practice frames, tabs, alerts, upload, hover, and tables. Day 13: run the suite in CI or a local CI-like command and inspect artifacts. Day 14: conduct a mock interview.
Prepare four stories: a difficult automation task, a flaky failure you fixed, a defect your test found, and a code review or collaboration improvement. Keep each story under three minutes and make the result factual.
During coding, narrate requirements and risks. Start with a stable locator and state. Ensure teardown. Assert an outcome. If syntax is uncertain, say what you would check in official documentation rather than inventing a method.
Review Selenium scenario-based interview questions for additional drills, but prioritize explaining fewer scenarios deeply.
Interview Questions and Answers
Q: What changes between a one-year and two-year Selenium engineer?
A two-year engineer is usually expected to own small automation work from scenario design through CI diagnosis. The engineer should understand framework boundaries, data setup, maintainability, and reliability rather than only executing prepared scripts.
Q: How do you decide whether a test belongs in Selenium?
I ask whether the risk requires a real browser and integrated user flow. Rule combinations and service contracts usually belong below the UI, while critical journeys and browser behavior need focused Selenium coverage. I include maintenance and diagnosis cost.
Q: How do you design a locator for a dynamic table row?
I identify the row by a stable domain key, then scope the action locator inside that row. I prefer a dedicated row attribute if available. I avoid global indexes because sorting and filtering change position.
Q: Why do you store locators instead of WebElements?
Modern interfaces can replace DOM nodes during re-rendering. A stored element then becomes stale. A locator can be resolved near the action with the appropriate readiness condition.
Q: When do you create a custom expected condition?
I create one when built-in conditions do not express the application state, such as either of two outcomes or a minimum collection size. It must be side-effect free because polling can call it repeatedly.
Q: What should a Page Object contain?
It should contain stable locators, readiness rules, and behavior for one page or component. Driver lifecycle, unrelated APIs, test scenario assertions, and broad utility methods belong elsewhere.
Q: How do pytest fixture scopes affect Selenium tests?
Function scope gives strong browser isolation but more startup cost. Broader scope can share state and complicate parallelism. I start with function scope and optimize only after measuring and protecting independence.
Q: How do you parameterize Selenium tests?
I use pytest.mark.parametrize when inputs and expected outputs vary for the same behavior. I give cases readable IDs. If the workflow changes materially, separate tests are clearer.
Q: How do you debug a test that passes locally but fails in CI?
I compare browser version, headless mode, viewport, resources, concurrency, network, locale, timezone, environment, and data. I use first-failure artifacts and reproduce the same conditions instead of only increasing a timeout.
Q: What is your approach to flaky tests?
I preserve evidence, group signatures, classify the source, fix root causes, challenge the fix with focused repetition, and monitor recurrence. Retries and quarantine are bounded and visible.
Q: How do you run Selenium tests in parallel safely?
Each execution needs an isolated driver and unique mutable data. Cleanup must be idempotent, and concurrency must respect browser and application capacity. Sharing a driver or account creates nondeterministic failures.
Q: How do you test file upload?
I locate the file input and send it an absolute path. I avoid automating the operating-system chooser because it is outside WebDriver's normal page model. Then I assert the application's upload result.
Q: How do you handle multiple possible UI outcomes?
I use one explicit condition that observes all valid outcomes and returns evidence identifying which occurred. The test asserts the expected branch. This avoids sequential full-timeout waits.
Q: What do you include in a CI failure report?
I include test and build identity, environment, browser capabilities, exception, named step or condition, screenshot, URL, relevant DOM, and available logs. Artifacts should be correlated and handled according to data policy.
Common Mistakes
- Describing two years of experience as only two years of repeated click scripts.
- Automating every data combination through the UI.
- Building locators from indexes, generated classes, or deep DOM structure.
- Mixing implicit and explicit waits.
- Caching elements across re-renders.
- Turning Page Objects into test, API, reporting, and driver god objects.
- Using session-scoped browsers without acknowledging shared state.
- Parameterizing unrelated scenarios to reduce file count.
- Assuming headless mode is identical without controlling viewport and environment.
- Retrying every failure and reporting the retry as a clean pass.
- Calling all CI-only failures "timing issues" without comparing environments.
- Sharing users or records during parallel execution.
- Claiming a percentage improvement without explaining the baseline and measurement.
- Answering only with tool syntax instead of the product state and assertion.
A credible two-year candidate can describe one thing that did not work, why it failed, and how the design changed. That reflection is stronger than presenting every project choice as perfect.
Conclusion
Preparing for selenium interview questions 2 years experience means demonstrating independent delivery, not memorizing more commands. Show that you can select valuable UI coverage, build stable locators and component objects, synchronize with real states, use pytest responsibly, and diagnose failures from evidence.
Run the code, create the failure cases yourself, and practice your four project stories. The goal is to make your reasoning visible: what risk you saw, which option you chose, how you implemented it, and what proved the test was trustworthy.
Interview Questions and Answers
How do you decide whether to automate a scenario with Selenium?
I use Selenium when the risk needs browser-level or integrated user-flow confidence. I move large rule matrices and service contracts to faster lower layers. I consider execution value, stability, and maintenance.
How do you locate an action in a dynamic table?
I identify the row with a stable business key and then find the action within that row. A dedicated data attribute is ideal when available. I avoid positional indexes that break after sorting.
Why do you avoid caching WebElements?
A UI re-render can detach a stored element and cause staleness. Keeping locators allows the framework to resolve the current node near the action and apply the correct wait.
How do you handle multiple valid outcomes from one action?
I build one side-effect-free condition that observes all valid outcomes and returns which one occurred. The test then asserts the expected branch. This avoids stacking full timeout periods.
What makes a good Page Object?
It has one coherent page or component responsibility, stable locators, and domain-meaningful behavior. It does not create drivers, own all test data, or hide unrelated scenario assertions.
When should tests be parameterized?
When multiple inputs and outputs exercise the same setup and behavior. I use readable case IDs. Materially different workflows remain separate tests.
How do you choose fixture scope?
I start with function scope for browser isolation. Broader scope is considered only when measured startup cost matters and shared state can be controlled. The choice must also work with parallel execution.
How do you debug local-pass CI-fail behavior?
I compare browser, mode, viewport, resources, network, locale, timezone, concurrency, data, and application environment. I preserve the first failure and reproduce the same conditions before modifying the test.
What is your flaky-test process?
I preserve artifacts, group signatures, classify the source, fix the state, data, locator, or environment problem, and monitor recurrence. Retry and quarantine remain visible risk controls.
How do you handle StaleElementReferenceException?
I find the transition that replaced the node, wait for that transition if needed, and locate the current element. I do not blindly retry side-effecting actions.
How do you make parallel tests reliable?
Every test needs its own driver and mutable business data, plus safe cleanup. Concurrency must remain within browser and application capacity. Shared accounts and global state are common failure sources.
What should a Selenium CI job publish?
It should publish a test report plus correlated screenshots, URLs, relevant DOM, browser capabilities, and approved logs for failures. It should also make environment inputs and test selection visible.
How do you upload a file in Selenium?
I send an absolute path to the page's file input and assert the application result. I avoid OS-dialog automation because WebDriver interacts with the document, not the native chooser.
Why is JavaScript click risky?
It can bypass interactability and user-path checks, hiding overlays or focus defects. I diagnose and fix the state required for a normal click first. I use JavaScript only for a justified application-specific case.
How do you verify sorting in a table?
I extract displayed values, normalize according to the data type and locale, and compare them with an independently sorted collection. I clarify blanks, duplicate values, direction, and pagination.
Frequently Asked Questions
What Selenium questions are asked for two years of experience?
Expect dynamic locators, explicit waits, stale elements, Page Objects, pytest or another runner, context switching, CI behavior, parallel isolation, and debugging. Scenario questions often combine several of these.
How is a two-year Selenium interview different from a fresher interview?
The interviewer expects independent ownership and project examples. Definitions become constrained scenarios involving maintainability, test data, CI, and failure diagnosis.
Should a two-year candidate know framework design?
You should explain the boundaries and flow of the framework you use, including fixtures, page objects, configuration, data, and reports. Enterprise platform architecture is usually not required unless the role asks for it.
Do I need to know parallel testing after two years?
Understand driver isolation, unique test data, cleanup, runner configuration, and environment capacity. Be honest about whether you configured it or only used an existing setup.
Which Python topics help in a Selenium interview?
Be comfortable with functions, classes, exceptions, context and cleanup patterns, lists and dictionaries, comprehensions, pathlib, decorators at a basic level, and pytest fixtures and parameters.
How many project stories should I prepare?
Prepare at least four: a difficult automation task, a flaky failure, a valuable defect, and a collaboration or review improvement. Each should include the constraint, action, evidence, and learning.
Is JavaScript click a good solution for intercepted clicks?
Not as a first response. Inspect overlays, scrolling, animation, and target state, then wait for the user-like click to be valid. JavaScript can bypass behavior that the test should verify.
Related Guides
- Selenium Interview Questions for 8 Years Experience (2026)
- Selenium Interview Questions for 1 Years Experience (2026)
- Selenium Interview Questions for 10 Years Experience (2026)
- Selenium Interview Questions for 3 Years Experience (2026)
- Selenium Interview Questions for 4 Years Experience (2026)
- Selenium Interview Questions for 5 Years Experience (2026)