Forum Discussion

frankl's avatar
frankl
Occasional Contributor
14 years ago

Keys method painfully slow in TC 8.6 on IE8

Greetings,



With TC 8.5 and lower, TestObj.Keys() worked just fine, running as I'd expect. When I installed TC 8.6, it immediately became painfully slow - about 1.5 seconds per character. I've implemented all of the Automated Test Performance Tips I could and use SetText() when possible, but there are times only Keys() has the desired behavior. This has happened on several test machines, so it is not particular to one machine. The environment is:



  • Windows XP, 32-bit, Service Pack 3


  • Internet Explorer 8.0.6001.18702


  • TestComplete 8.60.665.7


  • JScript project, Tree object model, ANSI encoding, Make Page object a child of the browser process


  • No other browser support required


I also tried TestObj.Click() followed by Sys.Keys(), but that made no difference. Is there any way to speed this up other than reverting to 8.5?



Thanks!

Frank

10 Replies

  • Hello Frank,


    We are aware of an issue in TestComplete that can result in the problem you faced. Please submit a support request and ask for a patch to resolve the issue.

  • frankl's avatar
    frankl
    Occasional Contributor
    Thank you Irene. I've made the support request.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    FYi, while SetText may not always do what you want, there are other alternatives other than using "Keys".  There are native properties and methods on most components that allow you to manipulate them and call events and event handlers so as to simulate keystrokes without actually executing keystrokes.  I've found in cases where SetText does not work, this is my preferred method of doing things.
  • frankl's avatar
    frankl
    Occasional Contributor
    Hi Robert,



    I am not familiar with the techniques you're describing. Let me give you a little more detail and perhaps you can point me in the right direction. The fields that I'm calling Keys() on are things like date and SSN fields that start out blank and then upon gaining focus change to "__/__/____" (for the example of date). Each numeric keystroke replaces a "_"; non-numerics are ignored and the "/" are skipped over. So typing "01232011" displays "01/23/2011" (ASP.NET AJAX Calendar Control). Looking at the Object Spy, it appears this is accomplished by defining onchange() and onkeypress() event handlers. Are you suggesting calling onkeypress() for each digit and then calling onchange() at that end? Is there an example of using this technique in TC you could point me at?



    Thank you!

    Frank
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Why not just assign the text property of the component?  Shouldn't you be able to do something like



    MyField.Text = "11/09/2011"




    As for the events, yes, that's kind of what I'm talking about.  In my previous life, I had to automate a delphi application where I needed to make sure that, after using SetText, I called an event handler to update other fields on the same screen that are normally updated upon existing the edit field.  So, what I had to do was call the event handler after setting the text field for the exit.  It looked something like



    MyField.Text := "2";

    MyField.DoExit;





    So, depending upon the component, you can simulate the effects of actual keystrokes by calling the event handlers.
  • frankl's avatar
    frankl
    Occasional Contributor
    Hi Robert,



    Thanks for your tips. I was able to get acceptable behavior for SSN and phone number controls, but the date control remains illusive. Any characters entered disappear when the control looses focus. I'm sure there must be some combination of calls that will achieve the correct behavior, but for now I have to move on.



    It was a big plus though to speed up testing the other two control types, so I appreciate you sharing your insights.
  • frankl's avatar
    frankl
    Occasional Contributor
    Irene, it works like a dream. It is faster than the Keys method ever was. Thanks!
  • Hi Team,

      In my application, I have to press (Ctrl+Shift+E) on a particular selected row using VB scripting. Please suggest me the way to do this once the row is selected using "set activecell' . I tried working with Sys.keys "[ctrl]" "[Shift]" "e" and also with sys.desktop.keys. But it did not work for our infragistics grid.


  • Hi Shashidhar,


     


    I've replied to your question here. Please don't duplicate the same question in different threads - it's difficult for us to handle them.