Forum Discussion

scalabrese's avatar
scalabrese
New Contributor
10 years ago

Find and FindChild extremely Slow in Chrome (when looking at contentText property)


I have been experiencing extremely slow performance in Chrome for quite some time (and to a lesser extent IE11) as compared to Firefox.  After researching a bit and experimenting with disabling Extensions (which did not seem to make much difference), I think I may have tracked the issue down more specifically to the Find or FindChild functions when one of the searched properties is the contentText.  It is possibly that it impacts Find and FindChild in other cases as well, but contentText seems to be the one giving me issues.



For a given object (although certainly not unique to this Object), I noted the following times for my Find. Firefox (0.3 sec), IE11 (1.6 sec), and Chrome (13 sec).  To be clear, my "Find" is inside a loop that looks like this in JScript...



while (item == null || item == undefined || !item.Exists)

{

item = parent.FindChild(props, values);

Delay(100);

}

return item;



I have certainly seen other posts about performance issues with Chrome in TestComplete, but is anyone aware of this specific issue?  Is it possible that there is an issue in how TestComplete handles the contentText Property?


5 Replies

  • s5h's avatar
    s5h
    Contributor
    Hi Scott, 



    I have been experiencing the same issues. We were originally using FindChild with IE and did not see any issues. We then switched to Chrome and tests that took 3mins in IE now take more than 12mins in Chrome. I have tried to talk to support regarding this but I got no resolutions. It seems ExtenedFind is a lot faster to use but it takes a lot more time than to namemap the objects. Support indicated to me that FindChild should be the same speed as extendedfind but the same tests using ExtFind takes 17s and with FC it takes 1m 40s. 



    I am looking at an ID propert y that our developers have added so I think its an issue with FindChild on any property 



    Hope it is resolved soon
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    If you're ok with possibly returning the parent object I would suggest trying to use .Find instead of .FindChild. While the documentation says these two are the same I have found that .Find seems to perform significantly quicker.



    It may also help to search only within the page object:



    Sys.Browser("chrome").Page("yourwebsite").Find(arProps,arPropVals,depth,refresh)



    If you search within the browser (Sys.Browser("chrome").Find...) the Find/FindChild method may be unnecessarily searching other pages open or active in memory.



    Additionally, you can set the refresh to false if you are performing multiple searchs on the same page and manually call a refresh to the object tree using Sys.Browser("chrome").Refresh(); after each page navigation.



    Sys.Browser("chrome").Page("yourwebsite").Find(arProps,arPropVals,depth,false)



    Lastly, don't forget to call CollectGarbage(); to tell the garbage collector it should do it's job.



    Hope that helps! :)
  • scalabrese's avatar
    scalabrese
    New Contributor
    Thanks Ryan.  I was actually already starting my search below the Page.  I already had the page and found a panel a few levels below the page, then searched within this panel to find the object.  I have not yet tried switching to .Find instead of .FindChild but will give it a shot.  I had also experimented with eliminating the refresh, but this had little impact on the performance I saw and caused me some other issues due to the pages having dynamic content.



    I will definitely need to look into the CollectGarbage() for a different TestComplete project I run against a WPF client that seems to have memory leaks.



    All this having been said, the Developers added some Identifiers where possible so I switched the Find to look for idStr rather than contentText and it went from 13 sec to about 1 sec in Chrome.  In Firefox it is about 0.3 sec whether looking at idStr or contentText. 



    It seems to me that there is a bug (or at least major limitation) to using Find by contentText in Chrome.
  • Hi Scott,

    My experience has been similar with speed in different browsers.  I think that FireFox is just quicker than Chrome.  My experience is that IE is significantly slower than either FireFox or Chrome.  I'm wondering if IE has more security hurdles that result in slower speeds.
  • blatec's avatar
    blatec
    Occasional Contributor

    For testing our application we need the FindChild funtionality very often.
    But with Chrome we have a big performance problem:

     

    TC Version 11.31.2420.7

     

    Is there any solution to get a better performance with chrome?

    Firefox = OK
    var StopWatch;
    StopWatch = HISUtils.StopWatch;
    StopWatch.Start();
    var pageObj = Sys.Browser("firefox").Page("http://u020:23380/CRM/*").FindChild("contentText", "Qnotiz_2805_VK_01", 500, true);
    StopWatch.Stop();
    Log.Message("Firefox Execution time: " + StopWatch.ToString());

    Firefox Execution time: 00:00:00.390


    Internet-Explorer, slower but ok
    var StopWatch;
    StopWatch = HISUtils.StopWatch;
    StopWatch.Start();
    var pageObj = Sys.Browser("iexplore").Page("http://u020:23380/CRM/*").FindChild("contentText", "Qnotiz_2805_VK_01", 500, true);
    StopWatch.Stop();
    Log.Message("Internet Explorer Execution time: " + StopWatch.ToString());

    IE Execution time: 00:00:00.530


    Chrome,takes 10 time longer
    var StopWatch;
    StopWatch = HISUtils.StopWatch;
    StopWatch.Start();
    var pageObj = Sys.Browser("chrome").Page("http://u020:23380/CRM/*").FindChild("contentText", "Qnotiz_2805_VK_01", 500, true);
    StopWatch.Stop();
    Log.Message("Chrome Execution time: " + StopWatch.ToString());

    Chrome Execution time:00:00:05.148