Accepting / denying browser permission requests (e.g. Notification.requestPermission)

27 views
Skip to first unread message

Kyle Loveless

unread,
Jun 14, 2023, 7:22:22 AM6/14/23
to Selenium Users
Hi,

I'm trying to see if in WebDriver tests I can interact with browser-specific permission dialogs (as discussed here). Discussion online seems to just say "flip an option to always accept all permissions" - but I'd like to try both flows without needing to restart browser instances, and it fits into the normal interactive flow of the rest of interaction in tests.

I realize it is not part of the DOM, but it seems like a reasonable thing to went to automate - and act like the user would act.

Thoughts?

Kyle

Kyle Loveless

unread,
Jun 16, 2023, 2:18:49 AM6/16/23
to seleniu...@googlegroups.com
And I'll just add - the same applies to being able to detect that a notification was sent to the OS, and (I'm not sure how common this is) - if there are any interaction results with it - to trigger those too.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/MmMYVtm4xb4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5ca09fa6-6259-4184-985c-49b921e5030en%40googlegroups.com.

Kyle Loveless

unread,
Jun 8, 2024, 4:16:40 AMJun 8
to seleniu...@googlegroups.com
In-case it was useful to anyone else, while I did not get a way to interact with the permission dialog itself, I:
  1. Used (for Chromium) goog:chromOptions with "prefs": {"profile.default_content_setting_values.notifications": 1} - to have Chrome enable notification permissions by default.
  2. While not in headless mode (headless does not support notifications), used dbus-monitor path=/org/freedesktop/Notifications to just get the stream of notifications, and run assertions on them.
Reply all
Reply to author
Forward
0 new messages