state of object changing after click action
I am trying to automate a test case for web testing in Test Complete where i have to click on a series of tabs and read the data from the grid(for each tab)
I am initially creating the tab object and getting the count of tab's to loop through as follows:-
var view = Aliases.browser.pageAfsDataDiscovery.formForm1.Panel(2).Panel(1).Table("dxsplitter1").Cell(2, 0).Panel("dxsplitter1_1_CC").Panel(0).Panel(0).Panel("tabView");
var view_cnt = view.getElementsByClassName("dxtc-link").length;
I am later trying to loop through the count of views(tabs) and click on the tab and then read the tab name as follows:-
for(i=0;i< view_cnt; i++)
var view_name = view.getElementsByClassName("dxtc-link");
var view_id = view_name_temp.item(i).id;
var vw_cmd = 'Sys.Browser("iexplore").Page("https://testwebsite.aspx").Form("form1").FindChild("Name",\'Link("' + view_id + '")\',99).Click()' --- Click n the tab
var vw_name = view_name.Item(i).innerText; -- Get the display name of the tab
The issue i am facing is once i click the view(tab) and then use the object var view_name to get the display name of the tab it is returning a NULL value.This is because after the click on the tab (to select the tab) the state of the
object variables view and view_name which were created earlier changes(a lot of attributes and properies no longer exists or becomes NULL)
I am not sure why the state of objects are changing after the click.Just for argument sake if you consider the first tab i was already on the first tab by default when i stored the values of view and view_cnt initially and i am again just clicking on the
first tab for i=0 in the loop,so nothing really changed in the UI
Is there any way to resolve this issue?Any pointers appreciated?
"I am not sure why the state of objects are changing after the click"
I presume when you click into a tab, it becomes the active tab. And the first (default) tab becomes inactive. Or if no tab was selected, then none are currently active, until you click on one to activate it.
ie. the state of (some of) the tabs has changed.
In which case, the state of the top level object in each case (the tab) has changed. Therefore your original object references are now stale and you need to refresh them. If they are mapped objects, you could try refreshing them. But I suspect they're not mapped. In which case, you probably need to re-scan for tabs each time you move around within them.