๐ฏ Download All 50+ Selenium And Playwright Automation Solved Q&A PDF + Book Free 1-on-1 Mock Interview
๐ฏ2026 SELECTION BLUEPRINT
The 2026 SDET & Automation Testing interview process across top tech companies tests 3 core capabilities: Core Programming & Locator Strategies (Java/Python/TypeScript, XPath, CSS), Framework Architecture (POM, Hybrid, Data-Driven), and Modern Automation Tools (Selenium 4 CDP vs Playwright async, API mocking). Salaries range from โน4.5 - โน15.0 LPA.
โฑ๏ธ
90 MinsAssessment Duration
๐
3 StagesSelection Stages
๐ฐ
โน4.5 - โน15.0 LPAAverage Salary
๐ข
Live Coding & Framework DebuggingTesting Engine
100% FREE CAREER CONSULTATION
Crack SDET & Automation Test Engineer in 2026
Get customized 2026 syllabus roadmap & 1-on-1 mock interview preparation.
๐ Zero Spam Guaranteeโก 15-Min Callbackโญ 4.9/5 Rating
Live coding on a shared compiler or whiteboard. The interviewer probes data structures, problem decomposition, code optimization from O(Nยฒ) to O(N log N), and clean coding standards.
These questions test foundational conceptual mastery, syntax accuracy, and core theoretical knowledge:
Q1. What are the key differences between Selenium WebDriver and Playwright?
Foundation • 0-2 Yrs
Selenium WebDriver communicates with browsers via HTTP/JSON Wire / W3C WebDriver protocol using browser drivers (chromedriver, geckodriver) with external waits required. Playwright (developed by Microsoft) connects directly to browser engines (Chromium, Firefox, WebKit) via a single persistent WebSocket connection, features native automatic waiting, built-in network interception, and runs isolated browser contexts with faster execution.
Q2. Explain the different locator strategies in Selenium and best practices.
Foundation • 0-2 Yrs
Locators include: ID (fastest and most reliable), Name, ClassName, TagName, LinkText, PartialLinkText, CSS Selector (fast and robust for complex styling), and XPath (powerful for bidirectional DOM traversal). Best practice is to use unique test attributes (data-testid, id) and avoid fragile absolute XPaths.
Q3. What is the difference between Absolute XPath and Relative XPath?
Foundation • 0-2 Yrs
Absolute XPath starts from the root node (/html/body/div...) with a single slash; it is extremely brittle and breaks whenever UI layouts change slightly. Relative XPath starts anywhere in the DOM using a double slash (//tagname[@attribute='value']), making it resilient to surrounding DOM restructuring.
Q4. Explain the difference between Implicit Wait, Explicit Wait, and Fluent Wait in Selenium.
Foundation • 0-2 Yrs
Implicit Wait polls the DOM globally for a fixed duration for all elements before throwing NoSuchElementException. Explicit Wait pauses execution dynamically until a specific condition (ExpectedConditions.elementToBeClickable) is satisfied on a specific element. Fluent Wait is a customizable explicit wait that allows defining polling frequency (e.g., check every 250ms) and ignoring specific exceptions (StaleElementReferenceException).
Q5. What is StaleElementReferenceException and how do you resolve it?
Foundation • 0-2 Yrs
This occurs when an element reference exists in code but the element has been deleted or refreshed in the DOM (e.g., after AJAX reload or page navigation). Resolve by: re-locating the element right before interaction, using PageFactory or explicit waits, or wrapping actions in a retry loop.
Q6. What is the Page Object Model (POM) and why is it recommended?
Foundation • 0-2 Yrs
POM is a design pattern that models each web page as an independent class containing web elements and user interaction methods. Test scripts interact strictly with page classes rather than raw locators, reducing code duplication, ensuring maintainability, and separating test verification logic from UI structure.
Q7. Explain the difference between driver.close() and driver.quit().
Foundation • 0-2 Yrs
driver.close() closes the currently focused browser window or tab; if only one window is open, the driver process may remain active in memory. driver.quit() closes all open browser windows and tabs and cleanly terminates the WebDriver daemon process, releasing system memory.
Q8. How do you handle dropdowns in Selenium (static vs dynamic)?
Foundation • 0-2 Yrs
Static dropdowns with a
Q9. How do you handle JavaScript alerts, popups, and confirms in Selenium?
Foundation • 0-2 Yrs
Selenium provides the Alert interface via driver.switchTo().alert(). You can use: alert.accept() (click OK), alert.dismiss() (click Cancel), alert.getText() (read alert message), and alert.sendKeys('text') (input prompt data).
Q10. What is the Actions class in Selenium and when is it used?
Foundation • 0-2 Yrs
The Actions class facilitates advanced user gestures and mouse/keyboard interactions, including: mouse hover (moveToElement), drag-and-drop (dragAndDrop), double click, right click (contextClick), and multi-key keyboard chords (Keys.CONTROL, Keys.SHIFT).
Q11. What are the key annotations in TestNG and their execution order?
Foundation • 0-2 Yrs
Execution hierarchy: @BeforeSuite -> @BeforeTest -> @BeforeClass -> @BeforeMethod -> @Test -> @AfterMethod -> @AfterClass -> @AfterTest -> @AfterSuite. Grouping and dependency annotations include @DataProvider, @Parameters, and dependsOnMethods.
Q12. Explain Data-Driven Testing in TestNG using @DataProvider.
Foundation • 0-2 Yrs
@DataProvider supplies parameterized test data to a test method. It returns a 2D Object array (Object[][]) or Iterator
Q13. What is auto-waiting in Playwright and how does it eliminate flaky tests?
Foundation • 0-2 Yrs
Playwright automatically performs a series of actionability checks before executing any action (click, fill, check). It verifies: element is visible, element is stable (not animating), element can receive pointer events (not covered by overlays), element is enabled, and element is attached to DOM, eliminating manual sleep timers.
Q14. How do you take screenshots on test failure in Selenium?
Foundation • 0-2 Yrs
Using the TakesScreenshot interface: File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); then copy to a target directory using FileUtils.copyFile(). In TestNG, this is automated inside an ITestListener implementation in the onTestFailure() method.
Q15. What is the difference between findElement() and findElements()?
Foundation • 0-2 Yrs
findElement() returns the first matching WebElement; if no match is found, it immediately throws NoSuchElementException. findElements() returns a List of all matching elements; if no match is found, it returns an empty list without throwing an exception.
Selenium 4 provides direct CDP access via the DevTools interface. QA engineers can: intercept and mock network traffic (Network.emulateNetworkConditions, Network.setBlockedURLs), capture console logs, emulate geo-location, simulate mobile device screen sizes, and inject custom headers without third-party proxies.
Q17. How does Playwright execute tests in parallel across browser contexts?
Experienced • 3-5+ Yrs
In Playwright, a Browser instance is launched once. For each test, an isolated BrowserContext is created in milliseconds. Each context functions like a completely separate incognito browser session with independent cookies, cache, and local storage, enabling massive parallel execution with zero cross-test interference.
Q18. How do you handle Shadow DOM elements in Selenium 4 vs Playwright?
Experienced • 3-5+ Yrs
In Selenium 4, open Shadow DOM elements are accessed via element.getShadowRoot(), returning a SearchContext to find internal elements. In Playwright, selectors pierce open Shadow DOM by default automatically (e.g., page.locator('my-component input')), requiring no special syntax.
Q19. How do you mock API network responses in Playwright for frontend testing?
Experienced • 3-5+ Yrs
Playwright provides page.route(url, handler) to intercept HTTP traffic. You can modify request headers, fulfill responses with custom mock JSON payloads (route.fulfill({status: 200, contentType: 'application/json', body: JSON.stringify(mockData)})), or abort requests (route.abort()).
Q20. How do you handle dynamic SVG elements and nested iframes?
Experienced • 3-5+ Yrs
SVG elements cannot be selected with standard HTML tag names in XPath; they require local-name() or name() functions: //*[local-name()='svg']/*[local-name()='path']. For nested iframes, chain driver.switchTo().frame(parentFrame).switchTo().frame(childFrame) and return using driver.switchTo().defaultContent().
Q21. Explain the Cucumber BDD framework: Feature files, Step Definitions, and Runners.
Experienced • 3-5+ Yrs
Feature files use Gherkin syntax (Feature, Scenario, Given, When, Then, And) to define human-readable test scenarios. Step Definition classes contain automation code annotated with Gherkin keywords matching regular expressions. TestRunner classes (using @CucumberOptions) configure glue code, plugin reports, and tags.
Q22. How do you implement Cross-Browser Parallel Testing in Selenium Grid 4?
Experienced • 3-5+ Yrs
Selenium Grid 4 features a distributed architecture (Router, Distributor, Session Queue, Session Map, Node). Tests instantiate RemoteWebDriver with DesiredCapabilities / ChromeOptions / FirefoxOptions and target the Grid hub URL. Parallel execution is configured in testng.xml with parallel='methods' or parallel='tests'.
Q23. How do you optimize test execution speed in continuous integration (CI/CD) pipelines?
Experienced • 3-5+ Yrs
1. Run tests in headless mode (headless=true); 2. Parallelize across multiple containers or worker threads; 3. Use BrowserContexts instead of relaunching browser processes; 4. Mock slow third-party API dependencies; 5. Disable image/font loading in browser options; 6. Run smoke suites on PRs and full regression nightly.
Q24. How do you manage test data and secrets securely in an automation framework?
Experienced • 3-5+ Yrs
Avoid hardcoding credentials. Store environment configurations in .properties or JSON files. Inject sensitive API keys and passwords via environment variables (System.getenv() / process.env) configured in CI/CD secrets (GitHub Secrets / Jenkins Credentials Plugin).
Q25. What is the difference between Soft Assertions and Hard Assertions in TestNG?
Experienced • 3-5+ Yrs
Hard assertions (Assert.assertEquals) immediately halt test execution of that specific method upon failure, skipping subsequent steps. Soft assertions (SoftAssert) record failures without terminating execution, continuing all remaining steps until assertAll() is called at the end of the test.
Q26. How do you handle infinite scroll and lazy loading in web automation?
Experienced • 3-5+ Yrs
Execute JavaScript scrolling asynchronously: ((JavascriptExecutor) driver).executeScript('window.scrollTo(0, document.body.scrollHeight);'); followed by explicit wait for new elements to populate in the DOM, repeating until the scroll height no longer increases.
Q27. Explain ThreadLocal WebDriver implementation for thread-safe parallel execution.
Experienced • 3-5+ Yrs
When running parallel tests in TestNG, a single shared static WebDriver instance causes race conditions. Using ThreadLocal allocates an independent WebDriver instance per thread, accessed via driverThreadLocal.get() and cleaned up in @AfterMethod with driverThreadLocal.remove().
Q28. What is Visual Regression Testing and how does it integrate with Playwright?
Experienced • 3-5+ Yrs
Visual regression compares pixel-by-pixel snapshots against approved baseline images. Playwright provides native visual comparisons via expect(page).toHaveScreenshot('landing.png', {maxDiffPixels: 50}), automatically highlighting discrepancies when UI layouts shift unexpectedly.
Q29. How do you automate WebSocket connections or file downloads in Playwright?
Experienced • 3-5+ Yrs
File downloads are handled via page.waitForEvent('download') which captures the download stream and saves it to a specified path: await download.saveAs('/path/file.pdf'). WebSockets are monitored via page.on('websocket', ws => { ws.on('framereceived', ...); }).
Q30. What metrics evaluate test automation health and ROI in enterprise projects?
Experienced • 3-5+ Yrs
Automation pass rate, Flaky test rate (tests that pass/fail unpredictably), Execution cycle duration, Defect leakage into production, Test maintenance effort vs new feature coverage, and CI build failure turnaround time.
๐ป Section 3: Live Coding Challenges & Scenario Solutions
High-frequency code implementations and practical problems evaluated during technical screening rounds:
Q31. Write a Selenium Java snippet using Explicit Wait for an element to be clickable.
Live Coding Challenge
We use WebDriverWait and ExpectedConditions.elementToBeClickable before calling .click().
Verified answers to common questions regarding SDET & Automation Test Engineer hiring in 2026:
Should I learn Selenium or Playwright for 2026 job markets?
Both are valuable. Selenium remains the industry foundation across massive legacy enterprise frameworks, while Playwright is surging for new web applications, micro-frontends, and fast CI/CD pipelines.
What coding languages are tested in SDET automation rounds?
Java is the dominant language for Selenium + TestNG + Cucumber frameworks. JavaScript/TypeScript is standard for Playwright and Cypress. Python is common in AI/data test automation.
Does 4Achievers provide live lab frameworks for CI/CD test automation?
Yes, 4Achievers includes hands-on Jenkins, Docker, Selenium Grid, Playwright, and GitHub Actions test runner labs with 1-on-1 mentor guidance.
Get official hiring statistics, company-wise CTC packages (₹4.5 LPA to ₹28 LPA), batch Alumni Career Transitionss, and our 500+ verified hiring partners list.
๐ 48,500+ Students Trained
๐ฐ ₹28 LPA Highest CTC
๐ข 500+ Hiring Partners
๐ 120% Average Salary Hike
๐ FREE 1-ON-1 EXPERT ADVICE
Connect with Senior Career Advisor
Get personalized career guidance, batch timings, scholarship eligibility & 1-on-1 Career Mentorship.
STEP 1 OF 4 • EDUCATIONAL BACKGROUND
Find My IT Career Match
Answer 4 quick questions to unlock your personalized high-growth tech roadmap & salary projection.
4Achievers • Student Success Story & Project Session
๐ Fast-Track Your 2026 Placement: Explore 4Achievers Offline & Live Campuses
Complete breakdown of HCL's technical evaluation criteria, live coding rounds, and architecture discussions for Java Full Stack Developer candidates.
Top Java Full Stack Developer Interview Questions for Freshers (0โ2 Years) & Experienced (3โ6 Years)
Master the most frequently asked core Java Full Stack Developer concepts, debugging scenarios, production optimization questions, and behavioral HR answers across top IT MNCs and GCCs.
HCL Java Full Stack Developer Salary Package, Selection Process & Coding Test PDF
2026 Career Authority Mesh
Explore Related 2026 Certification Costs, Courses & Campus Hubs
Recommended Software Testing & Automation QA learning paths, official certification exam fees, and physical classroom training centers.