Task Progress0 of 2 Tasks
0%

Progress Bar Challenge

Wait for a moving element to reach a state. The bar grows by a random step every half second, so a fixed sleep stops it at a different place each run. Each task ticks itself the moment your script gets it right.

1.Interactive progress bar

Stop at 75% or moreTo do
Start the bar, then stop it at 75% or more
Goal

Click Start, wait until the bar reaches at least 75%, then click Stop.

Wait for 100% and the messageTo do

Use the progress bar above.

Goal

Click Start, let the bar run to 100%, and assert “Process Completed Successfully!”.

2. Solutions

Try the challenges yourself first. Reference solutions are hidden until you ask for them.

About this Progress Bar page

Testing a progress bar means checking that it advances and reaches a state, usually 100 percent, before the next step runs. Read the value from aria-valuenow, a style width or text, then wait for it with a condition. In Selenium use WebDriverWait. Playwright and Cypress retry assertions such as toHaveAttribute until the bar completes.

Screenshot of the Progress Bar practice page on QA Playground. Test waits on a dynamic progress bar.
Progress Bar: Test waits on a dynamic progress bar.

Frequently asked questions

How do I wait for a progress bar to reach 100% in Selenium?

Use WebDriverWait with a condition on the bar, for example text_to_be_present_in_element or a lambda that reads aria-valuenow and returns true at 100. Set a timeout longer than the bar's expected duration so a stuck bar fails the test instead of hanging.

How do I read the progress bar value in Playwright?

Use expect(bar).toHaveAttribute('aria-valuenow', '100') for a web-first assertion that retries. To read it once, call await bar.getAttribute('aria-valuenow'). Avoid reading it in a loop with sleeps, because the assertion already retries.

How can I stop a progress bar at a specific percentage?

Poll the value and click Stop when it reaches the target. Exact stops are timing sensitive, so tests usually accept a range, such as 70 to 80. In Playwright use expect.poll on the value, then click and assert the range.

Why does my progress bar test fail intermittently?

Common causes are asserting before the bar finishes, using a fixed sleep shorter than the run time, or reading a stale element after a re-render. Wait on the bar's state with a timeout and re-locate the element when the DOM changes.

Is aria-valuenow reliable for progress bars?

It is when the bar uses role=progressbar and updates the attribute, which is the accessible pattern. Some bars only change a style width. Inspect the element first and assert on whichever attribute the page actually updates.

Free developer tools on Randomly.online

QA Playground is part of Randomly.online. These tools help while you write and debug tests: