Forum Discussion

shenyusun's avatar
shenyusun
Contributor
9 years ago

Unable to get the object when the software is in (Not Responding) state

Hello beautiful people,   I am running to an issue that I am unable to get the 'Yes' button with the software that I am testing.   Basically, when I click a certain button in the current software...
  • bbi's avatar
    bbi
    9 years ago

    About keys not working, don't use the testobject Keys but use the LLPlayer instead of.

     

    This insert a WM_Key message directly in windows loop and thus by-pass any code restriction 

     

    So to send a real ENTER key press to system ;

     

    LLPlayer.KeyDown(VK_RETURN, 5);
    LLPlayer.KeyUp(VK_RETURN, 5);

    First parameter is virtual key code, list of them is here.

    Second optional parameter is delay, better to use it to simulate real-life press which is not INSTANT.

     

    BTW you can use the same for mouse message, so a left click is:

     

    LLPlayer.MouseDown(MK_LBUTTON, xcoord, ycoord, 25);
    LLPlayer.MouseUp(MK_LBUTTON, xcoord, ycoord, 25);

    First parameter is the mouse button.

    Second and third parameters are coordinates.

    Fourth parameter is delay, better to use it to simulate real-life press which is not INSTANT.

     

    Be careful, the mouse or keyboard event is sent to the system and thus is treated by the currently active windows.

     

    For a clik or a press, you need always to do both actions, down and up 

     

    For more information, search for LLPlayer in TC help.

     

    Hope it helps.