Skip to main content

Browser Automation with Playwright on Morph Cloud

tl;dr Run Playwright browser automation scripts on scalable cloud instances. Create, branch, and restore browser environments within seconds for parallel testing and web scraping.

Browser Automation with Playwright

Prerequisites

Install the Morph Cloud SDK

To get started, install the Morph Python SDK:

uv pip install morphcloud

Set your API key

export MORPH_API_KEY='your-key-here'

You can generate an API key in the Morph Cloud console.

Quick Start

Launch browser automation environments with Playwright support in seconds. Perfect for web scraping, testing, and automated browsing tasks.

📁 Complete Browser Automation Example

The example includes:

  • Hacker News scraping with story extraction
  • Playwright integration with Chrome DevTools Protocol
  • Session management and cleanup
  • Error handling and logging

Getting Started

# Install dependencies
uv pip install morphcloud playwright

# Set your API key
export MORPH_API_KEY='your-key-here'

# Clone and run the complete example
git clone https://github.com/morph-labs/morph-python-sdk.git
cd morph-python-sdk/examples
python browser_example.py