WebDriver and permission door hangers

>From my reading of the spec, I cannot find anything related to the handling of asynchronous user prompts such as permissions and other door hangers.

The spec allows handling of "alert" type user prompts, but those are defined as modal and blocking [1]. Door hangers are neither of those, as there can be multiple active prompts / door hangers at the same time, and they don't interrupt the user JS execution. Furthermore the current user prompt handling seems tailored to simple dismiss / accept use cases, whereas some door hangers can be asking more complex input from the user.

I'm interested in finding a way to handle the prompts related to various permissions, and in particular getUserMedia [2]. In this particular spec, the choice of how to prompt the user is left to the user-agent. The current browsers behaviors are as follow [3][4]:
- Chrome shows a door hanger with 2 button to "Allow" or "Block", as well as a "x" button to dismiss the door hanger. They all produce a different resolution for the getUserMedia call promise. The door hanger is always visible and dismissing causes a resolution.
- Firefox shows a door hanger with one or more drop downs allowing the selection of the source devices (or none), and a button with drop down option to "share", "don't share", "always share", "never share" or "not now". The door hanger can be hidden when losing focus, and the "not now" or "x" button will just hide the door hanger, not cause a resolution.

I'm not sure how this use case can be solved in a generic way, but maybe something like an API to list all browser prompts for the session, with information on the prompt type (to differentiate between multiple prompts), list of its inputs and a way to select/fill an input, list actions and a way to trigger one, and maybe a way to dismiss a prompt since it seems to be a common feature.
The existing "alert" prompt could be expressed as a specific type of this generic prompt.

Mathieu

[1] http://w3c.github.io/webdriver/webdriver-spec.html#user-prompts
[2] https://w3c.github.io/mediacapture-main/
[3] https://webrtc.github.io/samples/src/content/getusermedia/gum/
[4] https://webrtc.github.io/samples/src/content/devices/input-output/

Received on Friday, 11 March 2016 01:13:35 UTC