aqObject.CheckProperty- (checkpoint on Content text) Control does not go to else condition
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
aqObject.CheckProperty- (checkpoint on Content text) Control does not go to else condition
Hi,
Is there anything wrong with below code? Control is not going to Else conditon even if the If condition is not true. It just evalutes If condition and throws an error.
Note: Object properties for both are same only the "content text" differs.
if((aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4, "contentText", cmpEqual, "Order accepted"))==true){
Log.Message("Order Accepted")
}
else{
if(aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4, "contentText", cmpEqual, "A pending order already exists.")==true){
//Code goes here
}
}
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your input :-)I tried comparing directly as you mentioned in the example. nothing seemed to work. I used switch case too.
It just skipped the if statement during execution
I am new to TestComplete, Below options I tried before posting my question here.
I will try the CompareProperty option and update you
//Option 1 (Checkpoint evailated to False error)
if((aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4, "contentText", cmpEqual, "Order accepted", false))==true){
Log.Message("Order Accepted")
}
else{
if(aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4.textnodeLabelLabelDangerSubtleSt, "contentText", cmpEqual, "A pending order already exists.", false)==true){
//Code
// }
//}
var clmnStatus = Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4.textnodeLabelLabelDangerSubtleSt
var fileStatus = clmnStatus.textContent
Log.Message("Status: " +fileStatus )
//Option 2
if((clmnStatus.Exists)&&(fileStatus=="Order accepted")){
aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4.textnodeLabelLabelDangerSubtleSt, "contentText", cmpEqual, "Order accepted")
//code
}
else{
//code
}
//Option 3 (Skipped swicth statement (Nothing inside Switch statement got executed))
switch(fileStatus)
{
case "Order accepted":
Log.Message("Order Accepted");
break;
case "A pending order already exists.":
//Code
break;
}
//Option 4 (Skipped the If/else staement during execution)
if(fileStatus = "Order accepted"){
aqObject.CheckProperty(Aliases.browser2.pageFos2.formPlaceorder.tableOrderlist.cellColumn4, "contentText", cmpEqual, "Order accepted")
Log.Message("Order Accepted")
}
else{
if(fileStatus="A pending order already exists."){
//code
}
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it's skipping the IF statement, then there is something else going on. I suspect object identification issues still.
Can you get screenshots of the various objects in that Alias tree, how you have them mapped, and how they show up in the Object Browser with all properties visible? We're missing something somewhere.
Are you getting an error message in the log?
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »