All Projects → lucacasonato → Deno Puppeteer

lucacasonato / Deno Puppeteer

Licence: mit
A port of puppeteer running on Deno

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Deno Puppeteer

Phantomas
Headless Chromium-based web performance metrics collector and monitoring tool
Stars: ✭ 2,191 (+1611.72%)
Mutual labels:  automation, puppeteer, headless-chrome
Awesome Puppeteer
A curated list of awesome puppeteer resources.
Stars: ✭ 1,728 (+1250%)
Mutual labels:  automation, puppeteer, headless-chrome
Puppeteer Extra
💯 Teach puppeteer new tricks through plugins.
Stars: ✭ 3,397 (+2553.91%)
Mutual labels:  automation, puppeteer, headless-chrome
Puphpeteer
A Puppeteer bridge for PHP, supporting the entire API.
Stars: ✭ 1,014 (+692.19%)
Mutual labels:  automation, puppeteer, headless-chrome
Apify Js
Apify SDK — The scalable web scraping and crawling library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.
Stars: ✭ 3,154 (+2364.06%)
Mutual labels:  automation, puppeteer, headless-chrome
Squidwarc
Squidwarc is a high fidelity, user scriptable, archival crawler that uses Chrome or Chromium with or without a head
Stars: ✭ 125 (-2.34%)
Mutual labels:  puppeteer, headless-chrome
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+642.19%)
Mutual labels:  automation, headless-chrome
Puppeteer Sharp Extra
Plugin framework for PuppeteerSharp
Stars: ✭ 39 (-69.53%)
Mutual labels:  puppeteer, headless-chrome
Puppeteer Deep
Puppeteer, Headless Chrome;爬取《es6标准入门》、自动推文到掘金、站点性能分析;高级爬虫、自动化UI测试、性能分析;
Stars: ✭ 1,033 (+707.03%)
Mutual labels:  puppeteer, headless-chrome
Docker Puppeteer
A minimal Docker image for Puppeteer
Stars: ✭ 656 (+412.5%)
Mutual labels:  puppeteer, headless-chrome
Ferrum
Headless Chrome Ruby API
Stars: ✭ 1,009 (+688.28%)
Mutual labels:  automation, headless-chrome
Golang Chrome Automation
Automate Chrome tasks with Golang and ChromeDP
Stars: ✭ 58 (-54.69%)
Mutual labels:  automation, headless-chrome
Url To Pdf Api
Web page PDF/PNG rendering done right. Self-hosted service for rendering receipts, invoices, or any content.
Stars: ✭ 6,544 (+5012.5%)
Mutual labels:  puppeteer, headless-chrome
Puppeteer Api Zh cn
📖 Puppeteer中文文档(官方指定的中文文档)
Stars: ✭ 697 (+444.53%)
Mutual labels:  automation, puppeteer
Browserless
A browser driver on top of puppeteer, ready for production scenarios.
Stars: ✭ 664 (+418.75%)
Mutual labels:  puppeteer, headless-chrome
Puppeteer Functions
Puppeteer Firebase Functions demo
Stars: ✭ 75 (-41.41%)
Mutual labels:  puppeteer, headless-chrome
Api Store
Contains all the public APIs listed in Phantombuster's API store. Pull requests welcome!
Stars: ✭ 69 (-46.09%)
Mutual labels:  automation, headless-chrome
Pyppeteer
Headless chrome/chromium automation library (unofficial port of puppeteer)
Stars: ✭ 1,286 (+904.69%)
Mutual labels:  automation, puppeteer
Chrome Devtools Protocol
Chrome Devtools Protocol client for PHP
Stars: ✭ 112 (-12.5%)
Mutual labels:  automation, headless-chrome
Rendertron
A Headless Chrome rendering solution
Stars: ✭ 5,593 (+4269.53%)
Mutual labels:  puppeteer, headless-chrome

deno-puppeteer

API

A fork of Puppeteer running on Deno.

Puppeteer is a library which provides a high-level API to control Chrome, Chromium, or Firefox Nightly over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.

Most things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:

  • Generate screenshots and PDFs of pages.
  • Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. "SSR" (Server-Side Rendering)).
  • Automate form submission, UI testing, keyboard input, etc.
  • Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
  • Capture a timeline trace of your site to help diagnose performance issues.
  • Test Chrome Extensions.

Getting Started

Installation

To use Puppeteer, import it like so:

import puppeteer from "https://deno.land/x/[email protected]/mod.ts";

Puppeteer can use any recent version of Chromium or Firefox Nightly, but this version of Puppeteer is only validated against a specific version. To cache these versions in the Puppeteer cache, run the commands below.

PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/[email protected]/install.ts
PUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/[email protected]/install.ts

You can find all of the supported environment variables to customize installation in the Puppeteer docs.

Usage

Puppeteer will be familiar to people using other browser testing frameworks. You create an instance of Browser, open pages, and then manipulate them with Puppeteer's API.

Example - navigating to https://example.com and saving a screenshot as example.png:

Save file as example.js

import puppeteer from "https://deno.land/x/[email protected]/mod.ts";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");
await page.screenshot({ path: "example.png" });

await browser.close();

Execute script on the command line

deno run -A --unstable example.js

Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with Page.setViewport().

Example - create a PDF.

Save file as hn.js

import puppeteer from "https://deno.land/x/[email protected]5.5.1/mod.ts";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://news.ycombinator.com", {
  waitUntil: "networkidle2",
});
await page.pdf({ path: "hn.pdf", format: "A4" });

await browser.close();

Execute script on the command line

deno run -A --unstable hn.js

See Page.pdf() for more information about creating pdfs.

Example - evaluate script in the context of the page

Save file as get-dimensions.js

import puppeteer from "https://deno.land/x/[email protected]/mod.ts";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");

// Get the "viewport" of the page, as reported by the page.
const dimensions = await page.evaluate(() => {
  return {
    width: document.documentElement.clientWidth,
    height: document.documentElement.clientHeight,
    deviceScaleFactor: window.devicePixelRatio,
  };
});

console.log("Dimensions:", dimensions);

await browser.close();

Execute script on the command line

deno run -A --unstable get-dimensions.js

FAQ

How does deno-puppeteer compare to the Node version?

deno-puppeteer effectively runs a regular version of Puppeteer, except for some minor changes to make it compatible with Deno.

The most noticable difference is likely that instead of some methods taking / returning Node Buffer, they take / return Uint8Array.

Other than this, the documentation on https://pptr.dev generally applies.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].