Forum Discussion
I found "<a title="" class="jstree-anchor jstree-clicked" href="#"><i class="jstree-icon jstree-themeicon jstree-themeicon-custom" style='background-position: center; background-image: url("/Images/treeView/icon_book_black.png"); background-size: auto;'></i>course1</a>" object
But it says it doesn't support this method..
Hi,
How did you search for the object?
Can you provide us with your actual code, exact line of error and the error text iteself?
- Veroniquelu10 years agoContributor
I think I figured out what went wrong, when trying to find the object by the first method, along with all these parent/sibling, the object becomes a non-testcomplete object, that's why it's not supported, so I've changed my code by using xpath to find it correclty, it works like a charm.. Thank you very much, Both of you :D
- AlexKaras10 years agoChampion Level 3
Hi,
Great to hear that the problem is solved.
And yes, your conclusion is absolutely correct and this was the reason for my first question about how the problematic object was obtained.
TestComplete can access application's objects and their internal methods. Also, for the objects that are found and referenced by the means of TestComplete, TestComplete 'wraps' them with its own wrappers that provide access to the additional methods provided by TestComplete.
If you are calling native method of some object and this method returns another object, then, obviously, this returned object will not be wrapped by TestComplete (because it was obtained not by its means) and thus will not contain methods provided by TestComplete.
So, in your code:
var ItemText = webPageObj.EvaluateXPath("//li[@id='"+ItemID+"']");
ItemText = (new VBArray(ItemText)).toArray();
var ItemRow = ItemText[0].firstChild;
var PlusIcon = ItemRow.nextSibling;
var ItemName = PlusIcon.nextSibling;
ItemText is an object obtained via TestComplete means and thus contains the .Drag method.
ItemRow and all other objects are obtained via the call to the native XPath functions, not wrapped by TestComplete and thus do not contain the .Drag method.
- Veroniquelu10 years agoContributor
Thank you Again
- Veroniquelu10 years agoContributor
1:
var ItemText = webPageObj.EvaluateXPath("//li[@id='"+ItemID+"']");
ItemText = (new VBArray(ItemText)).toArray();
var ItemRow = ItemText[0].firstChild;
var PlusIcon = ItemRow.nextSibling;
var ItemName = PlusIcon.nextSibling;
return { ItemText:ItemText[0], ItemName: ItemName, ItemRow: ItemRow, PlusIcon: PlusIcon };
2. var DraggedObject = DraggedParentT.NativeWebObject.Find("contentText","course1");
ItemName is the Object I was using, but when I used Find method to get the same object, it seems to be working, it looks like Objects returned by EvaluateXpath and Find are slightly different. I compared the two objects, they are almost the same , except that there seems to be more stuff in the object found by Find method. I can not use find in this case, because the contentText is allowed to be identical on the page.
Related Content
- 6 years ago
- 3 months ago
- 3 years ago
- 2 years ago
Recent Discussions
- 4 days ago
- 4 days ago
- 7 days ago