Getting Started - Puppeteer Remote Test
You can use the Testable platform as a remote Puppeteer/CDP grid. Each Puppeteer session will run on a Testable test runner according to the options you provide in the URL. This includes support for all Cloud providers, in your account or ours, as well as self-hosted test runners.
This guide provides a simple example to get you started using Puppeteer with Testable. Read our Puppeteer remote testing guide for the full set of options that we support. We also publish a full set of examples on GitHub at testable/puppeteer-remote-examples.
Testable Cloud’s Puppeteer grid is accessible at:
wss://cdp.testable.io
Here is an example Puppeteer script to use the Testable Cloud Puppeteer grid:
const puppeteer = require('puppeteer');
const { URLSearchParams } = require('url');
(async () => {
try {
const params = new URLSearchParams({
// API key (Org Management => API Keys)
key: process.env.TESTABLE_KEY,
// Browser name: chrome, edge
browserName: 'chrome',
// Browser version (e.g. latest, latest-1, 90)
browserVersion: 'latest',
// Should match the version of Puppeteer you are using. If not specified, defaults to
// the version which supports the chosen browser version.
puppeteerVersion: '18.6.0',
// Size of the display (WxH)
screenResolution: '1920x1080',
// The region in which to run your test (use our remote configurator to see the full list of options)
region: 'aws-us-east-1'
}).toString();
let browser = await puppeteer.connect({
timeout: 0,
browserWSEndpoint: `wss://cdp.testable.io?${params}`
});
let page = (await browser.pages())[0];
await page.setViewport({ width: 1920, height: 1080 });
await page.goto('https://google.com');
await page.waitForTimeout(1000);
await page.screenshot({ path: 'google.png' });
await browser.close();
} catch (err) {
console.log(err);
}
})();
This very simple example loads google.com
in the latest version of Chrome, waits 1 second, and then takes a screenshot.
During and after your test run you should also be able to login to Testable and see your session under Recent Test Runs
.
Click the magnifying glass to view the full test report including a video recording, metrics, Puppeteer logs, etc.
You can also use our website’s remote configurator to discover the full set of options and their possible values. After logging in, use the Create Test action menu and choose Remote Test.
That’s it! Go ahead and try these same steps with your own scripts and feel free to contact us with any questions.