How to error trap a web log in

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
walterwt
Newbie
Posts: 3
Joined: Thu Jan 15, 2004 4:04 pm
Location: Edmonton, AB, Canada
Contact:

How to error trap a web log in

Post by walterwt » Thu Jan 15, 2004 4:10 pm

I have a script for logging into a web site at a specific time, clicking on a button to generate a report then saving that report. Most times it works flawlessly. However, recently it has been messing up on the login screen. Is it possible to detect when the wrong page loads so the script can restart? Also, checking the logs this morning (didn't realize till just now it was turned on) it appears that when the script fails, that the script is running TWICE at the same time. Any help would be appreciated.

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

I'll bite

Post by mightycpa » Sun Jan 18, 2004 3:41 am

What does the error look like? My guess is you can save the HTML returned and look for some key words like:

Try Again
Invalid Password
Not Authorized
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

walterwt
Newbie
Posts: 3
Joined: Thu Jan 15, 2004 4:04 pm
Location: Edmonton, AB, Canada
Contact:

Post by walterwt » Mon Jan 19, 2004 12:21 am

I think I've found a crude solution. The process is I log into the web site, navigate to the appropiate report, generate it, save the web page then copy it to a final directory and date the file name. Occasionally (and usually only when unattended) the login fails or takes too long. What I've done is checked to see if the appropiate file has been created. If so, I delete the temp htm file and exit. If it doesn't exist, then I branch back and repeat the process.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Jan 19, 2004 9:05 am

Hi,

You can probably do all of this in one go using the HTTPRequest command. Use a POST operation to log in and another to send the data to generate the report. The report is then saved to disk. No need to simulate user activity and navigate around the web browser. Any errors can be trapped using the response code from the HTTPRequest command. The whole thing will become much more reliable.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts