Skip to content

Commit 3ea8e08

Browse files
Add WebDriver automation for custom handlers
Closes whatwg#8251.
1 parent d58f35f commit 3ea8e08

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

source

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4339,6 +4339,24 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
43394339
</ul>
43404340
</dd>
43414341

4342+
<dt>WebDriver</dt>
4343+
4344+
<dd>
4345+
<p>The following terms are defined in <cite>WebDriver</cite>: <ref spec=WEBDRIVER></p>
4346+
4347+
<ul class="brief">
4348+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-extension-commands">extension command</dfn></li>
4349+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-remote-end-steps">remote end steps</dfn></li>
4350+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-errors">WebDriver error</dfn></li>
4351+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-error-code">WebDriver error code</dfn></li>
4352+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-invalid-argument">invalid argument</dfn></li>
4353+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#dfn-getting-properties">getting a property</dfn></li>
4354+
<li><dfn data-x="success-value" data-x-href="https://w3c.github.io/webdriver/#dfn-success">success</dfn></li>
4355+
<li><dfn data-x-href="https://w3c.github.io/webdriver/#security">WebDriver's security considerations</dfn></li>
4356+
<li><dfn data-x="webdriver-current-browsing-context" data-x-href="https://w3c.github.io/webdriver/#dfn-current-browsing-context">current browsing context</dfn></li>
4357+
</ul>
4358+
</dd>
4359+
43424360
<dt>WebDriver BiDi</dt>
43434361

43444362
<dd>
@@ -103074,6 +103092,25 @@ interface <dfn interface>Navigator</dfn> {
103074103092
declined such registrations) so that the user is not repeatedly prompted with the same
103075103093
request.</p>
103076103094

103095+
<p>If the <span><code
103096+
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> automation
103097+
mode</span> of <span>this</span>'s <span>relevant global object</span>'s <span
103098+
data-x="concept-document-window">associated <code>Document</code></span> is not "<dfn><code
103099+
data-x="rph-automation-mode-none">none</code></dfn>", the user agent should first verify that it
103100+
is in an automation context (see <span>WebDriver's security considerations</span>). The user
103101+
agent should then bypass the above communication of information and gathering of user consent,
103102+
and instead do the following based on the value of the <span><code
103103+
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> automation
103104+
mode</span>:</p>
103105+
103106+
<dl>
103107+
<dt>"<dfn data-x="rph-automation-mode-auto-accept"><code>auto-accept</code></dfn>"</dt>
103108+
<dd><p>Act as if the user has seen the registration details and accepted the request.</p></dd>
103109+
103110+
<dt>"<dfn data-x="rph-automation-mode-auto-reject"><code>auto-reject</code></dfn>"</dt>
103111+
<dd><p>Act as if the user has seen the registration details and rejected the request.</p></dd>
103112+
</dl>
103113+
103077103114
<p>When the <dfn export data-x="protocol-handler-invocation" data-lt="invoke a protocol
103078103115
handler">user agent uses this handler</dfn> for a <span>URL</span> <var>inputURL</var>:</p>
103079103116

@@ -103276,9 +103313,57 @@ interface <dfn interface>Navigator</dfn> {
103276103313
button and a "deny" button, with the "accept" binding containing the name of the handler, it's
103277103314
important that a long name not cause the "deny" button to be pushed off the screen.</p>
103278103315

103279-
</div>
103316+
<h6><dfn id="rph-user-agent-automation">User agent automation</dfn></h6>
103280103317

103318+
<p>Each <code>Document</code> has a <dfn><code
103319+
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> automation
103320+
mode</dfn>. It defaults to "<code data-x="rph-automation-mode-none">none</code>", but it also can
103321+
be either "<code data-x="rph-automation-mode-auto-accept">auto-accept</code>" or "<code
103322+
data-x="rph-automation-mode-auto-reject">auto-reject</code>".</p>
103281103323

103324+
<p>For the purposes of user agent automation and website testing, this standard defines <dfn
103325+
data-x="set-rph-registration-mode">Set RPH Registration Mode</dfn> WebDriver <span>extension
103326+
command</span>. It instructs the user agent to place a <code>Document</code> into a mode where it
103327+
will automatically simulate a user either accepting or rejecting and registration confirmation
103328+
prompt dialog.</p>
103329+
103330+
<table class="data">
103331+
<thead>
103332+
<tr>
103333+
<th>HTTP Method
103334+
<th>URI Template
103335+
<tbody>
103336+
<tr>
103337+
<td>`<code data-x="">POST</code>`
103338+
<td><code data-x="">/session/{session id}/custom-handlers/set-mode</code>
103339+
</table>
103340+
103341+
<p>The <span>remote end steps</span> are:</p>
103342+
103343+
<ol>
103344+
<li><p>If <var>parameters</var> is not a JSON Object, return a <span>WebDriver error</span> with
103345+
<span>WebDriver error code</span> <span>invalid argument</span>.</p></li>
103346+
103347+
<li><p>Let <var>mode</var> be the result of <span>getting a property</span> named "<code
103348+
data-x="">mode</code>" from <var>parameters</var>.</p></li>
103349+
103350+
<li><p>If <var>mode</var> is not "<code
103351+
data-x="rph-automation-mode-auto-accept">auto-accept</code>", "<code
103352+
data-x="rph-automation-mode-auto-reject">auto-reject</code>, or "<code
103353+
data-x="rph-automation-mode-none">none</code>", return a <span>WebDriver error</span> with
103354+
<span>WebDriver error code</span> <span>invalid argument</span>.</p></li>
103355+
103356+
<li><p>Let <var>document</var> be the <span data-x="webdriver-current-browsing-context">current
103357+
browsing context</span>'s <span>active document</span>.</p></li>
103358+
103359+
<li><p>Set <var>document</var>'s <span><code
103360+
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> automation
103361+
mode</span> to <var>mode</var>.</p></li>
103362+
103363+
<li><p>Return <span data-x="success-value">success</span> with data null.</p></li>
103364+
</ol>
103365+
103366+
</div>
103282103367

103283103368
<h5>Cookies</h5>
103284103369

@@ -131342,6 +131427,9 @@ INSERT INTERFACES HERE
131342131427
<dt id="refsWEBCRYPTO">[WEBCRYPTO]</dt>
131343131428
<dd><cite><a href="https://w3c.github.io/webcrypto/Overview.html">Web Cryptography API</a></cite>, D. Huigens. W3C.</dd>
131344131429

131430+
<dt id="refsWEBDRIVER">[WEBDRIVER]</dt>
131431+
<dd><cite><a href="https://w3c.github.io/webdriver/">WebDriver</a></cite>. W3C</dd>
131432+
131345131433
<dt id="refsWEBDRIVERBIDI">[WEBDRIVERBIDI]</dt>
131346131434
<dd><cite><a href="https://w3c.github.io/webdriver-bidi/">WebDriver BiDi</a></cite>. W3C</dd>
131347131435

0 commit comments

Comments
 (0)