Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture the updated price, select the Shopify variant in Playwright, wait for an assertion against the storefront’s visible price, and only then take the screenshot. Don’t use a fixed sleep or networkidle as a substitute for checking the result: the price is the state your capture depends on.

Wait for the price the shopper sees

Shopify product pages use a product form and variant selector, but themes do not share one universal price selector or markup. Inspect the target storefront and choose a stable locator, such as an accessible label or a theme-owned test ID. After changing the variant, use a Playwright web-first assertion to check its expected displayed price. The assertion retries until it passes or times out, and re-evaluates the locator as the page changes. Playwright’s assertion documentation explains this retry behavior.

The selector, option label, test ID, currency, and price in this example are illustrative inputs. Replace them with values from the store you are testing; they are not Shopify-wide conventions.

import { test, expect } from '@playwright/test';

test('captures the selected Shopify variant price', async ({ page }) => {
  await page.goto('https://store.example/products/example');

  // Replace these locators and expected text with values from the target theme.
  await page.getByLabel('Size').selectOption({ label: 'Large' });
  await expect(page.getByTestId('product-price')).toHaveText('$29.00');

  await page.screenshot({ path: 'product-price.png', fullPage: true });
});

For an assertion that accounts for a store’s formatting, use a regular expression or another appropriate matcher. Make sure it still identifies the expected price unambiguously. If availability matters to the test, assert the visible availability state as well. Shopify’s guidance says the displayed price should match the selected variant, and theme requirements address price, compare-at price, and sold-out messaging. Dynamic price and availability changes should also be communicated to screen readers. See Shopify’s variant guidance and Shopify’s accessibility guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
  • Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
  • AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
  • Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
  • Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****

Choose the right screenshot assertion

Save a one-off screenshot

For a bug report, manual review, or other artifact, call page.screenshot() after the price assertion, as in the example above. Use fullPage: true if the artifact should include the page beyond the viewport; omit it for a viewport-only capture.

Compare a visual-regression baseline

In Playwright Test, use toHaveScreenshot when you want to compare the rendered page with a saved expected image:

Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
await expect(page.getByTestId('product-price')).toHaveText('$29.00');
await expect(page).toHaveScreenshot('product.png');

toHaveScreenshot waits for two consecutive page screenshots to match before comparing the result with the expectation, according to the Playwright PageAssertions reference. It is a Playwright Test assertion, not a replacement for page.screenshot() when you only need to save an image.

Keep the browser, operating system, rendering settings, and execution environment consistent between baseline creation and comparison. Differences across environments can affect screenshot output; see Playwright’s visual comparisons guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
  • 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
  • Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
  • 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
  • US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.

Make the test reflect the storefront

  1. Open the product page. Use the actual product URL and handle any consent or setup choices required by your test.
  2. Locate the variant control. Prefer a stable accessible locator, such as a label, or a test ID maintained by the theme.
  3. Select the variant. Use the control’s actual option label or value. Verify that the variant exists and is available if availability is part of the scenario.
  4. Assert the visible result. Match the price as displayed to shoppers, accounting for the store’s currency and formatting. Assert availability too if it affects the expected screenshot.
  5. Capture only after the assertion passes. Save with page.screenshot() or use toHaveScreenshot for a baseline comparison.

Why not wait for network idle or a fixed delay?

A page-load event does not prove that a client-side variant update has completed. A fixed delay can be too short on one run and waste time on another, while still failing to verify the price. Playwright marks networkidle as discouraged for testing and recommends web assertions to assess readiness instead. See the Page API reference. Assert the state the screenshot needs rather than guessing how long it will take.

Troubleshoot a timeout or incorrect capture

  • The price assertion times out: Check that the variant selection succeeded, that the option exists, and that the selected variant is available. Confirm that the locator points to the current, visible price rather than a hidden price element or a stale part of the page.
  • The assertion passes on the wrong price: Tighten the locator to the relevant product price and use an expected value or pattern that accounts for the storefront’s currency and formatting without matching unrelated text.
  • The control cannot be selected: Inspect how the target theme renders the selector and use a locator suited to that control. A label such as “Size” or an option such as “Large” is store-specific, not guaranteed across Shopify storefronts.
  • The screenshot differs from the baseline: Compare in a consistent browser and host environment, and control dynamic page content that is unrelated to the variant state. Rendering differences between environments can change screenshot output.
  • The captured state is sold out or otherwise unexpected: Check the selected variant and assert the user-visible availability state when it is material to the test. Do not treat a price-only assertion as proof that the full product state is correct.

Or skip the browser setup

If you need a screenshot artifact rather than a Playwright interaction test, ScreenshotNeo can capture a URL with one GET request. It removes cookie and consent banners, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks, blank pages, and failed loads are not billed, and the response identifies the page verdict and billing status. Its MCP server gives AI agents screenshot tools. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

For example, this cURL request saves a WebP screenshot of a product page:

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://store.example/products/example -o shot.webp

See the ScreenshotNeo API documentation for request options. Sign up for 1,000 free screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does this test work with every Shopify theme?

The workflow does, but the example selectors and expected price must be adapted to the storefront’s markup and formatting.

Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.

Should I use a screenshot assertion or save a screenshot file?

Use `page.screenshot()` to save a one-off image; use Playwright Test’s `toHaveScreenshot` when you need comparison with a baseline.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.