There is a set of use cases when you want to fail screenshot rendering and retry it if the content of the page is missing a string.
Fail rendering if the content is missing a string
There is a set of use cases when you want to fail screenshot rendering and retry it if the content of the page is missing a string.
For example:
fail_if_content_missing=<some string that present in the working page content>
for your screenshot requests allows you to automatically ignore captures showing “Coming Soon” on a product page, ensuring you only get notified when the page updates to show the product is available for purchase.fail_if_content_missing=<some string that present in the working page content>
, thereby skipping any maintenance messages displayed on your application’s homepage.You don’t pay for failed and cached screenshots with ScreenshotOne.
That’s exactly what you need the option fail_if_content_missing
for.
Let’s quickly see how it works and how you can use it. Let’s first render the example.com page:
https://api.screenshotone.com/take?url=https://example.com&fail_if_content_missing=example+domain&access_key=<your access key>
The result is:
As you might notice, the match is case insensitive, it is done for simplicity.
Now, let’s try to fail it:
https://api.screenshotone.com/take?fail_if_content_missing=some+random+string+to+fail&url=https://example.com&access_key=<your access key></your>
The result is:
{ "is_successful": false, "error_message": "The page content is missing the requested string `some random string to fail` by the `fail_if_content_missing` option. If it seems to be a mistake or not what you expected, please, reach out to `support@screenshotone.com` as quickly as possible, and will assist and try to resolve your problem.", "error_code": "content_missing_requested_string"}
It works!
Also check out the fail_if_content_contains option.
Interviews, tips, guides, industry best practices, and news.
Now you can detect fonts used by any website with ScreenshotOne API in just one simple API call.
From today ScreenshotOne supports GPU rendering for both regular and animated website screenshots. The API now leverages the latest in graphics processing technology to bring your screenshot needs to a whole new level.
Use a new option to fail ScreenshotOne API requests on purpose.
Exhaustive documentation, ready SDKs, no-code tools, and other automation to help you render website screenshots and outsource all the boring work related to that to us.