I have two containers, one Puppeteer and one Browserless. I try to connect to Browserless, but it fails. Both containers are in the same network.
Here is my code:
await puppeteer.connect({
browserWSEndpoint: "wss://browserless:3000"
});
Websocket secure, short wss was my issue. The following code works fine.
await puppeteer.connect({
browserWSEndpoint: "ws://browserless:3000"
});
Related
// executablePath is specified
const browser = await puppeteer.launch({
executablePath: '/path/to/chrome'
});
// // executablePath is not specified
const browser = await puppeteer.launch();
// This will not work.
// console.log('executablePath is', browser.executablePath)
If we do not specify a value for the executablePath option, Puppeteer will try to find the default installation of Chrome or Chromium on the system. On Windows, this is usually C:\Program Files (x86)\Google\Chrome\Application\chrome.exe. On macOS and Linux, Puppeteer will try to use the chrome or chromium executable in the PATH.
How we can find out which executable is getting used by Puppetter in Puppeteer script itself?
https://pptr.dev/api/puppeteer.puppeteernode.executablepath
const puppeteer = require('puppeteer')
console.log(puppeteer.executablePath())
Example output on my node-18 docker image is
root#021100c40ec4:/usr/src/app# node -e "console.log(require('puppeteer').executablePath())"
/root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/chrome
Hi can someone help to figure out how to successfully execute the following puppeteer.connect behind the proxy ?
Thx.
await puppeteer.connect({
browserWSEndpoint: "wss://cdp.lambdatest.com/puppeteer?capabilities=xxxxx",
})
I'm using the plugin gatsby-remark-mermaid which also includes installing puppeteer. The mermaid diagrams are rendered properly on my end, however it gets an error on the build. Here is the error message:
Failed to launch the browser process!
/tmp/build/node_modules/puppeteer/.local-chromium/linux-970485/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
I looked into the documentation and since I'm running it on Heroku, I must include this configuration:
puppeteer.launch({ args: ['--no-sandbox'] });
I tried using it on gatsby-browser.js like this, but I only got errors instead.
const puppeteer = require('puppeteer')
const browser = await puppeteer.launch({ args: ['--no-sandbox'] })
Where do I need to put this configuration for it to work?
this is my config on the puppeteer cluster :
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
workerCreationDelay: 2000,
puppeteerOptions:{args: ['--no-sandbox', '--disable-setuid-sandbox']},
maxConcurrency: numCPUs,
});
when I try to run in my host it comes with error:
Error: Failed to launch the browser process!
[1014/132057.583562:ERROR:zygote_host_impl_linux.cc(90)] Running as
root without --no-sandbox is not supported. See
https://crbug.com/638180.
but according to the documentation of puppeter cluster you can pass the puppeteer option in puppeteerOptions
why passing options are not working?
I opened an account on Cloud9 and I ran some code successfully. I got the following output in the console:
Your code is running at https://****1986.c9users.io.
Important: use process.env.PORT as the port and process.env.IP as the
host in your scripts!
Debugger listening on port 15454
listening on port 3000
The code is:
var express = require('express');
var app = express();
app.get('/', function(req,res) {
res.send("OK");
});
app.listen(process.env.PORT, function() {
console.log("listening on port " + process.env.PORT);
});
So after running it, I opened my browser and surfed to:
https://***1986.c9users.io:3000
I would expect to get a "OK" in the browser, but it seems that the browser can't reach this destination.
What address do I have to type so I can connect my Cloud9 server?
Probably, Cloud9 has a problem with running files inside directories.
This file was placed inside the directory 'server' (when I couldn't access the address by the browser). Once I put it in the main directory, I could connect it by applying to https://***1986.c9users.io (without port number)