Forum Discussion

jcruz's avatar
jcruz
Contributor
9 years ago

How Can I turn off the Caps Lock before running my test script?

Hello Everyone!!

 

I need to know what I have to do to turns off the Caps Lock during  the execution of my Tests Script, so for I dont have any problems, this is because I use the keys  method to simulate keystroke but if The Caps Lock is turning On My test does not make the action that I programmed

 

I hope SomeBody Can help me to solve this situation

Thanks

4 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi jcruz,

     

    TestComplete automatically turns off Caps Lock before test recording and test runs.

  • jcruz's avatar
    jcruz
    Contributor

    In fact,I had already read that however Test Complete does not turn off the Caps I thought there was a configuration missing

    • HKosova's avatar
      HKosova
      SmartBear Alumni (Retired)

      What makes you think TestComplete is not turning off Caps Lock? What actions is your test trying to perform, and what exactly does not work as expected?

      Please provide more details - script code or keyboard test screenshots, error text from the test log, and so on.

      • PeterMitcham's avatar
        PeterMitcham
        Occasional Contributor

        If bl is true then caps lock is on. the Keybd event will then turn it off, and the last call tests the keystate again to confirm its off.

         

        bl = cBool(Win32API.GetKeyState(VK_CAPITAL))

        If bl then

        Call Win32API.keybd_event(VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYDOWN, 0)

        Call Win32API.keybd_event(VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)

        End if

        bl = cBool(Win32API.GetKeyState(VK_CAPITAL))