Skip to main content
SeleniumDecoded
Back to Practice

Coding Challenges

Debug, fix, and write Selenium code in real-world scenarios

beginner 10 min

Replace Brittle Locators

A checkout test uses absolute XPath and styling classes copied from DevTools. Rewrite the locators so a redesign will not break them.

#locators #xpath #css #data-testid #maintenance
Start Challenge
advanced 15 min

Catch the JavaScript Error the Test Missed

A checkout test passes while the page throws an uncaught TypeError. Use WebDriver BiDi to make the test fail on JavaScript errors.

#bidi #console #javascript-errors #quality
Start Challenge
beginner 10 min

The Dropdown That Is Not a Select

The Select helper throws UnexpectedTagNameException on a styled dropdown. Drive the custom widget correctly.

#dropdown #select #custom-widget #actions
Start Challenge
intermediate 20 min

Wait for the Download, Not the Clock

An export test sleeps five seconds and then checks the file exists. It fails on slow CI and is useless on Grid. Wait for the finished file properly.

#downloads #waits #grid #files
Start Challenge
intermediate 20 min

Extract a Page Object

Three tests repeat the same login steps with inline locators. Extract a LoginPage that hides locators and waits.

#page-object-model #refactoring #architecture
Start Challenge
beginner 10 min

Fix the Flaky Login Test

A login test passes locally and fails one run in five on CI. Remove the sleeps and make it deterministic.

#waits #flaky #sleep #explicit-waits
Start Challenge
intermediate 15 min

Survive the Guava Removal in Selenium 4.51

After upgrading the Java client to 4.51, a wait helper class no longer compiles. Migrate it off Guava types to plain Java so it builds on 4.51 and later.

#java #guava #upgrade #4.51 #waits
Start Challenge
beginner 15 min

Replace Every Sleep with a Real Wait

A search test is littered with driver.sleep and setTimeout calls. It takes 14 seconds and still fails in CI. Replace each sleep with the condition it was guessing at.

#waits #sleep #flaky #javascript
Start Challenge
intermediate 10 min

The Payment iFrame Bug

After entering a card number inside the payment iframe, the test cannot find the Pay button. Find and fix the context bug.

#iframe #switch #context #payment
Start Challenge
intermediate 10 min

The 30-Second Negative Check

Asserting that an error is not shown takes 30 seconds every time. Diagnose the wait configuration and fix it.

#implicit-wait #explicit-wait #find-elements #performance
Start Challenge
intermediate 10 min

The Wrong Tab

A test that opens a help link in a new tab sometimes asserts against the original tab. Fix the handle logic.

#windows #tabs #handles #race
Start Challenge
intermediate 15 min

Reach the Input Inside the Shadow Root

A login test throws NoSuchElementException on an email field that is clearly on screen. The field lives inside a web component's shadow root. Fix it.

#shadow-dom #web-components #locators #waits
Start Challenge
intermediate 15 min

Stale Elements in a Delete Loop

Deleting every row in a table throws StaleElementReferenceException after the first deletion. Make the loop robust.

#stale-element #loops #dom #re-find
Start Challenge
beginner 10 min

Find the Row by Its Content, Not Its Position

A test reads a user's status from row 3, column 4 of a table. Sorting changed and now it asserts on the wrong user. Locate the row by content.

#tables #xpath #locators #maintenance
Start Challenge
advanced 20 min

Tests Interfere When Run in Parallel

A suite passes serially and fails chaotically with parallel threads. Find the shared state and isolate each test's driver.

#parallel #thread-local #driver-factory #testng
Start Challenge