dappeteer
dappeteer copied to clipboard
Can't use Headless mode
When i call setupMetamask
using headless mode, the function never ends. I don't have errors but i can't use it.
const browser = await dappeteer.launch(puppeteer, {
metamaskVersion: 'v10.1.1',
headless: true
});
console.log('Loading metamask...')
const metamask = await dappeteer.setupMetamask(browser);
console.log('logged !')
- NodeJs version v16.8.0
- dAppeteer version 2.2.0
Hey @iyarsius It is a limitation of the puppeteer, there is nothing can we do about it :disappointed:
How does MM itself test their own extension then? Full non-headless?
@Elyx0 - the problem is that MM is a Chrome extension - you cannot run Chromium/Chrome headless loaded with extensions: https://bugs.chromium.org/p/chromium/issues/detail?id=706008#c5
At most, you can run Chrome in non-headless mode, but with xvfb
, which is an in-memory display server:
https://www.mattzeunert.com/2018/07/21/running-headful-chrome-on-ubuntu-server.html
npm i xvfb
const Xvfb = require('xvfb');
(async function() {
let xvfb = new Xvfb();
xvfb.startSync();
// code here....
})();
it works for me.
I tried to create the launch dappeteer inside of the xvfb but i did not get a successful response I just get and error:
Error: Could not start Xvfb. at Xvfb.startSync (/Users/user/Documents/Projects/scrappers/node_modules/xvfb/index.js:84:17) at /Users/user/Documents/Projects/scrappers/index.js:18:10 at /Users/user/Documents/Projects/scrappers/index.js:22:5 at Layer.handle [as handle_request] (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/layer.js:95:5) at next (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/layer.js:95:5) at /Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:341:12) at next (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:275:10)
Some one has another solution ?
I tried to create the launch dappeteer inside of the xvfb but i did not get a successful response I just get and error:
Error: Could not start Xvfb. at Xvfb.startSync (/Users/user/Documents/Projects/scrappers/node_modules/xvfb/index.js:84:17) at /Users/user/Documents/Projects/scrappers/index.js:18:10 at /Users/user/Documents/Projects/scrappers/index.js:22:5 at Layer.handle [as handle_request] (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/layer.js:95:5) at next (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/layer.js:95:5) at /Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:341:12) at next (/Users/user/Documents/Projects/scrappers/node_modules/express/lib/router/index.js:275:10)
Some one has another solution ?
It seems like you have issue with xvfb and not dappeteer.