Forum Discussion
JavierCollRodri
12 years agoContributor
Hello ram,
I created a example file with your html code, and used Script Recorder (a functionality from TestComplete, it's a red dot in TestComplete toolbar)
That's the code Test Complete has generated, with my own changes:
function Test1()
{
Browsers.Item(btFirefox).Navigate("file:///C:/Users/jcoll/Desktop/example.html");
var browser = Aliases.FFProcess;
var page = browser.pageFileCUsersJcollDesktopExampl;
var panel = page.panelFirstdiv;
// panel.link1.Click();
...
}
For now, you have the var 'panel', which is the firstDiv panel. It has used NameMapping to store the object.
Now, you only have to search for the links:
function Test1()
{
...
var prop = new Array("ObjectType");
var val = new Array("Link");
var cProp = ConvertJScriptArray(prop);
var cVal = ConvertJScriptArray(val);
var links = panel.FindAllChildren(cProp, cVal);
Log.Message(links.length > 0)
}
And that's it, more or less. To know how ConvertJScriptArray works, check CreateVariantArray Method in Smartbear Support page.
I encourage you to try to develop your own code next time!
I created a example file with your html code, and used Script Recorder (a functionality from TestComplete, it's a red dot in TestComplete toolbar)
That's the code Test Complete has generated, with my own changes:
function Test1()
{
Browsers.Item(btFirefox).Navigate("file:///C:/Users/jcoll/Desktop/example.html");
var browser = Aliases.FFProcess;
var page = browser.pageFileCUsersJcollDesktopExampl;
var panel = page.panelFirstdiv;
// panel.link1.Click();
...
}
For now, you have the var 'panel', which is the firstDiv panel. It has used NameMapping to store the object.
Now, you only have to search for the links:
function Test1()
{
...
var prop = new Array("ObjectType");
var val = new Array("Link");
var cProp = ConvertJScriptArray(prop);
var cVal = ConvertJScriptArray(val);
var links = panel.FindAllChildren(cProp, cVal);
Log.Message(links.length > 0)
}
And that's it, more or less. To know how ConvertJScriptArray works, check CreateVariantArray Method in Smartbear Support page.
I encourage you to try to develop your own code next time!
Related Content
- 5 years ago
Recent Discussions
Working with Visual Test
Solved2 days agoBypassing TC engine
Solved2 days ago