ChainSafe/dappeteer

How to connect to an existing browser with MetaMask already installed?

yt7260 opened this issue · 1 comments

yt7260 commented

Describe the problem
A clear and concise description of what the problem is.

OS: win 10
NodeJs version v18.13.0
dappeteer version 5.1.1
puppeteer version 19.8.1

I have already connected to an existing browser that has Metamask installed, but I am unable to operate it.

const browser = await puppeteer.connect({ browserWSEndpoint: res.data.data.ws.puppeteer, defaultViewport: null, headless: false });
const userData = "E:/.cache/j5y43xo_hdspfh/Default/Extensions/";
const browserInstance = new DPuppeteerBrowser(browser, userData, false);
const metamask = await dappeteer.getMetaMaskWindow(browserInstance);
await metamask.unlock('111111');

The error message:
throw new Error("You can't sign in because you are already signed in");

This issue looks a lot like #299