Jump to content
Sign in to follow this  
New2Automation

Exceptional handling and time delay

Recommended Posts

New2Automation

I faced a problem while executing a recorded script.

In our application, we have a check box.

Upon enabling check box, two text fields are enabled to key in some data and a submit button to go to next screen.

Before recording, I had enabled check box and started recording.

Once recording was completed, before starting to run the script, I forgot to enable check box.

The script just started working.......It selected the text box (even though it was greyed out), typed the text (since the text box was greyed out, I could not see any data typed). and the mouse went to the submit button and just paused there.

It waited until I did the above steps manually.

Once I pressed the submit button, it started proceeding further.

Is this the limitation of tool or do we have something like exception handling and can we control this delay time.

One more point I want to add is our application is developed using WxWidgets objects and coded using VC++.

Share this post


Link to post
Share on other sites
Uten

You normally have to use the recorded script as a template and modify it to your needs.

In this case I would guess that the wrong control had focus when you engaged your script. Compared to the situation you recorded it under.

My solution would be to rewrite the script (or parts of it) to use ControlSend. Using ControlFocus at the top of your script could also be a solution.

EDIT: Minor stuff.

PS: Welcome to the forum..:shocked:

Edited by Uten

Share this post


Link to post
Share on other sites
New2Automation

Thanks for your help. Its working fine. But one thing I have a doubt is for a group of code lines, can we have an exception handling. If so can you give me a sample code wherein you are doing the same.

Lets say I am executing a case with 20 lines of code. I want to handle exception for 10 continuous lines. How to go about it?

Share this post


Link to post
Share on other sites
New2Automation

I have the following lines of code.

MouseClick("right",326,642) //right click mouse at some position

send("i") //by sending i, we are selecting import job menu option

If Not WinActive("Import Job") Then

WinActivate("Import Job")

EndIf

Sleep(1000)

ControlCommand("Import Job","","Edit1","EditPaste",'E:\Jpegs\Winter.jpg')

Sleep(1500)

Send("{Enter}")

Say I changed the mouse click position i.e., X,Y co-ordinates such that popup window doesnot appear. In that case the application waits infinitely until it comes across the window. Once we select import job menu by clicking the mouse at correct position, the script continues to execute. Can any one of you help me in handling this exception. It should give me fail immediately rather than waiting for a long time.

Also if we are running a batch file wherein we are executing multiple test cases at a time (say 5 testcases) and at the 3rd test case we have the above scenario. It should give me fail and continue with next test case.

Please help me in solving the above two scenarios.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.