Forum Discussion

dankh's avatar
dankh
New Contributor
9 years ago
Solved

Difference between using Sys.Keys or TestObj.Keys

Hi,

 

I've inherited a test project that uses both Sys.Keys and TestObj.Keys methods to simulate keystrokes. For example:

 

Some units contain Call Sys.Keys("[F10]") 

 

While others contain Call frmMenu.StripMainMenu.Keys("[F10]")

 

Are there any benefits over using object specific key presses over Sys.Keys?

 

I suspect that using Sys.Keys makes it easier to maintain tests if object names change but I'd like to know whether there are best practises to follow.

 

Thanks,

 

Dan

  • Hello dankh,

     

    Sys.Keys(), sends the keystrokes to whatever is in the context.

     

    TestObj.Keys(), sends the keystrokes to the TestObj, the benefit of this one is that you don't have to navigate to the TestObj to send the Keystrokes.

     

    I hope this make it clear. 

     

    Regards,

     

    Leandro de Araújo Souza

2 Replies

  • Hello dankh,

     

    Sys.Keys(), sends the keystrokes to whatever is in the context.

     

    TestObj.Keys(), sends the keystrokes to the TestObj, the benefit of this one is that you don't have to navigate to the TestObj to send the Keystrokes.

     

    I hope this make it clear. 

     

    Regards,

     

    Leandro de Araújo Souza

  • hi,

     

    Sys.Keys:

    send the key strokes to system i.e the active GUI component visible and active on your desktop.

    Ex: If you want your browser to run in a full screen mode. You have to activate the browser and sendKeys F10. i.e. bring the browser window to the foreground on your desktop and press F10

     

    Testobj.Keys :

    send the keystrokes to the runtime object "Testobj"

    Ex: you have a button on your application which opens a different edit page for different edit options. Say your "Edit" button on pressing key Cltr+E gives a normal edit page. where are Ctrl+E+A gives you a admin options edit page. Then you use Testobj.Keys feature. 

     

    hope this helps you. thank you.