Forum Discussion
Hi All,
Thank you for the feedback.This is not working for me,when i used the FindChildByXPath,it is only return the first element,when it should return 5 elements with the below code.
var containerEle;
var ele = "//div[@class='something']/h3";
var elepath= ObjectConverted(ele);
containerEle = page.FindChildByXPath(tablexPath).innerText;
for(i=0; i<=containerEle.length;i++){
Log.MessagecontainerEle [i]);
}
Error seen(Wrong number of arguments or invalid property assignment 12:06:36 Normal Error) with FindAllChildren with the below code:
var containerEle;
var ele = "//div[@class='something']/h3";
var elepath= ObjectConverted(ele);
containerEle = pageFindAllChildren(tablexPath).innerText;
for(i=0; i<=containerEle.length;i++){
Log.MessagecontainerEle [i]);
}
Could you please provide code to make this action funtioned,this is very easy to do with Selenium.Can someone from SmartBear TestComplete help in this situation
Hi,
Unlike Selenium;), TestComplete provides really useful and descriptive documentation with a lot of code samples. So it's definitely worth reading.
Your code is incorrect almost everywhere :)
FindChildByXPath returns first found element, thus it is not possible to iterate through them. EvaluateXPath() returns an array of found elements and it is possible to iterate through the returned array.
FindAllChildren() returns an array and thus it does not contain .innerText property. Also, FindAllChildren() expects not XPath but a different set of parameters.
Final note: while it is possible to search elements in TestComplete via XPath and this may be more convenient for you after Selenium, more effective approach in TestComplete's world is to use Aliases, FindChild() and FindAllChildren() methods. I would recommend you to read about them in the help.