Ask a Question

TestComplete QuerySelectorAll do not return Array (TC 14.80)

SOLVED
NicolasD
New Contributor

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) :

NicolasD_0-1628861830553.png

It returns me the expected object :

NicolasD_2-1628861988812.png

NicolasD_3-1628862025262.png

 

 

 

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

NicolasD_1-1628861958595.png

NicolasD_4-1628862109596.png

 

 

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

NicolasD_8-1628862362907.png

NicolasD_9-1628862375155.png

 

Reading rows :

NicolasD_1-1628863117082.png

 

 

 

Conclusion :

 

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

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

 

NicolasD_7-1628862326136.png

 

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/findi...)

 

NicolasD_0-1628862805686.png

 

 

 

 

How I suppose to handle my result ?

 

Thanks a lot for any help.

 

Kindly Regards,

Nicolas D.

 

 

 

 

 

 

 

 

2 REPLIES 2
hkim5
Staff

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.

Best,
Justin Kim
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().

 

NicolasD_0-1628865776494.png

 

Thanks a lot for the Workaround.

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

 

Kindly Regards,

Nicolas.

 

cancel
Showing results for 
Search instead for 
Did you mean: