October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

How to Get the Status Text from a Puppeteer Response

Call statusText() on a Puppeteer HTTPResponse to get its human-readable status phrase. Learn how to obtain the response and distinguish it from the status code and success boolean.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call statusText() on Puppeteer’s HTTPResponse object:

const statusText = response.statusText();
console.log(statusText); // e.g. "OK"

It returns the response’s human-readable status phrase as a string. In Puppeteer 25.12.0, the API reference says a successful response is usually “OK,” but the phrase is not guaranteed to be the same for every server response.

As an Amazon Associate I earn from qualifying purchases.

Get the status text from a navigation response

Navigation methods such as page.goto() return an HTTPResponse when the navigation receives an HTTP response. Call statusText() on that object:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const response = await page.goto('https://example.com');

if (response) {
  console.log(response.statusText());
}

Check that response exists before calling a method. Some navigations, including a navigation to about:blank or a same-URL hash change, may not produce a response.

Read status text from every response event

A page’s response event supplies an HTTPResponse when a response is received. Register a listener before starting the action whose responses you want to inspect:

page.on('response', response => {
  console.log(response.url(), response.statusText());
});

await page.goto('https://example.com');

This handler runs for responses to page requests, not only the main document. Use response.url() or other response details if you need to identify which request the phrase belongs to.

Status text, status code, and success are different

Method Returns Use it for
statusText() A string, such as OK Displaying or logging the response’s human-readable phrase.
status() A number, such as 200 Checking a specific HTTP status code.
ok() A boolean Checking whether the status falls in the 200–299 range.

Use the numeric status or ok() for conditional logic. A status phrase is descriptive text, not a reliable substitute for checking the code.

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

HTTP error responses are not request failures

An HTTP response with status 404 or 503 is still a response. Puppeteer’s event model does not treat an HTTP error code as a failed request by itself; the requestfailed event is for request failures such as a timeout. Inspect status() or ok() to detect an HTTP error response.

page.on('response', response => {
  if (!response.ok()) {
    console.log('HTTP error:', response.status(), response.statusText(), response.url());
  }
});

Troubleshooting

  • response is null: The operation may not have produced an HTTP response. Check for this before calling statusText().
  • You need to detect errors: Do not test the wording returned by statusText(). Use !response.ok() for non-2xx statuses or compare response.status() with a specific code.
  • Your handler does not report a 404 as a request failure: That is expected. A 404 is an HTTP response; inspect it in the response handler using status() or ok().
  • You see no response text for a request: A timeout or other request failure may produce no HTTP response. Handle the request failure separately rather than expecting statusText() to be available.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a website screenshot rather than Puppeteer response metadata, ScreenshotNeo can return an image or PDF with one GET request. Before capture it accepts consent banners and removes known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, and failed loads are never billed; an MCP server lets AI agents take screenshots; and 1,000 screenshots a month are free with no card, with paid plans starting at $5 for 3,000.

See the ScreenshotNeo API documentation for request options. Example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Sign up for free to get 1,000 screenshots a month with no card.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
The SQL Programming Language: .
  • Used Book in Good Condition

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.