Selenium/Playwright Coding Questions
Part of the QA Testing Roadmap
In short
Live coding rounds check whether you can actually automate, not just name tools. Typical asks: handle a new tab, a dropdown, a dynamic table or a flaky wait, while explaining your choices.
Live coding exercises automating a given scenario — testing genuine hands-on automation fluency from Phase 7, not just tool name familiarity.

Think of it like this
The driving test
At the driving test, knowing the rules isn't enough. You drive around cones while the examiner watches every mirror check. A coding round is the same: they watch how you locate, wait and assert, not just whether it runs.
Watch it happen
How to approach any live automation task
1/5Repeat the task back and ask what 'done' looks like. Which browser, language, and what to check at the end?
The big ideas
What you need to know
Tabs and frames
Know how to switch to a new tab and into an iframe in your tool. These come up constantly.
Waits
Selenium needs explicit waits like WebDriverWait. Playwright auto-waits for actions and web-first assertions.
Tables and lists
Practise finding a row by text and reading a cell from it, like 'price of the item named Bag'.
Think aloud
Explain each choice while you type. A half-finished solution with clear reasoning beats silent perfect code.
See it in code
Walk through the code
1test("terms link opens in a new tab", async ({ page, context }) => {2 await page.goto("/signup");3 const [newTab] = await Promise.all([4 context.waitForEvent("page"),5 page.getByRole("link", { name: "Terms" }).click(),6 ]);7 await newTab.waitForLoadState();8 await expect(newTab).toHaveURL(/\/terms/);9});1/3Start listening for a new page before clicking, so the event isn't missed.
A classic interview ask. In Selenium the same idea uses getWindowHandles() and switchTo().window().
Save yourself the pain
Common mistakes
Oops
Using Thread.sleep or waitForTimeout to make it work.
Do this instead
Use explicit or auto waits on a condition, and say why sleeps cause flaky tests.
Oops
Coding silently for ten minutes.
Do this instead
Talk through your plan first, then narrate key decisions as you write.
Your mission
Five classic tasks
Quick check
An element appears after an AJAX call. What's the best way to handle it in a test?
Go deeper
- 1Practice automating common scenarios (login, form submission, navigation) under time pressure.
- 2Review Page Object Model and be ready to structure code that way, not just write a flat script.
- 3Talk through your locator strategy choices out loud as you write code.
More automation & technical at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.