Difference in Response times between BrowserSetText and BrowserTypeKeys
With Legacy input mode disabled, the following functions are replayed with a native equivalent:
- BrowserClick function is replayed as the BrowserNativeClick function
- BrowserDoubleClick replayed as BrowserNativeDoubleClick
- BrowserSetText and BrowserSetPassword replayed as the BrowserTypeKeys function
- BrowserMouseMove function is replayed as BrowserNativeMouseMove
From the list above, it is noted that the BrowserSetText function is replayed as BrowserTypeKeys. With this, we might expect the response times returned for each function to be very similar - assuming they are being run against the same element and carry out the same action, i.e:
This however is not the case. BrowserTypeKeys is faster than BrowserSetText and sometimes the difference is significant. The difference is caused by the differing actions these functions make. When replaying, BrowserSetText makes a BrowserGetText call first to see if it has to clear the contents of the text control before entering the keystrokes defined in the function. This action takes a few milliseconds. BrowserTypeKeys does not care about the contents of the text box and just adds the extra letters in regardless of its current value – so it is faster.
Both functions still use Windows api events to input text.
Therefore, if speed is the main concern, then BrowserSetText with legacy input mode enabled would be the fastest means of entering text into the field but it can be unreliable, which is the reason why, by default, legacy mode is disabled.