Giter Club home page Giter Club logo

deno-puppeteer-adapter's Introduction

deno puppeteer adapter

import {
  runChrome.
  puppeteer,
} from 'https://denopkg.com/nikfrank/deno-puppeteer-adapter/index.js';


const [process, ws] = await runChrome();

//... ws is the address of chrome's top level socket
//... I don't ever use it, idk maybe you need it



// wait for chrome to open the websocket
const wait = t=> (new Promise(f=> setTimeout(f, t)));
await wait(900);


// load the url for the socket we want

const url = 'http://sheshbesh.nikfrank.com/';
const port = 9222;
const response = await fetch('http://localhost:'+port+'/json')
const tabs = await response.json();

const socketUrl = tabs
  .find((tab={ url: null }) => tab.url === url)
  .webSocketDebuggerUrl;


// connect puppeteer to it

const browser = await puppeteer.connect({
  browserWSEndpoint: socketUrl,
  ignoreHTTPSErrors: true,
});

const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle2' });

// now you can do anything with puppeteer you want!

process.close();

Deno.exit(0);

Contributing

If puppeteer in Deno is a serious need in your life, I suggest going through the same process I did so you can be sufficiently confident for your serious need. Rough notes on the process are available in buildnotes.md

in doing so, you could browserify a latest copy of puppeteer-core, if you need to!

please inspect the shims I did by comparing ./puppeteer-web.js in this repo to the npmjs package of the same name

I would also suggest forking the repo, as I'm not committed to future development.


MIT License

Some work on this project was conducted in Judea / Samaria

if your interpretation of UNSC 242 differs from mine, feel free to boycott!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.