Skip to main content
Version: 1.3

utils.playwright

A namespace that contains various utilities for Playwright - the headless Chrome Node API.

Example usage:

const Apify = require('apify');
const { playwright } = Apify.utils;

// Navigate to https://www.example.com in Playwright with a POST request
const browser = await Apify.launchPlaywright();
const page = await browser.newPage();
await playwright.gotoExtended(page, {
url: 'https://example.com,
method: 'POST',
});

playwright.gotoExtended

Extended version of Playwright's page.goto() allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class.

NOTE: In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades performance.

Parameters:

Returns:

Promise<(Response|null)>