It is possible to automate interaction (but not necessarily record the same) with file dialogs across machines that have the same operating system but different file system layouts, and even across machines that have different operating systems (and therefore different file dialogs).
In case of nativeType() (which sends the key presses to whatever window which has the focus) this works because commonly file dialogs get the input focus into a text field for entering a file name or path when they appear on the screen.
Toolkit specific automation using type()¶
The above automation approach works with most editions of Squish, but it does not provide any control over which widgets are currently available for input.
To make the file dialog interaction more robust — at the price of making it toolkit-specific, instead of the above approach, record the entering of a filename and a Return keypress (or OK or Open button click). For example:
Toolkit agnostic automation using nativeType()¶
The following approach should work for most Squish editions because it does not require any object references. However, its successful use depends on two assumptions:
The file dialog opens within the anticipated amount of time.
After opening, the file dialog’s filename input field has the keyboard focus.