Forum Discussion

NicolasD's avatar
NicolasD
New Contributor
3 years ago
Solved

TestComplete QuerySelectorAll do not return Array (TC 14.80)

Hello all,

 

I'm trying to works with querySelectorAll, but TestComplete only returns me the length of the result, not the Array.

I tried with TC version QuerySelectorAll and native one querySelectorAll and I have the same result :

 

1. First I select the object using NameMapping (via Aliases) :

It returns me the expected object :

 

 

 

2. From the object, I get a HTML table (querySelector works as Expected)

 

 

3. For querySelector / QuerySelector on my retrieved table. I get ONLY the length which is prooving it must be able to retrieve my rows :

 

Reading rows :

 

 

 

Conclusion :

 

From "rows", i'm not able to handled returned rows.

According to the Documentation (for appropriate Version) I have to get an Array :

 

 

The example available here confirm that I have to get an Array : (https://support.smartbear.com/testcomplete/docs/ver-14-80/app-testing/web/general/common-tasks/finding-objects/css-selectors.html)

 

 

 

 

 

How I suppose to handle my result ?

 

Thanks a lot for any help.

 

Kindly Regards,

Nicolas D.

 

 

 

 

 

 

 

 

  • Hello Justin Kim,

     

    To answer to your question, indead I can not call any DOM Attributes, because rowsTC[i] and rowsNative[i] in loop returns undefined.

    I tried to use FindElements.

    The result is better and as expected.

    Netherless, it seems FindElements() is not available on retrieve DOM element next to querySelector().

     

     

    Thanks a lot for the Workaround.

    I Hope I will be to solve/understand what is happen.

     

    Kindly Regards,

    Nicolas.

     

2 Replies

  • thats odd.

    from what it looks like the returned arrays of rowsTC and rowsNative do return arrays (both with length 3) ,

    but each of the array items that yorue calling tr is not returning any values for its attributes? (im guessing that the commented line of log message for the tr.innterHTML doesnt work?)

    are there any other attributes that you could try to print out?

     

    otherwise, instead of queryselectorALL, you could try to use FindElements() instead (same syntax) and that should also return the same array.

    • NicolasD's avatar
      NicolasD
      New Contributor

      Hello Justin Kim,

       

      To answer to your question, indead I can not call any DOM Attributes, because rowsTC[i] and rowsNative[i] in loop returns undefined.

      I tried to use FindElements.

      The result is better and as expected.

      Netherless, it seems FindElements() is not available on retrieve DOM element next to querySelector().

       

       

      Thanks a lot for the Workaround.

      I Hope I will be to solve/understand what is happen.

       

      Kindly Regards,

      Nicolas.