Vakari Posted August 10, 2009 Share Posted August 10, 2009 (edited) I have a script that completes a form on a website then submits it to create a report. When the form has no errors the site displays a message box saying "Your report has been submitted successfully" and provides an "Ok" button to click. When the form contains errors and needs to be fixed before being re-submitted, there is an error message on the webpage that shows "Your request contains errors." This script was compiled and has been in use for about a year now without issue. A couple weeks ago some of its users began to get crashes during this phase of the script. I absolutely cannot reproduce this error unless the script is compiled. Below is the code that has been in use for the past year. While Not WinExists("Microsoft Internet Explorer", "Your report has been submitted successfully") ; While waiting for the report to succeed, ; What are the odds of the message box appearing at this point in the script? If StringInStr($oIE.document.body.innerHTML, "Your request contains errors.") > 0 Then ; If the form contains errors, MsgBox(262160, "Warning", "Request contains errors." & @CR & @CR & "Please correct manually and re-submit.", 5) If IsObj($oIE) Then $oIE.Visible = True $oIE = "" EndIf Return EndIf Sleep(100) Wend ControlClick("Microsoft Internet Explorer", "Your report has been submitted successfully", "Button1") It is at this point of the program where the user will get the 'Line -1: Error: Variable must be of type "Object"' crash Now the users CAN get the AutoIt error message box after a report completes successfully. I would guess it has a 50% chance of happening each time. I can only imagine that immediately after the While Not WinExists() returns True, the report successful message box comes up and the $oIE.document.body.innerHTML cannot be performed while the message box is open. I replaced _IEBodyReadHTML() with $oIE.document.body.innerHTML to make sure it wasn't IE.au3 that was causing the issue. I also tried the following with no luck. If (Not WinExists("Microsoft Internet Explorer", "Your report has been submitted successfully")) And StringInStr($oIE.document.body.innerHTML, "Your request contains errors.") > 0 Then Is there any code I can use that can read the webpage while the message box is visible? Thank you for your time. Edited August 10, 2009 by Vakari Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now