New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to catch a "Permission request" dialog event? #846
Comments
There's a feature request upstream to add devtools protocol API sfor granting/denying these types of permissions: https://bugs.chromium.org/p/chromium/issues/detail?id=631464 In Lighthouse, we used to capture API calls that invoke the prompts. We used that to determine when prompts were being showed. However, there's no way to block/deny it programmatically. |
@xfumihiro out of curiosity, what's your usage scenario for this? |
@aslushnikov I was trying to catch if the "request permission" is issued on the auth/login flow. (Better UX - iff user asked for it 😃 ) |
@ebidel Hi, I have a question about the Notification. I use puppeteer to visit a site which alert the notification. If I don't close the notification manually, the program wouldn't go forward. |
No there's not. That's the feature request in https://bugs.chromium.org/p/chromium/issues/detail?id=631464. |
i need geolocation permission... hope this will be release soon |
@saselovejulie I try overwrite the method of navigator.geolocation.getCurrentPosition = function (cb) {
setTimeout(() => {
cb({
'coords': {
accuracy: 21,
altitude: null,
altitudeAccuracy: null,
heading:null,
latitude: 23.129163,
longitude: 113.264435,
speed:null
}
})
}, 1000)
} |
I personally suggest to use a custom user profile that has accepted te prompt before. If the given profile path does not exist it will be created. Now go to the website that requires you to accept this dialog, accept it manually and close the chrome window. Now it is as simple as using the custom profile for your chrome driver, again with the same argument: e.g. In C# Using a Chromedriver with ChromeOptions this would be: ChromeOptions options = new ChromeOptions();
options.AddArgument("--user-data-dir=/path/to/your/custom/profile");
ChromeDriver driver = new ChromeDriver(options); |
@aslushnikov are you tackling this from the protocol-side? We're getting more inbound requests for an API and it's an important one to have for testing lots of different APIs. |
@ebidel yeah, this is in my queue after the browser contexts. |
Any update on this? I'm doing some process of a large list of urls and it renders headless mode basically useless after 2 minutes of scraping if you encounter enough of these. |
Having the same issue. When launching with |
Only way I found was to set headless to true. |
@aslushnikov @ebidel Is this feature available in Pupeeteer to allow or reject notification prompt? If there is, I have one scenario, If you allow the automated browser to accept or deny the notification prompt, every time a new notification prompt is accepted uid is created and this will cause problems for the web sites who subscribed to the third party notification service where they are capped to limits for number of notifications UIDs |
Adding |
This roll includes: - https://crrev.com/584293 - DevTools: execute scripts in addScriptToEvaluateOnLoad in order - https://crrev.com/585630 - DevTools: introduce Browser.grantPermissions References puppeteer#846. Fixes puppeteer#3106.
This roll includes: - https://crrev.com/584293 - DevTools: execute scripts in addScriptToEvaluateOnLoad in order - https://crrev.com/585630 - DevTools: introduce Browser.grantPermissions - https://crrev.com/587156 - Revert "[Base] Use background mode for ThreadPriority::BACKGROUND threads (behind feature) (reland)." The "revert" patch fixes headless functionality on windows. References puppeteer#846. Fixes puppeteer#3106.
This roll includes: - https://crrev.com/584293 - DevTools: execute scripts in addScriptToEvaluateOnLoad in order - https://crrev.com/585630 - DevTools: introduce Browser.grantPermissions - https://crrev.com/587156 - Revert "[Base] Use background mode for ThreadPriority::BACKGROUND threads (behind feature) (reland)." The "revert" patch fixes headless functionality on windows. References #846. Fixes #3106.
Introduce an API to manage permissions per browser context: - BrowserContext.overridePermissions(origin, permissions) - BrowserContext.resetPermissionOverrides() Fixes puppeteer#846.
You can permit geo location api via the new api introduced in v1.8.0. https://pptr.dev/#?product=Puppeteer&version=master&show=api-browsercontextoverridepermissionsorigin-permissions Y |
The text was updated successfully, but these errors were encountered: