Posts: 18
Threads: 4
Joined: Oct 2010
Reputation:
0
10-20-2010, 07:09 PM
Hi,
I am very new to QTP and VB scripting. I have recorded a test that is to open an Oracle window. Sometimes the Oracle window opens and sometimes it does not. I was advised to "put an if then else statement to wait for the window. If the window does not appear you can have it run a recovery scenario which you can set to close all the windows and restart the script." I am not sure what I need to do to accomplish what is written above. Can anyone help???
Thanks!
Posts: 99
Threads: 0
Joined: Oct 2010
Reputation:
0
10-21-2010, 10:31 AM
Hi
If (Window().Exists(2)) Then
' Do all required actions
' Exists(2) -> here 2 is to make your script wait for 2 second, use as per your requirement
else
Exit Test
End If
Posts: 18
Threads: 4
Joined: Oct 2010
Reputation:
0
10-25-2010, 07:40 PM
I added the below code around my code and I get an error message:
Run Error
The test run cannot continue due to a syntax error.
Invalid 'exit' statement
Line(1): "Exit Test".
I am not sure why it is saying line 1, the if then statement is on the 3rd line. Then I have all of my if it opens then do all of this code, then on at the bottom of my code I have:
else
Exit Test
end if
on lines 60 - 62
Any ideas?????
Posts: 50
Threads: 0
Joined: Jul 2009
Reputation:
0
10-26-2010, 10:17 AM
Hi Marie,
The syntax is "ExitTest" not "Exit test". There is no space.
Try this , it should work.
- Vinod
Posts: 18
Threads: 4
Joined: Oct 2010
Reputation:
0
10-26-2010, 05:49 PM
Thank you, this part now seems to be working great!
My only problem now is the fact that I am exiting the test instead of restarting it. Other tests are based on this one running, so if it doesnt open the window the first time I need it to go back and try again until the window opens and the rest of the test can finish. Is there a restart instead of an exit??
Posts: 18
Threads: 4
Joined: Oct 2010
Reputation:
0
10-26-2010, 08:25 PM
(This post was last modified: 10-26-2010, 08:33 PM by Marie.)
Vinrod,
do I call this script from within the script I already have? I am a little confused by the ExitTest, wont that kick me out of the test instead of running the rest of what I have?
Thanks!
-------------------------------------------------------------------------------------------------------------------
I am guessing I did this wrong based on the fact that I now crash my script by adding the new script into the working one.