Screenshot

overview page of web interface
Screenshot tab of log inspection
This feature require Javascript Rendering enabled

Introduction

You can take multiple screenshots of a webpage. You have a choice between full page or specific zone via CSS selector.

The screenshot feature works beside the scraper, which means you can still scrape as usual and use the screenshot features. The upstream response is not altered with a screenshot.

Screenshots can help you to debug, track visual changes, and generate thumbnails of a website.

You can take a maximum of 10 different screenshots per scrape.

Example

In this example, we take three screenshots. One full-page and two others via CSS selector

Interactive Example: Amazon Example
openapi openapi Amazon Example Sign in
            curl -X GET https://api.scrapfly.io/scrape?key=__API_KEY__&url=https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L&render_js=true&screenshots%5Bfull-page%5D=fullpage&screenshots%5Bsimilarities%5D=.similarities-widget&screenshots%5Bprice%5D=%23price
        
HTTP Call Pretty Print
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L&render_js=true&screenshots%5Bfull-page%5D=fullpage&screenshots%5Bsimilarities%5D=.similarities-widget&screenshots%5Bprice%5D=%23price

key
=
url
= https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L
render_js
= true
screenshots[full-page]
= fullpage
screenshots[similarities]
= .similarities-widget
screenshots[price]
= %23price
openapi openapi Amazon Result Example | Json
            {
    ...
    "result": {
        ...
        "screenshots": {
            "main": {
                "extension": "png",
                "format": "fullpage",
                "css_selector": null,
                "size": 2867974,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/main"
            },
            "similarities": {
                "extension": "png",
                "format": "element",
                "css_selector": ".similarities-widget",
                "size": 109817,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/similarities"
            },
            "price": {
                "extension": "png",
                "format": "element",
                "css_selector": "#price",
                "size": 10364,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/price"
            }
        }
        ...
    }
    ...
}

        

Errors

In some situations, the screenshot system won't be able to take it. For many reasons:

  • Huge page : Require a large amount of memory - to keep our service stable, we prefer to shut down the rendering
  • Broken script : For unknown reason at the time, when web pages contain bugged / no well-scripted javascript, the rendering system might crash

In case of error API will return you error code : ERR::SCRAPE::UNABLE_TO_TAKE_SCREENSHOT

Integration