Forum Discussion

HKTCentrix's avatar
HKTCentrix
Occasional Contributor
5 years ago
Solved

Use Key Method to Press arrow-key-down for a certain time

When the arrow-key-down button is pressed, this mapped object in my winform app will display a 'dropdown' panel, 

 

Currently , it's neccessary that I use method .Keys('[Down]') on this object search_bar  to stimulate the visibility/appearence of the 'dropdown' panel 

            self.search_bar .Keys('[Down]')  
The panel does show up, however just for 1 second or so.

I need to make the 'dropdown' panel stayed for a longer time-frame, i.e. 50 seconds

How can I make the .Keys('[Down]') stay longer than 1 second as it would normally does.


self.search_bar = Aliases.SomeAppClient.Console.Streaming.Tabs.XyxStage.AbcSearchBar

 

 

  • sonya_m's avatar
    sonya_m
    5 years ago

    Hi HKTCentrix, since none of the suggestions helped, I am assuming your situation might require deeper investigation from our side.

    Please contact the SmartBear Support Team and describe the issue you are facing in detail. Thank you! 

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Do you need to have it HOLD the down key for a time?

     

    If that's the case, there is a "HOLD" keyword in the "Keys" method that will allow you to hold a set of keys down until you release.

    So, Keys('[Hold][Down]a[ReleaseLast]') will hold the down arrow and then tap the a key and then relase the down arrow.

     

    Will this work for you?

    • HKTCentrix's avatar
      HKTCentrix
      Occasional Contributor

      No, this does not work for me either. The effect is the same as .Keys('[Down]')

       

      self.stage_search.Keys('[Hold][Down][ReleaseLast]')

       

      the letter a trick didn't work either.

      self.stage_search.Keys('[Hold][Down]a[ReleaseLast]')

       

       

       

       

      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Hi HKTCentrix, since none of the suggestions helped, I am assuming your situation might require deeper investigation from our side.

        Please contact the SmartBear Support Team and describe the issue you are facing in detail. Thank you! 

  • HKTCentrix's avatar
    HKTCentrix
    Occasional Contributor

    I have tried using the timer

    start_time = time.time()
    while (time.time() - start_time < hold_time) :
             self.search_bar.Keys('[Down]')
    ############################

    Also, have tried this suggested somewhere in the forum:

    self.search_bar.SetFocus()
    self.search_bar.Keys('[Down]')
    Sys.Desktop.KeyDown(Win32API.VK_CONTROL);
    Delay(50000);
    Sys.Desktop.KeyUp(Win32API.VK_CONTROL); 

    Nothing has worked!