Forum Discussion

winston's avatar
winston
Occasional Contributor
7 years ago

script playback "missing" clicks on GDI viewport/canvas

I have multiple script tests that click on a GDI viewport/ canvas-type object in our application to test drawing in the viewport and using various custom controls that appear in the viewport.  In the past week, the scripts that test various operations in the mentioned viewport have become very unreliable because the clicks on the viewport will often not work.  In the log I am seeing that the object was clicked for every .Click() action the script calls, but the viewport is not registering them as clicks -- seemingly at random.  I have tried putting short delays after the click actions and even HoverMouse at the same XY coordinates right before the clicks to no avail.  Is anyone else experiencing this issue or have any suggestions?  Thanks

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I think you are on the right track in that you are dealing with timing delays.  If you click on something and the application redraws while your next click is occurring, you may see the behavior you're experiencing.  I've seen this myself.

     

    Something you can try, for that section of your tests, is to increase the time between events.  This can be done programmatically using Options.Run.Delay.  For example, if you set that to 500 at the start of your test, TestComplete will automatically wait 500 ms between events.  Increase that as necessary until you get a better result of your test.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        I'm not sure how in depth you can get to the points in your canvas, but something else you could do is use "Wait" methods to wait for an object to appear, to be ready, to be enabled, etc., before you attempt to click on it.  But I think that, for this situation, the event delay is going to be your best bet.