Forum Discussion

davemcauley's avatar
davemcauley
New Contributor
3 years ago
Solved

Desktop Driver Key Board operations dont seem to work with swing.

Desktop Driver Key Board operations dont seem to work with swing.   Trying driver.getDesktop().keys("[Tab]") operation while in a text box but nothing happens.
  • AlexKaras's avatar
    AlexKaras
    3 years ago

    Hi David,

     

    how then can you tab to different parts with in your application if that is what is required?

    Not sure if I got your question right...

    I have much more experience with TestComplete but not with TestLeft, but, considering that TestLeft is based on TestComplete's engine, I believe that the described functionality will match.

    So, when you write test code, you usually know what window/object you need to interact with and usually the code looks like driver.Window(...).Control(...).Keys(...).

    If some window must be activated (i.e. put into foreground), then its .Activate() method should be used.

    .Keys() method basically puts specified string into the message queue of referenced window/control. How the queue is dispatched and processed is determined by the OS and the application itself.

    For example, the input put into the window message queue can be dispatched first to the active focused control and then, if not processed, to the window itself.

     

    To summarize: explicit reference to windows/controls improves reliability of test code. Sending keys to desktop (or, say, main application's window) might work but with much less reliability and the result of the execution will depend on the current system's state. (For example, unexpected notification window might break the whole test.)

     

    Does this answer your question somehow?