Forum Discussion
Hi,
Looks nice. Did you face any problem running your code?
While finding elements by XPath is relatively slow method, you can also try FindAll () method >>
- nitinn7 years agoOccasional Contributor
I couldn't count the no. of elements. The For loop isn't navigating.Can you find any error in the code?
- baxatob7 years agoCommunity Hero
Are you sure that xpath is correct?
Check the size of array using Log.Message(arr.length);
- baxatob7 years agoCommunity Hero
Also be careful with strictEqual() function:
let arr = new Array(); strictEqual(arr, null)); // returns false strictEqual(arr.length, 0)); // returns true
- nitinn7 years agoOccasional Contributor
It is working for the first time.Post that its failing.
My guess is its not looping correctly.I used arr.length & its correctly returning me 4 rows for the table.
The error is below:
Unable to obtain the item's rectangle.
- AlexKaras7 years agoChampion Level 3
Hi,
While it is not clear what happens in your application after the first click, the most probable guess is that the following sequence occurs:
-- Link is clicked;
-- Application navigates to somewhere *and the initial table is no more present on the screen*;
-- Back button/link is clicked;
-- Application navigates back to the initial page *and the table is recreated a-new*
If my guess is correct, then all found references to table cells will be invalidated after navigating away from the initial page and you *must* search for them again after you back to the page with the table. Then you should be able to click the second cell and so on.
P.S. And yes, as it already has been said, search by XPath is the worst approach in TestComplete. (Especially, when searching through the whole page, like a lot of people used to do. Or, maybe, because of some Selenium specifics?)
P.P.S. Use of Aliases might solve the problem with recreated page elements, but this will work only if the given element has its Alias in NameMapping which is not a case with tables (due to how tables are usually designed nowadays).
Related Content
- 12 months ago
- 9 years ago