Forum Discussion

nicklott's avatar
nicklott
Occasional Contributor
8 years ago

Finding Objects That Are Not Onscreen

When running tests in TestComplete, the tests are able to find objects that are onscreen relatively quickly, but it takes considerably longer to find objects that are not onscreen. Is there any way to speed that up, so that it finds hidden objects faster? Right now it's taking about 30-40 seconds to find those objects, and I'm thinking something like 15-20 seconds is more reasonable. 

  • Have you checked below option?

    In tools/ options

     

     

    also speed would depend on how you are searching the object

    please read this specially if you have TC 12 

    Depth-First vs Breadth-First Search would be important 

  • NisHera's avatar
    NisHera
    Valued Contributor

    Have you checked below option?

    In tools/ options

     

     

    also speed would depend on how you are searching the object

    please read this specially if you have TC 12 

    Depth-First vs Breadth-First Search would be important 

  • If it's not too much of a pain, we try to scroll so the object in question will be on screen first.  Otherwise we just let it go.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Well, it depends a lot on how you are implementing your tests, what type of application you're testing, etc. There are some default timeouts built into your TestComplete project. One, under Properties -> Playback has an "auto-wait timeout" which defaults to 10 seconds. The other, under Open Applications -> Web Applications has a page wait timeout of 60 seconds. So, it is possible that, if you are testing a web page and you need to wait for the page to load to go on to the next step, that you could have an extended time of waiting before it returns.

    Additionally, if you are using WaitNNN methods or FindChild methods, those could have wait times and processing times as well...

    ALSO... each operation in a keyword test that interacts with an onscreen object has an "auto-wait timeout" setting that could over-ride the project default.

     

    and I'm sure there are other factors...

    so... if you could share a bit more about what you are doing within TestComplete, there may be some ways of tweaking your tests to run faster.

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    What do You mean by "find"? Do You mean identify? Or perform Actions with?

     

    TC accesses the Windows control tree, which holds the controls regardless of whether they are visible onscreen or not.

     

    As an example, I can get or set a text of an editbox which is shifted out of the visible range by scrollbar. This works fine.

     

    If I want to perform mouse Actions, the control must of course be onscreen. I get there by performing a .setFocus before any mouse Action, which in my AUT leads to a scrollbar Action that gets the control onscreen.

    • nicklott's avatar
      nicklott
      Occasional Contributor

      Let me give you an example of what I'm talking about and what I'm trying to accomplish:

       

      There are places in several of our Keyword Tests where we test and manipulate On/Off toggles. So, the way the tests are written, we'll start with an If...Then that says "If this toggle is set to off, then click it to turn it on" to make sure that the toggle always starts out being set to On each time the test runs. Then, we do an On Screen Action and use the Click method to set the toggle to Off. Then, we insert a property checkpoint to make sure that the toggle is set to Off. There's a checkbox (that is hidden and not visible onscreen) that is hooked into the toggle. We've found that the easiest way to implement the checkpoint is by checking the checked property for that checkbox (if the checkbox is checked, that means the toggle is set to On, and if the checkbox is unchecked, that means the toggle is set to Off), but the problem that we're having is that it is taking anywhere from 30 to 40 seconds for TC to find that hidden checkbox and seeing if it's checked or unchecked. 

       

      I'm hoping that there's a way to cut that time down to something like 15 seconds or 20 seconds (If we could cut it down even more, that would be great too). We're going through and optimizing tests, and we'd very much like to trim off that extra unnecessary time that it's taking TC to find things that aren't onscreen. 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        A suggestion further up the list involves turning off the option in your TestComplete configuration under Tools -> Options -> Engines -> NameMapping that says "Search for visible objects first". Basically, with this setting on, TestComplete will FIRST go through all visible objects to find what you want and THEN starts checking invisible.  From the help:

         

         

        Search for visible objects first - This option tells TestComplete to prefer visible over invisible objects when searching for mapped objects. If it is enabled (by default), TestComplete first tries to find a matching object that is also visible. If a visible object is not found within the search timeout (Auto-wait timeout or the timeout used in WaitAliasChild), TestComplete picks any invisible object that matches the mapping criteria. If this option is disabled, TestComplete always picks any matching object, whether visible or not. Notes: Disabling this option can reduce the object search time in tests that deal with many invisible objects. This option has no effect for objects whose mapping criteria explicitly include the Visible property. If you upgraded from TestComplete 10 to version 12 and found that your tests became slower, disable this option.
  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    Try and navigate the control tree. This should work.

     

    You start with Your toggle control. Go search the corresponding hidden Checkbox in the control hierarchy. How will You identify it? It could be on the same .Parent object as the toggle control, somewhere in ist neighbourhood or maybe it does have a link to it.

     

    Check it in the object browser. The Checkbox should be there and can be accessed via script.