How do I force a list item collection to update
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010
12:45 PM
04-28-2010
12:45 PM
How do I force a list item collection to update
Hi,
I'm trying to check a list item for a state change. The item has parameters therefore waitproperty will not work, so I am using a while loop to check that the item state has changed.
However, testcomplete appears to cache the list object and is not detecting that the program has changed the property.
object.refresh(); is throwing an exception, and refreshing the parent list object is not updating the children. Am I missing something here?
function checkDraft()
{
var lst = Aliases["enDesign"]["MainForm"]["ToolStripContainer1"]["ToolStripContentPanel"]["DockPanel1"]["DockWindow"]["DockPane"]["PCList"]["SplitContainer1"]["SplitterPanel"]["fstLstPC"];
var lstItem = lst.Items["Item"](0)["RowObject"];
var StopWatchObj = HISUtils["StopWatch"];
StopWatchObj["Start"]();
while (StopWatchObj["Split"]() < 30000) {
if (lstItem["ReferenceLink"]["OleValue"] != '') {
KeywordTests["Test1"]["Variables"]["CheckDraft"] = true;
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
return;
}
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
lst.refresh(); // lst object is not refreshing
delay(500);
}
StopWatchObj["Stop"]();
KeywordTests["Test1"]["Variables"]["CheckDraft"] = false;
return;
}
I'm trying to check a list item for a state change. The item has parameters therefore waitproperty will not work, so I am using a while loop to check that the item state has changed.
However, testcomplete appears to cache the list object and is not detecting that the program has changed the property.
object.refresh(); is throwing an exception, and refreshing the parent list object is not updating the children. Am I missing something here?
function checkDraft()
{
var lst = Aliases["enDesign"]["MainForm"]["ToolStripContainer1"]["ToolStripContentPanel"]["DockPanel1"]["DockWindow"]["DockPane"]["PCList"]["SplitContainer1"]["SplitterPanel"]["fstLstPC"];
var lstItem = lst.Items["Item"](0)["RowObject"];
var StopWatchObj = HISUtils["StopWatch"];
StopWatchObj["Start"]();
while (StopWatchObj["Split"]() < 30000) {
if (lstItem["ReferenceLink"]["OleValue"] != '') {
KeywordTests["Test1"]["Variables"]["CheckDraft"] = true;
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
return;
}
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
lst.refresh(); // lst object is not refreshing
delay(500);
}
StopWatchObj["Stop"]();
KeywordTests["Test1"]["Variables"]["CheckDraft"] = false;
return;
}
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010
02:09 PM
04-28-2010
02:09 PM
What are the details of the exception? Are you sure that your lst variable is valid? Your example code doesn't show any check on the Exists property, and if it doesn't exist then that would explain the exception.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010
04:37 PM
04-29-2010
04:37 PM
The item "exists" as its always visible on the form. I'm doing most of the interaction with keyword tests.....
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010
08:30 PM
04-29-2010
08:30 PM
Hi,
You should refresh the target object (call its Refresh method) before accessing its properties.
You should refresh the target object (call its Refresh method) before accessing its properties.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
