lucacasonato / deno-puppeteer

A port of puppeteer running on Deno
https://deno.land/x/puppeteer
MIT License
454 stars 44 forks source link

Is this still maintained? #92

Open lmtr0 opened 9 months ago

lmtr0 commented 9 months ago

Hi there, I'm considering this project for a production product, is this still maintained?

jimmont commented 3 months ago

deno-puppeteer is no longer needed as npm support made it unnecessary, this works, however note the comment about an error below in the working sample where in my current use it fails half the time;

/* deno test -A puppet.js
deno.json
{ "nodeModulesDir": "auto" }
 */
import puppeteer from 'npm:puppeteer-core';
import { assert } from "jsr:@std/assert";

const browser = await puppeteer.launch({
  slowMo: 250,
  devtools: true,
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
});

const [page] = await browser.pages();

const gotoResult = await page.goto('https://deno.com').catch((err) => err);
if (gotoResult instanceof Error) {
/* 2024-11
problem with error "Not implemented: ClientRequest.options.createConnection"
https://github.com/denoland/deno/issues/19507
*/
  const { message = '?!' } = gotoResult;
  console.error(`error... "${message}" ${
    message.includes('detached') ? 'see https://github.com/denoland/deno/issues/19507' : ''
  }`);
  await browser.close();

  Deno.exit(1);
}

const text = await page.evaluate(() => {
    return document.body.querySelector('main h1')?.textContent ?? '';
});

console.log({text});

Deno.test('test stuff', async ()=>{
    assert(text.includes('JavaScript'), 'has JavaScript');
});

await browser.close();

previously: because it appears this repo is no longer maintained I moved to Astral at https://github.com/lino-levan/astral a quick demo seems to work:

import { launch } from "jsr:@astral/astral";
const browser = await launch({
    headless: false,
    path: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
});
const page = await browser.newPage("https://deno.com");
const screenshot = await page.screenshot();
Deno.writeFileSync("screenshot.png", screenshot);
await browser.close();

now moving on to do something useful with it... hope this helps

lmtr0 commented 3 months ago

thx

ooker777 commented 2 weeks ago

I would leave this issue open. This would provide it more visibility I guess

lmtr0 commented 2 weeks ago

I gues so, but I would recommend people to move to the official Puppeteer library as deno supports NPM now

ooker777 commented 2 weeks ago

Isn't that it has always been supporting npm?