webdriver
webdriver copied to clipboard
"Create an input source" doesn't add the source to the map
Consider the following:
- An action sequence with the id of "default keyboard" is sent
- Perform actions is invoked
extract an action sequenceis invokedprocess an input source action sequenceis invoked- "6. Let source be the result of trying to get or create an input source given input state, type and id." is invoked
get or create an input sourceis invokedcreate an input sourceis invoked and a new input source returned. NOTE: this is not specified as being added to the input state map- Back in
process an input source action sequence: 3. "Otherwise, if type is "key" let action be the result of trying to process a key action with parameters id, and action item." is invoked
Dispatch actionsis invokedDispatch tick actionsis invoked- "3. Let source be the result of get an input source given input state and input id."
- The input source created above was not added to the input state map
In fact I see that "add an input source" is only referenced in:
§ 12.5.1 Element Click § 12.5.3 Element Send Keys
So I'm not sure exactly what should be adding input sources for actions... The documentation for "input sources" says:
Each input source has an input id which is stored as a key in the input state map.
So I assume that implicitly means that create an input source should add the source to the map? But that conflicts with "Element Send Keys" which explicitly adds the input source to the map:
- Let source be the result of create an input source with input state, and "key".
- Add an input source with input state, input id and source.
Another question is: where should the input source created in process an input source sequence be removed? Again, "remove an input source" is only referenced in "Element Click" and "Element Send Keys".
EDIT: looks like input sources for actions shouldn't be removed until "Release Actions" is called.
Another problem:
- Let source be the result of trying to get or create an input source given input state, type and id.
Conflicts with:
- If source is not undefined and source's type is not equal to type, or source is a pointer input source, return error with error code invalid argument.
i.e. it will fail for pointer actions?
Another problem:
process an input source action sequence can potentially be called multiple times from extract an action sequence, with differing types. If extract an action sequence should indeed add the source to the map, then this conflicts with:
- If source is not undefined and source's type is not equal to type, or source is a pointer input source, return error with error code invalid argument.
As it would require an multiple input sources to be created with the same id but different types.
i.e. it will fail for pointer actions?
That part confuses me too. Why this specific handling for pointer actions?
Just a guess from my side (not really good when one have to guess while reading the spec...): get_or_create_input_source is mentioned only in processing actions section, and should add input sources to input map for them to survive between process_actions calls and they can be removed with release_actions. Meanwhile, in element_click and element_send_keys new input sources are created, temporarily added to input map, processed and removed at the end of processing sequence.