TCYKPB's avatar
TCYKPB
Contributor
3 years ago
Status:
New Idea

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.

  • Kitt's avatar
    Kitt
    Regular 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]