Create a Preview or Service screenshot

Creates a screenshot image of a preview or service.

Arguments

  • id - Required
    The preview or service to create the screenshot for. If this is a service ID, that service is used. If this is a preview ID, that preview's default service is used.

  • url
    The relative URL to take the screenshot of. Default: /

  • waitUntil
    When to consider the page successfully loaded before creating a screenshot. If an array is given, the screenshot is taken after all of the events in the array have fired. Options are load, domcontentloaded, networkidle0, and networkidle2. Default: load

  • timeout
    How long to wait in seconds for a page to load while trying to create a screenshot. Default: 30, Max: 300

  • fullPage
    Whether to use "full page mode" when creating the screenshots. When disabled, the viewport is set statically, and the page's scrollHeight is used to get the entire page, to work around a problem with headless Chrome rendering elements that use styles with vh. Default: true

  • force
    When a screenshot is created, Tugboat caches it. Setting this to true forces Tugboat to re-create the screenshot and overwrite the cached copy. Default: false

Example

socket.emit('tugboat', 'screenshots', 'create', args, callback);

Output

The results include the metadata of the screenshot at mobile, tablet, and desktop screen sizes.

[
    {
        "_id": "5cb6356dfd2894ca0f6f4a21",
        "preview": "5ca6def1144c3009f1f56641",
        "screen": "tablet",
        "service": "5ca6def2144c30fd71f56644",
        "url": "/",
        "createdAt": "2019-04-16T20:05:01.650Z",
        "size": 368979,
        "updatedAt": "2019-04-16T20:05:01.650Z",
        "id": "5cb6356dfd2894ca0f6f4a21",
        "type": "screenshot",
        "screenshot": "5cb6356dfd2894ca0f6f4a21",
        "repo": "5ca6deec144c30f0d4f5663e",
        "project": "5ca41e19d0efa416e0b65b9d"
    },
    {
        "_id": "5cb6356dfd2894ca0f6f4a28",
        "preview": "5ca6def1144c3009f1f56641",
        "screen": "mobile",
        "service": "5ca6def2144c30fd71f56644",
        "url": "/",
        "createdAt": "2019-04-16T20:05:01.798Z",
        "size": 311370,
        "updatedAt": "2019-04-16T20:05:01.798Z",
        "id": "5cb6356dfd2894ca0f6f4a28",
        "type": "screenshot",
        "screenshot": "5cb6356dfd2894ca0f6f4a28",
        "repo": "5ca6deec144c30f0d4f5663e",
        "project": "5ca41e19d0efa416e0b65b9d"
    },
    {
        "_id": "5cb6356efd2894ca0f6f4a88",
        "preview": "5ca6def1144c3009f1f56641",
        "screen": "desktop",
        "service": "5ca6def2144c30fd71f56644",
        "url": "/",
        "createdAt": "2019-04-16T20:05:02.373Z",
        "size": 396762,
        "updatedAt": "2019-04-16T20:05:02.373Z",
        "id": "5cb6356efd2894ca0f6f4a88",
        "type": "screenshot",
        "screenshot": "5cb6356efd2894ca0f6f4a88",
        "repo": "5ca6deec144c30f0d4f5663e",
        "project": "5ca41e19d0efa416e0b65b9d"
    }
]

results matching ""

    No results matching ""