Comments (1)
This is likely because the pipe option does not work in Deno which makes the compatibility claim in https://deno.com/blog/v1.35 a little confusing.
Assuming you have “installed” a browser with deno run -q --no-lock -A --unstable --no-check --reload npm:puppeteer/install.mjs
, the following code works with deno run -A index.mjs
(it does have a “Warning: Not implemented: ClientRequest.options.createConnection”, though).
// index.mjs
import puppeteer from 'npm:puppeteer'
(async () => {
const browser = await puppeteer.launch({
headless: 'new',
pipe: false
});
const page = await browser.newPage();
await page.goto('https://developer.chrome.com/');
await page.setViewport({width: 1920, height: 1080});
await page.screenshot({path: './test.jpg'})
await browser.close();
Deno.exit(1)
})();
But with pipe: true
it breaks with the same deno run -A index.mjs
command.
Here is the output: error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'on')
.
You can find the same issue with regards to Playwright support. See denoland/deno#16899 (comment) and microsoft/playwright#3146 (comment)
// index.mjs
import puppeteer from 'npm:puppeteer'
(async () => {
const browser = await puppeteer.launch({
headless: 'new',
pipe: true
});
const page = await browser.newPage();
await page.goto('https://developer.chrome.com/');
await page.setViewport({width: 1920, height: 1080});
await page.screenshot({path: './test.jpg'})
await browser.close();
Deno.exit(1)
})();
Here is the same in Node (assuming that you have installed Puppeteer with npm i puppeteer
which works just fine with the pipe option by running node index.mjs
.
// index.mjs
import puppeteer from 'puppeteer'
(async () => {
const browser = await puppeteer.launch({
headless: 'new',
pipe: true
});
const page = await browser.newPage();
await page.goto('https://developer.chrome.com/');
await page.setViewport({width: 1920, height: 1080});
await page.screenshot({path: './test.jpg'})
await browser.close();
})();
from deno-puppeteer.
Related Issues (20)
- Adding `{headless:false}` to readme examples when using Chrome makes them hang for 30 seconds and then throw a `TimeoutError` (browser doesn't launch) HOT 2
- How to use it with browserless.io? HOT 2
- Error when saving output of `page.pdf` into variable
- getting PermissionDenied: 'Deno.makeTempDir' is not allowed in this context HOT 8
- Error: Could not find browser revision XXX. Run "PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@VERSION/install.ts" to download a supported browser binary. HOT 6
- TypeError: reader is not async iterable at getReadableStreamAsUint8Array HOT 4
- `Deno.core.runMicrotasks()` is not supported in this environment HOT 2
- Buffer is not defined HOT 5
- Excited to try out `--headless=new` in Chrome 112+ HOT 3
- `deno check` errors out saying `"data" is unexpectedly null for "https://esm.sh/v111/node.ns.d.ts"` HOT 1
- Question: why is browser.close() crasching when using browserless.io HOT 2
- Can't build docker image. It hangs. Package is not usable HOT 4
- NetworkError: failed to connect to WebSocket: Invalid status code HOT 3
- Update docs to detail actual required permissions
- Non try/catchable TimeoutError HOT 3
- cannot connect to remove browser using wss
- Won't run on an M2 MacBook Air HOT 1
- Issue with running in docker HOT 3
- Example to deploy in Deno
- Is this still maintained?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno-puppeteer.