Ask a Question

Find method vs QuerySelector: Unmatched performance

0 Kudos

Find method vs QuerySelector: Unmatched performance

Hello Team, I wanted to point out a severe flaw in the performance of the Find method provided by the tool, compared to the QuerySelector (also provided by the tool). 

When working with web applications, especially those developed in Angular or React, where there are a huge amount of web elements, I noticed that using the Find method can take up to 25 seconds to find, for example, a checkbox inside a pop-up, compared to the 0.21 seconds it takes when using the QuerySelector method (both executed from the main process, which in my case is the browser's web page).

It might be useful if you implement a way to improve the performance of the Find method by internally switching to the QuerySelector when we use common identifiers (like idStr or className).

 

Thanks.

1 Comment
8Kit
Frequent Contributor

You could try using the FindChild or FindElement methods for much faster results as this will distill the results TC has to search for. The difference between them is that FindChild and FindElement only searches in child objects, while Find also searches in the testedObj object.

 

Not sure how your front end is written but my guess is the pop-up may be treated as a separate window or page, meaning TC will by default search through all of the elements/objects in the main page first before searching the pop-up. I wouldn't necessarily call this a flaw since it's probably working as expected, you just need to use a different method of approach. 

 

[TestComplete reference] 

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Welcome to the Community
Sign Up Here