-1

We are using Sys.Desktop.KeyDown and Sys.Desktop.KeyUp VB methods of TestComplete to type into Notepad.

For this we are using a for loop containing KeyDown and KeyUp, however for some reason, even after the for loop ends, the typing is still not complete, its typing slowly, not sure why.

I checked by removing anti-virus software, but still seeing the issue. I have also tried to use the Win32API.GetKeyState(Asc("A")) however sometimes we get 1 and sometimes 0, so really need to debug this issue out. Could anybody suggest a way to debug this issue?

Helen
  • 87,344
  • 17
  • 243
  • 314
user1328572
  • 599
  • 1
  • 7
  • 12
  • 1
    You are Doing It Wrong™. You want [UI Automation](https://msdn.microsoft.com/en-us/library/ms747327.aspx) – IInspectable May 18 '15 at 12:05
  • 1
    When you see a program misbehave when you test it then you never look for the source of the problem in the testing tool. The 99.99% odds are that the program is simply sluggish at processing input, assuming that you don't otherwise slam it at a highly unrealistic rate. A very common bug, it probably has to be rewritten to move expensive code to a worker thread. File a bug. – Hans Passant May 18 '15 at 12:19

1 Answers1

0

Are you able to use .Keys() on the main text area object?

Something like:

Set textObject = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1)
Call textObject.Keys("Hello")

This is my preferred way of sending text when it is directed toward a particular object. Please refer to this link for more information on the Keys method.