What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Wait for the application to finish its SAML redirect and show an authenticated state, then take the screenshot. In Playwright, use the app’s final URL, a meaningful logged-in UI element, or—ideally—both as the completion signal; do not rely on a fixed sleep alone.
Wait for the application to finish logging in
SAML sign-in commonly moves the browser between the application and an identity provider before returning to the application. Reaching the application’s destination URL can indicate that the redirect completed, but checking for an authenticated control helps confirm the application has also established its own session. Playwright’s authentication guide demonstrates waiting for the final URL and using an authenticated UI assertion as an alternative signal.
As an Amazon Associate I earn from qualifying purchases.
await page.waitForURL('https://app.example.com/');
await expect(page.getByRole('button', { name: 'Account' })).toBeVisible();
await page.screenshot({ path: 'logged-in.png', fullPage: true });
Replace the example URL and button locator with the destination and element used by your application. The two conditions shown are illustrative: choose signals that reflect the actual post-login flow. If the URL is stable and deterministic, it is useful for recognizing the redirect completion; the UI check confirms a relevant logged-in control is visible.
Use a complete Playwright setup
This runnable TypeScript example starts at the application’s sign-in page, performs the login steps you supply, waits for the application’s authenticated state, and saves a screenshot. Replace the example selectors and login actions with those required by your service. Use environment variables for credentials rather than committing them to the script.
#1 Best Overall
import { test, expect } from '@playwright/test';
test('capture the authenticated application page', async ({ page }) => {
await page.goto('https://app.example.com/login');
// Replace these example actions with your application's sign-in flow.
await page.getByRole('button', { name: 'Sign in with SSO' }).click();
await page.getByLabel('Email').fill(process.env.SSO_EMAIL ?? '');
await page.getByRole('button', { name: 'Next' }).click();
await page.getByLabel('Password').fill(process.env.SSO_PASSWORD ?? '');
await page.getByRole('button', { name: 'Sign in' }).click();
// Wait for the SAML redirect to return to the app and for its UI to be ready.
await page.waitForURL('https://app.example.com/');
await expect(page.getByRole('button', { name: 'Account' })).toBeVisible();
await page.screenshot({ path: 'logged-in.png', fullPage: true });
});
The login controls vary by application, identity provider, and any multi-factor or consent steps. Adapt the actions to that flow; retain a state-based check for the authenticated application before capture. The screenshot method is documented in Playwright’s Page API.
Choose the right completion condition
- Final URL: Use
page.waitForURL()when the post-login destination is known and remains stable. Match the actual final URL or an appropriate URL pattern if the app adds variable query parameters. - Authenticated UI: Assert a visible element that only appears for a signed-in user, such as an account menu or application dashboard heading. Avoid generic elements shared with the login page.
- Both: Waiting for the destination and then asserting a meaningful control is a practical combination when the app renders after the redirect. If the app redirects through multiple intermediate routes, identify the final application state rather than waiting for an identity-provider URL.
A fixed delay such as waitForTimeout() does not establish that authentication completed: a slow flow may still be in progress when it ends, while a fast flow wastes time. If the page has an additional app-specific loading state, wait for that state to resolve or for the required content to appear.
Rank #2
Save and reuse authentication state carefully
When a workflow needs repeated captures, Playwright can save browser storage state after login and load it in later browser contexts, as shown in its authentication guide. Treat that state file as a credential: it may contain cookies or headers capable of impersonating the account. Keep it out of source control, restrict access, and store it only where your automation environment protects secrets. Recheck the authenticated UI after loading the state; saved state does not replace the need to verify that the current application session is valid.
Capture the needed area and protect sensitive details
For a viewport screenshot, omit fullPage or set it to false. Set fullPage: true to capture the full page beyond the visible viewport. If a screenshot must not show a sensitive region, Playwright’s Page screenshot API supports masking selected locators:
Rank #3
await page.screenshot({
path: 'logged-in-redacted.png',
fullPage: true,
mask: [page.locator('[data-testid="account-number"]')]
});
Use a locator that targets the actual sensitive content, and check the saved image to verify the intended area was obscured. Masking is a capture option; it does not remove sensitive data from the page or from other logs and artifacts.
When the screenshot still shows a login page
- The capture happens before the redirect finishes: Move the screenshot call after
waitForURL()and the authenticated UI assertion. - The URL wait passes but the app is not ready: Add an assertion for a meaningful signed-in element or the specific content that must be present, rather than adding an arbitrary delay.
- The locator never appears: Verify that it is unique to an authenticated session, that the test account has access to that view, and that the locator matches the current UI and accessible name.
- The saved state no longer works: The session may have expired or the app may require additional authentication. Run the login flow again, save fresh state, and keep the file protected as a credential.
- A screenshot operation fails during a SAML flow: Isolated Playwright issue reports describe failures in particular CDP or Microsoft SAML configurations, including a report associated with a specific newer Playwright version. These reports are configuration-specific, not evidence of a general SAML limitation; check the exact browser, Playwright version, and issue conditions before applying a reported workaround. See the individual reports at issue 14731 and issue 30069.
For visual tests, distinguish an assertion from a one-off capture
If the goal is to compare a page against a stored visual baseline, Playwright’s toHaveScreenshot() assertion waits until two consecutive screenshots match before comparing them, and animations are disabled by default for that assertion path. That stabilization behavior belongs to the visual assertion; do not assume it applies to a basic page.screenshot() call. See the visual comparisons guide.
Rank #4
Or skip the browser setup
For pages that can be captured without an interactive SAML login, ScreenshotNeo offers a one-request screenshot API. It cannot replace the authenticated Playwright workflow for a page that requires signing in through SAML; use it only where the target page is accessible to the service without that browser login.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Best Value
Frequently Asked Questions
Can ScreenshotNeo capture a page that requires my SAML session?
The API example is for pages accessible to the service without an interactive SAML browser login. For a page that depends on your SAML session, use the Playwright workflow above.
Should I use `waitForURL()` or an authenticated-element assertion?
Use the signal that reflects your app’s actual login completion. A stable final URL can confirm the redirect; an authenticated UI assertion confirms a signed-in control is visible. Combining them is useful when both conditions matter.
Quick Recap
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.




