Forum Discussion
sbkeenan
10 years agoFrequent Contributor
Hi
I've had a look at the SmartBear web page you referred to and created the script below as an example of how to store the text from the bulleted items on the left-hands side of the page. Please forgive the long line of code where I've created a new Enumerator - I didn't want to start mapping items, etc. to make this shorter, but you can do this for your own script.
function myFunction()
{
//I am using an array to store the bulleted text items.
//This will allow for different numbers of items on each run.
var itemsEnum = new Enumerator(Aliases.browser.Page("http://smartbear.com/product/testcomplete/overview/").Form("form").Panel("container").Panel("main").Panel("content").Panel(0).Panel(2).Panel(0).Panel(0).Panel(0).Panel(0).TextNode(2));
var item; //a reference to each item in the Enum
var arrItems = []; //array to hold the ContentText property value of each item.
//populate the array
while (! itemsEnum.atEnd())
{
item = itemsEnum.item();
arrItems[arrItems.length] = item.contentText;
itemsEnum.moveNext();
}
//output the array contents
for (var i = 0; i < arrItems.length; i++)
{
Log.message(arrItems[i]);
}
}
Hope this is helpful.
Regards
Stephen.
Related Content
- 10 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago