[BUG] - Unable to obtain backgroundPage
See original GitHub issueContext:
- Playwright Version: 1.1.1
- Operating System: Linux
- Node version: 10.15
- Browser: Chromium 83.0.4103.106 snap
Code Snippet
;(async () => {
const pathToExtension = require('path').join(__dirname, '../dist')
const userDataDir = require('path').join(__dirname, '../playwright')
const browserContext = (await playwright.chromium.launchPersistentContext(userDataDir, {
headless: false,
args: [
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
],
})) as ChromiumBrowserContext
console.log(browserContext.backgroundPages()) // []
const backgroundPage = await browserContext.waitForEvent('backgroundpage') // never resolves
})()
The Chrome Extension loads fine and I can see it. Playing around with it, disabling/re-enabling, opening new tabs etc. doesn’t make a difference. Am I missing something here?
Output with debug flag:
pw:api => chromium.launchPersistentContext started +0ms
pw:api => chromium._innerLaunch started +411ms
pw:api <= chromium._innerLaunch succeeded +132ms
pw:api => cRBrowserContext._loadDefaultContext started +3ms
pw:api <= cRBrowserContext._loadDefaultContext succeeded +0ms
pw:api <= chromium.launchPersistentContext succeeded +1ms
[]
pw:api => cRBrowserContext.waitForEvent started +9ms
pw:api <= cRBrowserContext.waitForEvent failed +30s
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[crx] unable to access getBackgroundPage within chrome. ...
states that an extension panel has access to chrome.extension API. I have a panel.js file , which is loaded from panel.html, panel.html being...
Read more >Background page runs, but popup says 'You do not have a ...
The getBackgroundPage() method doesn't retrieve the background script, it retrieves the window object associated with the background script.
Read more >unknown error: failed to wait for extension background ...
I am getting the error "Execution Exception: unknown error: failed to wait for extension background page to load". What should I do?
Read more >XMLHttpRequest from Worker in the background page fails
I've noticed that this happens if the request gives a 301 redirect and the target of the redirect is with a different domain...
Read more >Safari Web Extension background request CORS issues
The ajax request in the background will always fail since it is cross origin. ... in the server's response header, the background page...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

we have the same issue, which feels critical and blocks us from proper debugging process
@karthikiyengar awesome, thank you! I can repro now. This is a bug in CDP; we’ll fix it!
Reproduction script
a.jssome-extension/manifest.jsonsome-extension/background-script.js