pyppeteer_stealth
pyppeteer_stealth copied to clipboard
Alert Dialog Unable to SwitchTo and Accept / Dissmiss
I want to dismiss 'Cancel' popup Dialog or I don't know if it is Alert box whatever but since it doesn't work I want to ask if anyone know the solution.
1. I login to my spotify and I wish to create playlist but right after I sign in and open.spotify
is loaded the website shows this annoying Dialog see image:
2. I have tries this code to put BEFORE the URL opens which cause totally browser close and if AFTER the url open and shows the alert box dialog it does nothing at all !
CODE:
context = await browser.createIncognitoBrowserContext()
page = await context.newPage()
await stealth(page)
page.on('dialog', lambda dialog: asyncio.ensure_future(close_dialog(dialog)))
await page.evaluate('() => alert("1")')
await page.goto('https://open.spotify.com/', {'waitUntil' : 'domcontentloaded'})
SO IF page.on
IS BEFORE the URL it will close the all browser NOT only that Dialog if it is AFTER it does nothing.
Any senior developer can help on this? Appreciate much !
PS: I use my own path to real Brave browser btw and I also tries to not allow notifications, I uninstalled spotify app from windows, I tried to block popup using different chrome extensions, NOTHING is working!
Maybe try setting up request interception to block the popup dialog?