Forum Discussion
Hi,
Basically, you want check whether an object displayed in the screen or not. This doesn't require any API if you are using Test Complete.
you can use like below,
function testSample() { if(Sys.Process("notepad").Exists) { Log.Message("Object exists in the screen"); } else { Log.Error("Object not exists"); } }
To verify the object property you can use https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqobject/checkproperty.html
Also, take a Test Complete 101 training or see the existing video here for better understanding of Test Complete.
- Bobik7 years agoFrequent Contributor
Correct code:
function testSample() { if(Sys.WaitProcess("notepad").Exists) { Log.Message("Object exists"); } else { Log.Error("Object not exists"); } }
Call Sys.Process("notepad") will cause an error when object doesn't exist. And script will fail before your "Else" block. So you have to use "WaitProcess" method.
- shankar_r7 years agoCommunity Hero
Bobik I agree, else block will not run if Stop On Error is checked but it will run when Stop On Error is unchecked. :)
- LupitaM6 years agoNew Member
I am trying to verify the date object exists on a window. I am using the following and getting that the object is not found. Do I need to use the WaitProcess?
if (Sys.WaitProcess("DateEdit").Exists)
{
Log.Message("Date Range is present");
}
else
{
Log.Error("Date Range is not present");
}
Related Content
- 11 months agoIrinaManea
- 2 months agoStoplight
- 6 months agonado
- 2 months agoStoplight
- 3 years agogeneticmaterial
Recent Discussions
- 57 minutes agosimonaferrara
- 2 hours agoAli2