Playwright

Playwright enables reliable end-to-end testing for modern web apps.

Go to site
Explore
/
Apps
/
Playwright

Playwright API Integrations

Build and run workflows using the Playwright API. Use 1000s of source-available triggers and actions across 2,000+ apps. Or write custom code to integrate any app or API in seconds.

Overview

Playwright is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol. Playwright runs in headless mode on Chromium on Pipedream.

Using Playwright you can perform tasks including:

  • Capture Screenshots: Convert webpages into images.
  • Processing PDFs: parse and scan PDFs.
  • Web Scraping: Extract data from websites.
  • UI/UX Testing: Verify user interface and experience.
  • Integration with Test Frameworks: Combine with testing frameworks.
  • Task Automation: Automate web-related tasks like form filling.
  • Functional Testing: Automate user interactions to test web application functionality.
  • Regression Testing: Ensure new code changes don't introduce bugs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { playwright } from '@pipedream/browsers';

export default defineComponent({
  async run({steps, $}) {
    const browser = await playwright.launch();
    
    // Interact with the web page programmatically
    // See Playwright's Page documentation for available methods:
    // https://playwright.dev/docs/api/class-page
    const page = await browser.newPage();

    await page.goto('https://pipedream.com/');
    const title = await page.title();
    const content = await page.content();

    // Close context and browser otherwise the step will hang
    await page.context().close()
    await browser.close();

    return { title, content }
  },
})

Choose an API to Connect with Playwright API

1
-
24
of
2,000+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Salesforce (REST API)
Salesforce (REST API)
Web services API for interacting with Salesforce
HubSpot
HubSpot
HubSpot's CRM platform contains the marketing, sales, service, operations, and website-building software you need to grow your business.
Zoho CRM
Zoho CRM
Zoho CRM is an online Sales CRM software that manages your sales, marketing, and support in one CRM platform.
Stripe
Stripe
Stripe powers online and in-person payment processing and financial solutions for businesses of all sizes.
Shopify Developer App
Shopify Developer App
Shopify is a user-friendly e-commerce platform that helps small businesses build an online store and sell online through one streamlined dashboard.
WooCommerce
WooCommerce
WooCommerce is the open-source ecommerce platform for WordPress.
Snowflake
Snowflake
A data warehouse built for the cloud
MongoDB
MongoDB
MongoDB is an open source NoSQL database management program.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
ServiceNow
ServiceNow
The smarter way to workflow
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Microsoft Teams
Microsoft Teams
Microsoft Teams has communities, events, chats, channels, meetings, storage, tasks, and calendars in one place.

Getting Started

No authentication is required to use Playwright in your Pipedream workflows. Pipedream publishes a specific NPM package that is compatible with the Pipedream Execution Environment. This package includes the headless Chromium binary needed to run a browser headlessly within your Pipedream workflows.

Simply import this package, launch a browser and navigate using a Playwright Page instance.

Usage in Node.js Code Steps

To get started, import the @pipedream/browsers package into your Node.js code step. Pipedream will automatically install this specialized package that bundles the dependencies needed to run playwright in your code step.

This package exports a playwright module that exposes these methods:

  • browser(opts?) - method to instantiate a new browser (returns a Playwright Browser instance)
  • launch(opts?) - an alias to browser()
  • newPage() - creates a new Playwright Page instance and returns both the page & browser

Note: After awaiting the browser instance, make sure to close the browser at the end of your Node.js code step.

import { playwright } from '@pipedream/browsers';

export default defineComponent({
  async run({steps, $}) {
    const browser = await playwright.browser();
    
    console.log(browser)
    // get page, perform actions, etc.

    await browser.close();
  },
})

Usage in Sources or Actions

The same @pipedream/browsers package can be used in actions as well as sources.

The steps are the same as usage in Node.js code. Open a browser, create a page, and close the browser at the end of the code step.

Please note: At this time Source's memory are not configurable and are fixed to 256 mb. This is below the recommened 2 gbs for usage in workflows.

Get Page HTML with Playwright API on New Booking Created from Square API
Square + Playwright
 
Try it
Get Page HTML with Playwright API on New Incoming SMS (Instant) from Twilio API
Twilio + Playwright
 
Try it
Take Screenshot with Playwright API on New Updates (Instant) from Telegram Bot API
Telegram Bot + Playwright
 
Try it
Take Screenshot with Playwright API on New Requests from HTTP / Webhook API
HTTP / Webhook + Playwright
 
Try it
Take Screenshot with Playwright API on New Item in Feed from RSS API
RSS + Playwright
 
Try it
Get Page HTML with the Playwright API

Returns the page's html. See the documentation

 
Try it
Get Page Title with the Playwright API

Returns the page's title. See the documentation

 
Try it
Page PDF with the Playwright API

Generates a pdf of the page and store it on /tmp directory. See the documentation

 
Try it
Take Screenshot with the Playwright API

Store a new screenshot file on /tmp directory. See the documentation

 
Try it

Troubleshooting

Workflow exited before step finished execution

Remember to close the browser instance before the step finishes. Otherwise, the browser will keep the step "open" and not transfer control to the next step.

Out of memory errors or slow starts

For best results, we recommend increasing the amount of memory available to your workflow to 2 gigabytes. You can adjust the available memory in the workflow settings.

Authentication

The Playwright API does not require authentication.