Have you ever needed to submit a contact form on dozens — or hundreds — of websites? I recently faced this problem: 120 websites, and manually filling each form was impossible.
So I built a Node.js script using Playwright that does it automatically. In this article, I'll walk you through how it works, the challenges I ran into, and what I learned.
What is Playwright?
Playwright is a browser automation library developed by Microsoft. It lets you control Chromium, Firefox, and WebKit browsers programmatically. Unlike simple HTTP clients, Playwright runs a real browser, which means it can handle:
- JavaScript-rendered forms
- Dynamic content
- Popups and cookie banners
- Complex interactions
This makes it perfect for form automation where the page is not just static HTML.
The Problem
I had a list of 120 construction company websites. For each one, I needed to:
- Open the contact page
- Fill in name, email, and message
- Submit the form
Doing this manually would take hours. And I needed to do it repeatedly.
Setup
First, install the dependencies:
bash
npm init -y
npm install playwright axios cheerio xlsx
npx playwright install chromium
Top comments (0)