To capture a mobile page without a cookie banner, set the mobile viewport before navigation, wait for the consent interface, and handle it through the test’s normal accept, reject, or settings flow before calling page.screenshot({ fullPage: true }). If you only need a clean visual artifact, use Playwright’s screenshot-time mask or style option instead. Those options change the image—not the site’s consent state.
Why the banner appears in a full-page screenshot
fullPage: true expands the capture to the full scrollable page rather than just the visible viewport; it does not dismiss overlays. A cookie banner can therefore remain in the screenshot and cover content, whether it is fixed to the viewport or part of the page layout. The right fix depends on what the screenshot is meant to verify.
Playwright’s Page API documentation advises handling predictable overlays explicitly in the normal test flow. It also describes page.addLocatorHandler() for overlays that appear unexpectedly. That handler runs around actions or auto-waiting assertions, so it is not a general-purpose step that automatically runs just before every screenshot.
Choose the method that matches the test
| Method | Use it when | What it verifies | Trade-off |
|---|---|---|---|
| Interact with the consent interface, then capture | The screenshot should show the page after a real consent choice | The interaction and resulting page state | Requires the site’s actual controls and appropriate consent-state setup |
| Mask or style the screenshot | The banner is irrelevant to a particular visual artifact | The visible layout apart from the masked or styled element | Does not perform consent or update the site’s state; can conceal a banner regression |
| Capture with the banner visible | The consent experience itself is under test | The banner’s presence and visual behavior | The banner remains in the image and may obscure content |
Do not accept consent simply to make an image look tidy if the test is supposed to represent a different user choice. For a test of the consent UI, keep it visible and assert its behavior. For a post-consent page, make the intended choice. For an artifact where the banner is out-of-scope noise, use a capture-only treatment.
Free tools Windows power users keep installed
One-click scans. No signup required.
Set up mobile emulation before navigation
Use a Playwright device profile or set the viewport before visiting the page. The emulation guide documents device emulation, while the Page API notes that some sites do not expect a phone viewport to change size and recommends setting the viewport before navigation when using setViewportSize.
As an Amazon Associate I earn from qualifying purchases.
Keep the device or viewport, browser, locale, and storage state consistent across runs when those settings affect the page. A reproducible setup helps ensure that the banner and responsive layout are evaluated under the intended mobile conditions.
Dismiss a predictable banner through its real controls
Use a locator that matches the site’s actual consent interface, wait for it to appear, and then take the choice required by the test. The example below illustrates the sequence; replace the button name with the one actually shown on the target site, and select the appropriate action rather than treating acceptance as a default.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →import { test, expect, devices } from '@playwright/test';
test('capture the post-consent mobile page', async ({ browser }) => {
const context = await browser.newContext({
...devices['iPhone 13'],
});
const page = await context.newPage();
await page.goto('https://example.com');
const consent = page.getByRole('dialog', { name: /cookie|consent/i });
await expect(consent).toBeVisible();
// Use the choice required by this test; this example accepts cookies.
await consent.getByRole('button', { name: /accept all/i }).click();
await expect(consent).toBeHidden();
await page.screenshot({ path: 'mobile-full-page.png', fullPage: true });
await context.close();
});
The locator and button labels are site-specific: some sites do not expose a dialog role, use different text, or present separate accept, reject, and preferences controls. Inspect the real interface and choose a locator and action that reflect the behavior under test. If the expected consent control never appears, do not hide that failure by silently skipping the assertion; investigate whether the site, locale, prior storage, or viewport changed the prompt.
#1 Best Overall
- 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.****
Mask or style the banner only at capture time
When consent behavior is not being tested and the goal is solely to produce a stable image, Playwright’s screenshot API supports mask locators and a screenshot style option. A mask covers the matched element’s bounding box in the output. A style can change or hide dynamic elements for the capture and, according to the API documentation, applies through Shadow DOM and inner frames.
// Mask the banner in this image; this does not accept or reject consent.
await page.screenshot({
path: 'mobile-page-masked.png',
fullPage: true,
mask: [page.locator('[data-testid="cookie-banner"]')],
});
For a temporary style, target the site’s actual banner selector and hide it only for the screenshot:
await page.screenshot({
path: 'mobile-page-styled.png',
fullPage: true,
style: `
[data-testid="cookie-banner"] {
visibility: hidden !important;
}
`,
});
Both examples alter the screenshot artifact, not the application’s consent state. A mask or hiding style can also conceal a layout or consent-interface defect, so avoid it in a test whose purpose is to check that interface.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #2
- 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.
Make screenshot comparisons meaningful
Playwright Test screenshot assertions support masking and pixel-difference controls. Decide what should remain stable based on the test’s purpose: if the consent component is under test, do not mask it; if it is unrelated to the comparison, masking may keep its changing content out of the comparison. The Playwright documentation does not prescribe one universal tolerance for this scenario, so choose it for the page and the specific visual behavior being checked.
For repeatability, keep the relevant browser context settings and consent state consistent between runs. Treat a screenshot of the pre-consent page, a screenshot after accepting, and a screenshot after rejecting as different states—not interchangeable baselines.
Rank #3
- 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.
Common problems and fixes
- The banner still covers the page.
fullPagechanges capture extent, not page behavior. Wait for the consent UI and interact with it, or apply a screenshot-only mask or style if the banner is out of scope. - The consent locator times out. Confirm the banner appears at the chosen viewport, that storage state has not already removed it, and that the locator matches the actual markup and accessible name. Keep the assertion if the banner’s appearance is part of the test.
- A locator handler did not remove the banner before capture. A locator handler is not a pre-screenshot hook; it runs around actions or auto-waiting assertions. Handle a predictable prompt directly in the test flow before the screenshot.
- The page is not using the intended mobile layout. Configure the device profile or viewport before navigation and keep it consistent. Resizing later may not reproduce the same behavior on sites that do not expect a phone viewport to change size.
- The image is clean but consent was never exercised. A mask or style only changes what is captured. Use the site’s actual control flow when the resulting consent state matters.
- Visual assertions fail because the banner changes. Decide whether the banner is in scope. Keep it in the assertion if testing consent; otherwise mask or style the volatile element and set comparison tolerance for the page rather than relying on a universal threshold.
Or skip the browser setup
If your goal is simply to get a clean screenshot rather than test a consent flow, ScreenshotNeo offers a website screenshot API that can return PNG, JPEG, WebP, or PDF. A basic call is:
Quick Recap
Best Value
- 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.
Rank #4
- 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://example.com
-o shot.webp
See the ScreenshotNeo API documentation for request options. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan.
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.




