Forum Discussion

adrian_g's avatar
adrian_g
Occasional Contributor
14 years ago

TestComplete's .Exists Function

Hi Guys,


I am used to Quick Test Pro so I am sometimes lost as to what to do in TestComplete.


I am familiar with doing the following:


If WebpageObject.exists Then

‘do something

Else

‘do something else

End If


QTP simply runs through this and if the object is not there it simply moves on to the else statement without pausing or logging an error.


The problem with TestComplete is that when the .Exists part fails, it logs and error to the log and in my case it pauses test execution (because I have “Pause test execution on posting an error” ticked).


I don’t want it to pause because it almost defeats the point of automation in that someone has to keep monitoring the script to see what is happening with it. I don’t want to remove the tick in “Pause test execution on posting an error” because instances where something fails badly the scripts keeps executing nonstop which is silly if the first screen returns a server error and keeps executing through many screens that aren’t there.


What solutions do I have with TestComplete to check if an object exists without pausing the script. This applies to web page objects and desktop applications e.g. .Net


Thanks,

Adrian

14 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm not entirely sure I understand your question...  if you have access to the script code itself where you can view the recorded scripts, you have the necessary access to add the conditional code.



    Now, if you are talking about using Keyword tests and not manually written code, that's a different story.  Please clarify and I'm sure I can get you an answer.
  • I would really like to know the answer to how to accomplish this with a Keyword test.  In my test, if I try to enter a name which has the last name of an already existing name, a popup appears asking if I want to continue.  How do I use the keyword test so if this window appears, TestComplete clicks the continue button and then continues the code?