How can I use Puppeteer to interact with a Chrome extension in my tests? or Best way to interact with

18 Replies, 1541 Views

Been there! The secret sauce is `browser.targets()`.

List all targets, find your extension’s background/page, then attach to it.

```javascript
const targets = await browser.targets();
const bgTarget = targets.find(t => t.url().includes('background'));
const bgPage = await bgTarget.page();
```
Now you can puppeteer interact with extension logic directly.

Messages In This Thread



Users browsing this thread: 1 Guest(s)