question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can i accept this pop up?

See original GitHub issue

image I tried

 page.on('popup', async dialog => {
        console.log(dialog.message());
        await dialog.dismiss();
        await browser.close();
    });

and also

page.on('dialog', async dialog => {
       console.log(dialog.message());
       await dialog.dismiss();
       await browser.close();
   });

But both did not help me

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
nrayburn-techcommented, Apr 29, 2020

The second code bock is what should be working. Are you adding your page bindings prior the the dialog being triggered?

Here is an example I tried that works as expected.

import playwright from 'playwright';

(async () => {
  const browser = await playwright.chromium.launch({
    headless: false,
    slowMo: 500
  });
  const context1 = await browser.newContext();
  const page1 = await context1.newPage();
  await page1.goto('https://google.com');
  page1.on('dialog', async (dialog) => {
    console.log(dialog.message());
    await dialog.accept();
  });
  await page1.evaluate(() => {
    confirm('are you sure');
  });
  await context1.close();
  browser.close();
})();
0reactions
BasavalingaScommented, Feb 11, 2021

@nicoandmee can you please explain with example which you mentioned in the above comment registering the dialog handle prior to visiting the page before. I’m also facing same issue which @leochung042 is facing. As soon as i visit the page dialog popup appears and ask for username and password. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

8 Ways to Allow Pop–ups - wikiHow
1. Open Google Chrome {"smallUrl":"https:\/\/www.wikihow.com\/images\/c\/cd\/Android7chrome.png","bigUrl":"\/images\/thumb\/c\/cd\/Android7chrome.png\/30px ... 2. Click the menu ⋮. It's the three vertical dots at the top-right corner of Chrome. 3....
Read more >
Configuring your web browser to allow pop-up windows
Open Chrome, then go to the web page that you want to allow pop-ups. · In Chrome's URL window, highlight the entire web...
Read more >
How to Allow Pop-Ups in Google Chrome - Business Insider
1. Open your Chrome web browser and navigate to the site you want to allow pop-ups on. · 2. Click the lock icon...
Read more >
Allow Pop-ups for Specific Websites
Select Add next to Allowed to send pop-ups and use redirects. Input the specific page URL and select Add. Firefox. From the Firefox...
Read more >
How to Disable or Enable Your Pop-up Blocker
FIREFOX (MAC). Select Preferences from the Firefox menu. Select the Privacy and Security tab. To disable the pop-up blocker, uncheck the Block pop-up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found