webdriver
webdriver copied to clipboard
Ambiguity Regarding Sending Keys to Option Elements
In chapter 12. Elements, section 12.4 Interaction: In element send keys step 8 under the case labeled:
The user agent renders element as something other than a text input control (for example an input element in the color state being presented as a colorwheel):
I would like clarification on the expected behavior of sending keys to option elements. Strictly adhering to the spec, option elements would have their value themselves changed, and I wanted to confirm if this is intended behavior as it is somewhat strange. It appears that Firefox sends keys to the value of the parent select element rather than the options element, which perhaps is more reasonable and what was intended.
If Firefox's implementation is correct, would the same apply to options with datalist element parents that connect to input elements? Here is a stock example of the scenario I am referring to if it's confusing
Any confirmation or discussion would be appreciated.
From my perspective, as a developer working with Mink, Behat, and Php-Webdriver, I'd say that setting the value directly has a lot of benefits due to a combination of browser and OS variation.
However, I think that the firing of relevant change/input events needs to be explicitly mentioned in the specification in the same way that it is for file input elements.
As it stands on Firefox a select dropdown will fire on every intermediary change, whilst on Chrome this only happens when the selection is final. These kinds of variation are tricky to work around in the application, especially when the behaviour again changes depending upon the OS.