Skip to content

Commit 41a03ad

Browse files
committed
Element Send Keys: Reorder steps
We should move the element into view before trying to check whether it's keyboard interactive. There's no point getting the text length if we're just going to set the selected files for a `file` INPUT element.
1 parent a17c66a commit 41a03ad

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

webdriver-spec.html

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5620,34 +5620,24 @@ <h3>Element Send Keys</h3>
56205620
of <a>trying</a> to <a>get a known element</a>
56215621
with argument <var>element id</var>.
56225622

5623+
<li><p><a>Scroll into view</a> the <var>element</var>.
5624+
56235625
<li><p>Wait in an implementation-specific way up to the <a>session
56245626
implicit wait timeout</a> for <var>element</var> to
56255627
become <a>keyboard-interactable</a>.
56265628

56275629
<li><p>If <var>element</var> is not <a>keyboard-interactable</a>,
56285630
return <a>error</a> with <a>error code</a> <a>element not interactable</a>.
56295631

5630-
<li><p><a>Scroll into view</a> the <var>element</var>.
5631-
5632-
<li><p>If <var>element</var> is not the <a>active element</a>:
5633-
5634-
<ol>
5635-
<li><p>Run the <a>focusing steps</a> for the <var>element</var>.
5636-
5637-
<li><p>Let <var>current text length</var> be
5638-
the <var><a>element</a></var>’s <a data-lt="node
5639-
length">length</a>.
5640-
5641-
<li><p>Set the text insertion caret using <a>set selection range</a>
5642-
with using <var>current text length</var> as the 2 parameters passed in.
5643-
</ol>
5644-
56455632
<li><p>Let <var>text</var> be the result of <a>getting a property</a>
56465633
<code>text</code> from the <var>parameters</var> argument.
56475634

56485635
<li><p>If <var>text</var> is not a string, return an <a>error</a>
56495636
with <a>error code</a> <a>invalid argument</a>.
56505637

5638+
<li><p>If <var>element</var> is not the <a>active element</a>, run
5639+
the <a>focusing steps</a> for the <var>element</var>.
5640+
56515641
<li><p>If <var>element</var> is an <a><code>input</code> element</a> whose
56525642
<a><code>type</code> attribute</a> is <a>File</a>:
56535643
<ol>
@@ -5681,10 +5671,16 @@ <h3>Element Send Keys</h3>
56815671
<li><p>Jump to the last step in this overall set of steps.
56825672
</ol>
56835673

5684-
<li><p>Let <var>keyboard</var> be a new <a>key input source</a>.
5674+
<li><p>Let <var>current text length</var> be
5675+
the <var><a>element</a></var>’s <a data-lt="node length">length</a>.
5676+
5677+
<li><p>Set the text insertion caret using <a>set selection range</a>
5678+
with using <var>current text length</var> as the 2 parameters passed in.
5679+
5680+
<li><p>Let <var>keyboard</var> be a new <a>key input source</a>.
56855681

5686-
<li><p><a>Dispatch actions for a string</a> with
5687-
arguments <var>text</var> and <var>keyboard</var>.
5682+
<li><p><a>Dispatch actions for a string</a> with
5683+
arguments <var>text</var> and <var>keyboard</var>.
56885684

56895685
<li><p>Remove <var>keyboard</var> from the <a>current
56905686
session</a>'s <a>input state table</a>

0 commit comments

Comments
 (0)