@nojsja/puppeteer-in-electron
TypeScript icon, indicating that this package has built-in type declarations

3.0.7 • Public • Published

Tested with puppeteer-core@^19.6.2 and electron@18.0.3

Introducing puppeteer-in-electron

Use puppeteer to test and control your electron application.

npm install puppeteer-in-electron puppeteer-core electron

See the API documentation.

JavaScript

const {BrowserWindow, app} = require("electron");
const pie = require("puppeteer-in-electron")
const puppeteer = require("puppeteer-core");

const main = async () => {
  await pie.initialize(app);
  const browser = await pie.connect(app, puppeteer);
 
  const window = new BrowserWindow();
  const url = "https://example.com/";
  await window.loadURL(url);
 
  const page = await pie.getPage(browser, window);
  console.log(page.url());
  window.destroy();
};

main();

TypeScript

import {BrowserWindow, app} from "electron";
import pie from "puppeteer-in-electron";
import puppeteer from "puppeteer-core";

const main = async () => {
  await pie.initialize(app);
  const browser = await pie.connect(app, puppeteer);

  const window = new BrowserWindow();
  const url = "https://example.com/";
  await window.loadURL(url);

  const page = await pie.getPage(browser, window);
  console.log(page.url());
  window.destroy();
};

main();

/@nojsja/puppeteer-in-electron/

    Package Sidebar

    Install

    npm i @nojsja/puppeteer-in-electron

    Weekly Downloads

    1

    Version

    3.0.7

    License

    MIT

    Unpacked Size

    17.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • nojsja