diff --git a/index.html b/index.html index 7dbea643..728a8504 100644 --- a/index.html +++ b/index.html @@ -1565,11 +1565,11 @@
unhandledPromptBehavior
"
dismiss and notify
".
userPromptHandler
"
+ If check user prompt handler matches
+ with value is false, return success with
+ data null
.
+
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 @@ -2292,6 +2294,21 @@
acceptInsecureCerts
" from capabilities.
+ Let user prompt handler capability be the result of getting property
+ "userPromptHandler
" from capabilities.
+
+
If user prompt handler capability is not + undefined, update the user prompt handler with user + prompt handler capability. + +
Let serialized user prompt handler + be serialize the user prompt handler. + +
If seralized user prompt handler is not null, set
+ a property on capabilities with the name
+ "userPromptHandler
", and the value serialized
+ user prompt handler.
+
If flags contains "http
":
Let strategy be the result of getting @@ -2357,6 +2374,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. @@ -10312,127 +10330,252 @@
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, but is not a BiDi +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-only 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: +
To get the active user prompt given browsing context:
- Let agent be browsing context's active
+ document's relevant agent.
- If agent's event loop is not
+ currently paused, return null.
- Return the user prompt which handles the input required
+ to meet the condition passed when event loop
+ was paused.
+ The current user prompt is the result of get the
+active user prompt with current browsing context.
- 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 dismiss a user
+ prompt, act as if the user clicked the Cancel button on
+ that prompt, if present, or otherwise accept the prompt.
- 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
+ a user prompt, act as if the user clicked
+ the OK button on that prompt.
- To accept the current user prompt,
- do so as if the user would click the OK button.
+
-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:
+ 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.
+
+ To serialize a prompt handler configuration
+given configuration:
+
+ Let serialized
+ be configuration's [=prompt handler
+ configuration/handler=].
+
+ If «" Return serialized.
+
+ When required to deserialize as an unhandled prompt behavior an
+ The valid prompt types are «" The " To deserialize as an unhandled prompt behavior given
argument value:
- If value is not a string return
- an error with error code invalid argument.
+ If value is not present as a 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/contain=] 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.
+ 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 prompt 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 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=]
+ " Let serialized be an empty map.
+
+ For each key → 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
@@ -10442,47 +10585,75 @@ 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 " Accept the current user prompt.
+ If handlers contains " Dismiss the current user prompt.
- Return an annotated unexpected alert open error.
+ Return a prompt handler
+ configuration with [=prompt handler
+ configuration/handler=] " 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.
+
+ Let type be " If the current user prompt is an alert dialog,
+ set type to " Return an annotated unexpected alert open error.
+ Let handler be get the prompt handler
+ with type.
+
+ Perform the following substeps based
+ on handler's [=prompt handler configuration/handler=]:
+
+ Accept the current user prompt.
+
+ Dismiss the current user prompt.
+
+ 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.
@@ -10566,7 +10737,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.
@@ -10597,7 +10768,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
@@ -10642,19 +10813,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:
Return error with
error code element not interactable.
- Do nothing.
The following events are also defined in the HTML specification:
-
+
-
+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
- User Prompt Handler
-
+
+
+The known prompt handlers are:
dismiss
", "accept
"»
+ [=list/contains=] serialized,
+ and configuration's [=prompt handler
+ configuration/notify=] is true, append " and notify
"
+ to 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.
alert
",
+"beforeUnload
", "confirm
",
+"default
", "prompt
"».
+
+default
" type represents a fallback
+when no specific handler is defined for a given prompt type. The
+"beforeUnload
" prompt type does not use this default
+handler, but instead falls back to the "accept
" handler
+if no more specific handler is defined. This is because HTTP-only
+sessions do not allow the "beforeUnload
" handler to be
+customized, and enabling other protcols isn't expected to change
+the user prompt handling as a side effect.
+
+
-
-
+
+keyword
- in the known prompt handling approaches table
- return an error with error code invalid argument.
+
+ default
" → value]».
+
+
+
+ accept and notify
",
+ set handler to "accept
"
+ and notify to true.
+
+ dismiss and notify
",
+ set handler to "dismiss
"
+ and notify to true.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
default
", return the result of serialize a prompt
+ handler configuration with user prompt
+ handler["default
"].
+
+ value
of user prompt
+ handler:
+
+
+
+
+ User prompts
-text
"
-
-
+
-
beforeUnload
", return a
+ prompt handler configuration with [=prompt
+ handler configuration/handler=] "accept
"
+ and [=prompt handler configuration/notify=] false.
-default
"
+ return handlers["default
"].
-
-
-dismiss
" and [=prompt handler
+ configuration/notify=] true.
-
+
+
@@ -10523,7 +10694,7 @@ default
".
+
+ alert
". Otherwise, if
+ the current user prompt is a confirm dialog,
+ set type to "confirm
". Otherwise, if
+ the current user prompt is a prompt dialog,
+ set type to "prompt
".
+
+
-
+
+accept
"
+dismiss
"
+ignore
"
+Dismiss Alert
The Dismiss Alert command
dismisses a simple dialog
if present.
-A request to dismiss an alert user prompt,
+A request to dismiss an alert user prompt,
which may not necessarily have a dismiss button,
has the same effect as accepting it.
@@ -10535,7 +10706,7 @@ Dismiss Alert
context is no longer open, return error
with error code no such window.
- Accept Alert
context is no longer open, return error
with error code no such window.
- Get Alert Text
context is no longer open, return error
with error code no such window.
- Send Alert Text
context is no longer open, return error
with error code no such window.
-
-
window.alert
+ window.confirm
window.prompt
Index
Index