Ask a Question

FindChildByXpath method is very very slow all of sudden

Al2
Occasional Contributor

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 6
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
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
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.

 


Sonya Mihaljova
Community and Education Specialist

Al2
Occasional Contributor

@sonya_m  Not yet. I had  to debug the same program which had been working consistently well for last 3 years.

The xpath is available on the page but the FindChildByXpath keeps returning 'null'. I see that I have a little scope for experimenting because TC would work better with it's native functions. There's a reason why I wanted to use xpath here because TC name mappings doesn't work in every situation esp. angualr custom controls.

 

 

Thank you

Al2

sonya_m
SmartBear Alumni (Retired)

@Al2 Thank you for the update. Keep us posted and do not to hesitate to look for more assistance here!


Sonya Mihaljova
Community and Education Specialist

sonya_m
SmartBear Alumni (Retired)

Hi @Al2 , any updates? This is highly appreciatedSmiley Happy


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: