# Website Content Extractor and Screenshot Tool

**Use case:** 

Run this task to navigate to a specified URL, extract the content over webpage. Additionally, capture a screenshot of the page to preserve the layout. This configuration is tailored for accurately retrieving key elements from webpages to inform your research or reporting needs.

## Input

```json
{
  "browser_type": "chromium",
  "headless": false,
  "stealth_mode": false,
  "template_params": {
    "search_query": "your search term",
    "max_results": 10
  },
  "actions": [
    {
      "type": "navigate",
      "value": "https://example.com"
    },
    {
      "type": "get_title"
    },
    {
      "type": "extract_text",
      "selector": "body"
    },
    {
      "type": "screenshot"
    }
  ],
  "export_format": "json",
  "delay_between_actions": 0,
  "max_retries": 2,
  "continue_on_error": true,
  "max_actions_per_run": 100,
  "page_load_timeout": 30000,
  "viewport_width": 1920,
  "viewport_height": 1080,
  "mcp_max_sessions": 8,
  "mcp_idle_timeout_secs": 300
}
```

## Output

```json
{
  "success": {
    "label": "Success",
    "format": "boolean"
  },
  "stats.total_actions": {
    "label": "Total Actions",
    "format": "integer"
  },
  "stats.successful_actions": {
    "label": "Successful",
    "format": "integer"
  },
  "stats.failed_actions": {
    "label": "Failed",
    "format": "integer"
  },
  "stats.retried_actions": {
    "label": "Retried",
    "format": "integer"
  },
  "stats.average_action_time_ms": {
    "label": "Avg Time (ms)",
    "format": "number"
  },
  "stats.total_execution_time_ms": {
    "label": "Total Time (ms)",
    "format": "number"
  },
  "stats.screenshots_captured": {
    "label": "Screenshots",
    "format": "integer"
  },
  "timestamp": {
    "label": "Completed At",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Playwright MCP Server Actor is ready to run with the inputs already set for "Website Content Extractor and Screenshot Tool". [Sign up or log in](https://console.apify.com/create-task-from-example/MMClCpo6qy4OLZhs3) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Website Content Extractor and Screenshot Tool" task

The Playwright MCP Server Actor will start running based on the input automatically. You can also change all the input fields, like browser type, headless mode, and more, to match your specific use case.

### 3. Receive the "Website Content Extractor and Screenshot Tool" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as success, total actions, successful, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Website Content Extractor and Screenshot Tool" task via API](https://apify.com/upadhyay.labs/playwright-mcp-server.md).

## FAQ

### What does the Website Content Extractor and Screenshot Tool do?

The Website Content Extractor and Screenshot Tool navigates to a specified URL, extracts webpage content, and captures a screenshot.

### What output fields are included when I run this task?

The task returns a success boolean, total actions executed, statistics on successful, failed, and retried actions, average action time, total execution time, number of screenshots captured, and a completion timestamp.

### Can I automate running this task at scheduled intervals?

The task can be scheduled to run automatically through the Apify Console.

### How does the 'success' field affect my task results?

The 'success' field indicates whether the entire task run was successful, helping users determine the outcome of their extraction process.

### What information does the screenshot feature provide?

The screenshot feature captures an image of the page layout at the moment of extraction, preserving visual context.

### How do I retrieve text from specific page elements?

This task is configured to extract the text from an 'h1' element on the specified webpage.

### Is a valid URL required to run this task?

The task requires a valid URL as input to navigate to the specific webpage for content extraction.

## About this Actor

This example demonstrates how to use [Playwright MCP Server](https://apify.com/upadhyay.labs/playwright-mcp-server.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/upadhyay.labs/playwright-mcp-server.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/upadhyay.labs/playwright-mcp-server.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
