diff --git a/index.html b/index.html index 8c798ea7..8d5466ea 100644 --- a/index.html +++ b/index.html @@ -1571,7 +1571,7 @@
unhandledPromptBehavior
"
dismiss and notify
".
@@ -2124,6 +2124,11 @@ userPromptHandler
"
+ If check user prompt handler matches
+ with value is false, return success with
+ data null
.
+
An HTTP session has an associated strict file interactability state which is a boolean. -
A HTTP session has an associated user prompt handler. -Unless stated otherwise it is in the dismiss and notify state. -
A session has an associated browsing context input state map, which is a Weak Map with top-level browsing contexts as keys, and input state objects as values. This @@ -2358,6 +2360,7 @@
If the list of active sessions is empty:
Set the webdriver-active flag to false +
Set the user prompt handler to null.
Unset the accept insecure TLS flag.
Reset the has proxy configuration flag to its default value. @@ -10198,127 +10201,229 @@
User prompts that are spawned
- from beforeunload
event handlers,
- are accepted implicitly upon navigation
- or close window,
- regardless of the defined user prompt handler.
+
Whenever active sessions is a list containing exactly one +item, and that item is a HTTP session, then in the steps to +fire beforeunload, implementations must act as if showing an +unload prompt is likely to be annoying, deceptive, or pointless. + +
This means that beforeunload prompts are never shown +when there's an active HTTP session.
A user prompt has an associated user prompt message
that is the string message shown to the user,
or null
if the message length is 0
.
-
The following table of simple dialogs - enumerates all supported simple dialogs, - along with the commands that are allowed to interact with it - as a non-normative reference: +
The current user prompt is the user prompt which +has invoked the pause algorithm, if any, or null otherwise. -
Definition - | Dialog - | Interactions - |
---|---|---|
Alert - | window.alert
- |
- Accept Alert - Dismiss Alert - Get Alert Text - |
Confirm - | window.confirm
- |
- Dismiss Alert - Accept Alert - Get Alert Text - |
Prompt - | window.prompt
- |
- Dismiss Alert - Accept Alert - Get Alert Text - Send Alert Text - |
A remote end has a user prompt handler which +defines how a WebDriver session will react when a user prompt is +displayed. It is either null or a map between strings +and prompt handler configuration values. Initially it is null. + +
A prompt handler configuration is a struct with two +items; a handler, which is a +string, and a notify, +which is a boolean. -
The current user prompt is said to be the active user prompt, - which can be one of the entries on the table of simple dialogs. +
To serialize a prompt handler configuration +given configuration: -
To dismiss - the current user prompt, - do so as if the user would click the Cancel or OK button, - whichever is present, in that order. +
To accept the current user prompt, - do so as if the user would click the OK button. +
Let serialized + be configuration's [=prompt handler + configuration/handler=]. -
-The user prompt handler defines what action -the remote end must take when a user prompt is encountered. -This is defined by the unhandled prompt behavior capability. -The following known prompt handling approaches table -lists the keywords and states for the attribute: +
If «"dismiss
", "accept
"»
+ [=list/contains=] serialized,
+ and configuration's [=prompt handler
+ configuration/notify=] is true, append " and notify
"
+ to serialized.
+
+
Return serialized. + +
Keyword - | State - | Description + | Handler key + | Description (non-normative). |
---|---|---|---|---|
"dismiss "
- | Dismiss state | All simple dialogs encountered should be dismissed. | ||
"accept "
- | Accept state | All simple dialogs encountered should be accepted. | ||
"dismiss and notify "
- | Dismiss and notify state | All simple dialogs encountered should be dismissed, and an error returned that the dialog was handled. | ||
"accept and notify "
- | Accept and notify state | All simple dialogs encountered should be accepted, and an error returned that the dialog was handled. | ||
"ignore "
- | Ignore state | All simple dialogs encountered should be left to the user to handle. |
When required to deserialize as an unhandled prompt behavior an +
The valid prompt types are «"alert
",
+"beforeUnload
", "confirm
",
+"default
", "prompt
"».
+
+
To deserialize as an unhandled prompt behavior an argument value: -
If value is not a string return - an error with error code invalid argument. +
If value is not present as a keyword
- in the known prompt handling approaches table
- return an error with error code invalid argument.
+
+
Set value to the result of converting a
+ JSON-derived JavaScript value to an Infra value
+ with value.
- Return success with data value.
+ If value is not a string, an implementation that
+ does not also support [[WebDriver-BiDi]] may return error
+ with error code invalid argument.
+
+ This is to avoid [[WebDriver-BiDi]] monkey-patching
+ the current spec.
+
+ If value is a string set value to
+ the map «[" For each prompt type → handler in value:
+
+ If valid prompt types does
+ not [=map/contains=] prompt type return error
+ with error code invalid argument.
+
+ If known prompt handlers does not contain an entry
+ with handler key handler return error
+ with error code invalid argument.
+
+ Let notify be false.
+
+ If handler is " If handler is " Let configuration be a prompt handler
+ configuration with [=prompt handler
+ configuration/handler=] handler and [=prompt handler
+ configuration/notify=] notify.
+
+ [=map/Set=] user prompt
+ handler[handler] to configuration.
+
+ Return success with data user prompt handler.
+default
" → value]».
+
+
+
+ accept and notify
",
+ set handler to "accept
"
+ and notify to true.
+
+ dismiss and notify
",
+ set handler to "dismiss
"
+ and notify to true.
+
+
To check user prompt handler matches +given requested prompt handler: + +
If the user prompt handler is null, return true. + +
For each request key → request handler + in requested prompt handler: + +
If the user prompt + handler [=map/contains=] key: + +
If the requested prompt handler's [=prompt + handler configuration/handler=] is not equal to the user + prompt handler's [=prompt handler + configuration/handler=], or the requested prompt + handler's [=prompt handler configuration/notify=] + is not equal to the user prompt + handler's [=prompt handler configuration/handler=], + return false. + +
To update the user prompt handler given requested handler: + +
If the user prompt handler is null, set the user prompt + handler to an empty map. + +
For each request key → request handler + in requested prompt handler: + +
Set user prompt handler[key] to value: + +
To serialize the current user prompt handler: + +
If the user prompt handler is null, return null. + +
If the user prompt handler has [=map/size=] 1,
+ and user prompt handler [=list/contains=]
+ "default
", return the result of serialize a prompt
+ handler configuration with user prompt
+ handler["default
"].
+
+
Let serialized be an empty map. + +
For each key → value
of user prompt
+ handler:
+
+
Set serialized[key] to serialize a prompt + handler configuration with value. +
Return convert an Infra value to a JSON-compatible + JavaScript value with serialized.
An annotated unexpected alert open error @@ -10328,47 +10433,72 @@
text
"
- To handle any user prompts - given session, remote end must: +
To get the prompt handler type: -
-If there is no current user prompt, -abort these steps and return success. +
If the user prompt handler is null, + let handlers be an empty map. Otherwise + let handlers be user prompt handler. -
-Perform the following substeps -based on the session’s user prompt handler: +
If handlers contains type + return handlers[type]. -
Dismiss the current user prompt. +
If type is "beforeUnload
", return a
+ prompt handler configuration with [=prompt
+ handler configuration/handler=] "accept
"
+ and [=prompt handler configuration/notify=] false.
-
Accept the current user prompt. +
If handlers contains "default
+ return handlers["default
"].
-
Dismiss the current user prompt. -
Return an annotated unexpected alert open error. +
Return a a>prompt handler
+ configuration with [=prompt handler
+ configuration/handler=] "dismiss
" and [=prompt handler
+ configuration/notify=] true.
Accept the current user prompt. -
Return an annotated unexpected alert open error. -
To handle any user prompts: + +
If the current browsing context' is not blocked by + a dialog return success. -
Return an annotated unexpected alert open error. +
Let type be "default
".
+
+
If the current user prompt is an alert dialog,
+ set type to "alert
". Otheriwse, if
+ the current user prompt is a confirm dialog,
+ set type to "confirm
". Otherwise, if
+ the current user prompt is a confirm dialog,
+ set type to "prompt
".
+
+
TODO: other types + +
Let handler be get the prompt handler + with type. + +
Perform the following substeps based + on handler's [=prompt handler configuration/handler=]: + +
dismiss
"
+Dismiss the current user prompt. + +
accept
"
+Accept the current user prompt. + +
ignore state
+Do nothing.
If handler's [=prompt handler + configuration/notify=] is true, return annotated unexpected + alert open error. +
Return success.
If there is no current user prompt, +
If the current user prompt is null, return error with error code no such alert.
Dismiss the current user prompt. @@ -10452,7 +10582,7 @@
If there is no current user prompt, +
If the current user prompt is null, return error with error code no such alert.
Accept the current user prompt. @@ -10483,7 +10613,7 @@
If there is no current user prompt, +
If the current user prompt is null, return error with error code no such alert.
Let message be the text message @@ -10528,19 +10658,19 @@
If there is no current user prompt, +
If the current user prompt is null, return error with error code no such alert. -
Run the substeps of the first matching - current user prompt: +
Run the substeps for the API that created the current user + prompt:
window.alert
+ window.confirm
Return error with error code element not interactable. -
window.prompt
Do nothing.
The following terms are defined in the Infra specification: [[INFRA]] +