Forum Discussion

Al2's avatar
Al2
Occasional Contributor
5 years ago

FindChildByXpath method is very very slow all of sudden

Hello,

 

I've been using FindChildByXpath method for a long time now, but lately I've noticed that this has besome very very slow in finding out the objects. These are the same programs that I've been running for more than 3-4 years. I don't know if this is the chrome version or the TC version or something else. There are some objects for which I have to use this method as there's other option available for custom angular tables. 

 

My TC version: 14.30.3743.7 x64

Chrome version: 80.0.3987.100 (Official Build) (32-bit)

 

Code inside the methods looks like this, but It's just not able to locate the object on the page at all.

 

  // Call the function
  let obj = page.FindChildByXPath("//button[@type='submit']", true);
  // Check the result
  if (!strictEqual(obj, null))
  {
    // If the element was found, click it
    obj.Click();
  }

Any help would be appreciated!

 

Thank you

Al2

 

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'm guessing that the reason for the slowness is the "not found" aspect.  There's atimeout for searching for objects and you may be hitting that time out.  If the code snippet you posted is not returning an object, than it's entirely the case that the XPath may have changed. You might need to rework that code.  I'm guessing that the problem is in Chrome or how Chrom is rendering the web page, not necessarily in TestComplete.

    • Al2's avatar
      Al2
      Occasional Contributor

      tristaanogre  Yes..Object search timed out (in 20 seconds), and returning 'undefined' object. I've checked the xpath which seems to be absolutely correct. I can't think of any other reason why this is behaving like that.

       

      Thank you

      Al2

      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Thank you tristaanogre for your help.

         

        Hi Al2! It looks like you've managed to identify the probable cause of the slowness together with tristanogre here. Were you able to find a way to make it work faster? Please let us know you need more advice from the Community regarding this situation.