Skip to content

Commit cfbdd21

Browse files
shs96cAutomatedTester
authored andcommitted
Send Keys: Allow HTML5 values to be sent
It should be possible to use `Element Send Keys` to set the value of INPUT elements that are rendered as something other than a text control. We do this by allowing users to send form-serialized values to the element and setting the value directly.
1 parent 03c911c commit cfbdd21

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

webdriver-spec.html

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ <h3>Dependencies</h3>
270270
<!-- Button --> <li><dfn><a href="https://html.spec.whatwg.org/#button-state-%28type=button%29">Button</a></dfn> state
271271
<!-- Buttons --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-button>Buttons</a></dfn>
272272
<!-- Canvas context mode --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-canvas-context-mode>Canvas context mode</a></dfn>
273+
<!-- Color state --> <li><dfn><a href="https://html.spec.whatwg.org/#color-state-(type=color)"><code>color</code> state</a></dfn>
273274
<!-- Multiple --> <li><dfn><a href=https://html.spec.whatwg.org/#attr-input-multiple><code>multiple</code> attribute</a></dfn>
275+
<!-- Mutable --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-mutable>Mutable</a></dfn>
274276
<!-- Change event --> <li><dfn><a href="https://html.spec.whatwg.org/multipage/indices.html#event-change"><code>change</code> event</a></dfn>
275277
<!-- Checkbox --> <li><dfn><a href="https://html.spec.whatwg.org/#checkbox-state-%28type=checkbox%29">Checkbox</a></dfn> state
276278
<!-- Checkedness --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-checked>Checkedness</a></dfn>
@@ -323,6 +325,7 @@ <h3>Dependencies</h3>
323325
<!-- Settings object --> <li><dfn><a href=https://html.spec.whatwg.org/#settings-object>Settings object</a></dfn>
324326
<!-- Simple dialogs --> <li><dfn data-lt="simple dialog"><a href=https://html.spec.whatwg.org/#simple-dialogs>Simple dialogs</a></dfn>
325327
<!-- Submit Button --> <li><dfn><a href="https://html.spec.whatwg.org/#submit-button-state-%28type=submit%29">Submit Button</a></dfn> state
328+
<!-- Suffering from bad input --> <li><dfn><a href=https://html.spec.whatwg.org/#suffering-from-bad-input>Suffering from bad input</a></dfn>
326329
<!-- Submittable elements --> <li><dfn data-lt="submittable element"><a href=https://html.spec.whatwg.org/#category-submit>Submittable elements</a></dfn>
327330
<!-- Top-level browsing context --> <li><dfn data-lt="top-level browsing contexts"><a href=https://html.spec.whatwg.org/#top-level-browsing-context>Top-level browsing context</a></dfn>
328331
<!-- Traverse the history by a delta --> <li><dfn><a href=https://html.spec.whatwg.org/#traverse-the-history-by-a-delta>Traverse the history by a delta</a></dfn>
@@ -5621,7 +5624,7 @@ <h3>Element Send Keys</h3>
56215624
<li><p>If <var>text</var> is not a string, return an <a>error</a>
56225625
with <a>error code</a> <a>invalid argument</a>.
56235626

5624-
<li><p>If <var>element</var> is not the <a>active element</a>, run
5627+
<li><p>If <var>element</var> is not the <a>active element</a> run
56255628
the <a>focusing steps</a> for the <var>element</var>.
56265629

56275630
<li><p>If <var>element</var> is an <a><code>input</code> element</a> whose
@@ -5657,11 +5660,36 @@ <h3>Element Send Keys</h3>
56575660
<li><p>Jump to the last step in this overall set of steps.
56585661
</ol>
56595662

5663+
<li><p>If the user agent renders <var>element</var> as
5664+
something other than a text input control (for example
5665+
an <a><code>input</code></a> element in the <a><code>color</code>
5666+
state</a> being presented as a colorwheel):
5667+
5668+
<ol>
5669+
<li><p>If <var>element</var> does not have an <a>own property</a>
5670+
named <code>value</code> return an <a>error</a> with <a>error
5671+
code</a> <a>element not interactable</a>
5672+
5673+
<li><p>If <var>element</var> is not <a>mutable</a> return
5674+
an <a>error</a> with <a>error code</a> <a>element not
5675+
interactable</a>.
5676+
5677+
<li><p><a>Set a property</a> <code>value</code> to <var>text</var>
5678+
on <var>element</var>.
5679+
5680+
<li><p>If <var>element</var> is <a>suffering from bad input</a>
5681+
return an <a>error</a> with <a>error code</a> <a>invalid
5682+
argument</a>.
5683+
5684+
<li><p>Return <a>success</a> with data <code>null</code>.
5685+
</ol>
5686+
56605687
<li><p>Let <var>current text length</var> be
56615688
the <var><a>element</a></var>’s <a data-lt="node length">length</a>.
56625689

56635690
<li><p>Set the text insertion caret using <a>set selection range</a>
5664-
with using <var>current text length</var> as the 2 parameters passed in.
5691+
using <var>current text length</var> for both the <code>start</code>
5692+
and <code>end</code> parameters.
56655693

56665694
<li><p>Let <var>keyboard</var> be a new <a>key input source</a>.
56675695

0 commit comments

Comments
 (0)