How to error trap a web log in
Moderators: Dorian (MJT support), JRL
How to error trap a web log in
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.
I'll bite
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
Try Again
Invalid Password
Not Authorized
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
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.
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.
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]
[email protected]