Skip to content

About

This repo includes sample Playright scripts I use

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Playwright Browser Script

This repository contains Playwright scripts for browser automation.

Scripts

open_browser.js

A simple script that opens a Chromium browser window and navigates to webeccentric.com.

open_browser_fill_and_submit_survey.js

A script that automates filling and submitting a sample form on https://example.com/form.

Setup

  1. Install dependencies:

    npm install
    
  2. Install Playwright browsers:

    npx playwright install
    

Running the Scripts

Basic Browser Script

Run the basic script with:

npm start

or

node open_browser.js

By default, this launches a visible Chromium browser window. To run in headless mode (no visible window):

node open_browser.js --headless

Form Filling Script

Run the form filling script with:

npm run survey

or

node open_browser_fill_and_submit_survey.js

By default, this launches a visible Chromium browser window. To run in headless mode:

node open_browser_fill_and_submit_survey.js --headless

Both scripts will perform their actions, wait briefly, and then close the browser.

Note: If running from VS Code's integrated terminal, the browser window may not appear. Run the scripts in a separate Command Prompt or PowerShell window outside of VS Code for the GUI to display.

Requirements

  • Node.js installed
  • Internet connection for navigation

Troubleshooting

  • If nothing happens when running the scripts:
    • Ensure Playwright browsers are installed (npx playwright install).
    • Run the scripts in a separate terminal window (not VS Code's integrated terminal).
    • Check for any error messages in the console output.

About

This repo includes sample Playright scripts I use

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages