playwright: [BUG] page.on('dialog', ()=>{}) doesn't work when external URL handlers are opened. e.g. Telegram
Context:
- Playwright Version: 1.17.1
- Operating System: macOS 12.0.1
- Node.js version: v17.0.1
- Browser: Chromium
- Extra:
const { chromium } = require('playwright');
(async () => {
// const browser = await chromium.connectOverCDP('@todo:wsUrl');
// const context = browser.contexts()[0];
const context = await chromium.launch({ headless: false });
const page = await context.newPage();
page.on('dialog', async (dialog) => {
console.log('dialog1', dialog.message());
await dialog.dismiss();
});
await page.goto('https://t.me/wallstreetbets');
page.on('dialog', async (dialog) => {
console.log('dialog2', dialog.message());
await dialog.dismiss();
});
})();
Describe the bug Dialog still exists, and the two logs are not printed.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 11
- Comments: 17 (3 by maintainers)
@dgozman possible, you can avoid opening this type of dialog, by adding those two lines to your Dockerfile:
in my case <your_url_app> = msteams
+1 for this bug. I recently hit this. (I think.)
I am doing this in my Javascript application code that’s run in the browser. On a mobile device in a real app, it would open the app that’s registered to handle the scheme.
document.location.href = "customscheme://whatever"Out of the box, tests for this don’t work. This times out.
await page.waitForURL("customscheme://whatever")I thought that I could stub it:
Stubbing does not seem to have any effect, still times out.
I wish there was a way to assert with Playwright that “navigation” to a custom URL scheme happens.