Forum Discussion

ali_jafer's avatar
ali_jafer
Occasional Contributor
10 years ago

TestComplete slowness (performance hit) with chrome while using FindChildByXPath

Test Environment:

Windows 7 and Windows 2008 Server, Chrome 26, TestComplete 9.3 (couldn’t use latest testcompete and chrome version as we don’t’ have license of latest TC yet L)

Web Application developed using technologies: MS .Net, MVC, JSon

Description:

On a web page I have two text boxes, labeled as Courier and Queue, I couldn’t NameMap them as no unique property (not even unique id) is there to map, hence I have to use  FindChildByXPath to recognize them as  web page element objects.

When I execute my following script, TestComplete is taking on average 3 to 4 seconds on FindChildByXPath statement and unfortunately 10 to 11 seconds when it comes to Key in data to these objects(textboxes). I could not understand that when TC has recognized the objects, why it is taking too much time again when it comes to performing operations on these objects. If those controls are once recognized and assigned to objects, there is no point again taking that much time as it will kill the purpose of automation, operation can be performed manually faster than that.

Also observed that when I try to object spy these text boxes, TestComplete hangs and computer CPU utilization reaches to 100%.

Any help in this regard is highly appreciated



Code Snippet:

    var StopWatch;

    StopWatch = HISUtils.StopWatch;

    StopWatch.Start();

    var objCourier=page.FindChildByXPath(“//*[@id='divCourierSearchTextBox']//input[@type='text']”, false);

    StopWatch.Stop();

    Log.Message("Time taken to recognize Courier object: " + StopWatch.ToString());//takes 3 to 4 secs

    StopWatch.Reset();

    StopWatch.Start();

    var objQueue=page.FindChildByXPath(“//*[@id='divQueueSearchTextBox']//input[@type='text']”, false);

    StopWatch.Stop();

    Log.Message("Time taken to recognize Queue object: " + StopWatch.ToString());//takes 3 to 4 secs

    StopWatch.Reset();

    StopWatch.Start();

    if (objCourier != null &&  objQueue != null)

    {

      StopWatch.Stop();

      Log.Message("Time taken to check if objects are not null: " + StopWatch.ToString());//takes no time, very quick

      StopWatch.Reset();

      StopWatch.Start();

        // If the elements were found, enter data

      objCourier.Keys(strCourier+"[Enter]");

      StopWatch.Stop();

      Log.Message("Time taken to key in courier value: " + StopWatch.ToString());//takes 10 to 11 secs

      page.article.tbParcelNumber.Keys(parcelNo);

      Log.Message(parcelNo);

      StopWatch.Reset();

      StopWatch.Start();

      objQueue.Keys(strQueue+"[Enter]");

      StopWatch.Stop();

      Log.Message("Time taken to key in Queue value: " + StopWatch.ToString());//takes 9 to 10 secs

3 Replies

  • I am facing the same slowness issue.

    The peculiarity is that in IE and FF same FindChildByXPath works much faster(even if it is from root)

    whereas in Chrome it takes more than 5 seconds for each object. My Google Chrome V Version 37.0.2062.124 m
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Ali,

     


    You are calling the FindChildByXPath method from the root page element. As a result, TestComplete iterates through all elements on your page in order to find the desired one. Try searching for the element as close to its parent as possible. This will speed up the search process.