I'm trying to script a 3rd party website. The first page is a login page.
When submit is clicked, the login page is closed and and a new IE window is opened to handle subsequent requests. I believe this is handled by server-side ASP.NET code. Meanwhile MacroScheduler is trying to handle the login page closure, a windows warning dialog box stating the webpage is closing a window, and a new IE window.
I used WebRecorder to record the script below. I had to add code to handle the windows warning dialog box appearing in IE7: it didn't show up in WebRecorder.
The script appears to stop processing when trying to communicate with the new IE window. According to the debugger, the script is still running.
When I click stop, Macroscheduler crashes.
I'm trying to stay within the confines of using IEAuto.DLL as I want to capture and process the content from a subsequent web page, and then navigate to new pages in the context of the current authenticated user.
Thanks in advance for any pointers. Sorry if this sounds like mush. I've been working on this just over two days solid and not getting very far.
Code: Select all
// Generated by MacroScript WebRecorder 1.71
// Recorded on Thursday, November 23, 2006, at 02:45 PM
LibLoad>IEAuto.dll,hIE
If>hIE=0
MessageModal>Could not load IEAuto.dll, make sure it is in the path or edit the LibLoad line.
Goto>end_script
EndIf
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1
LibFunc>hIE,CreateIE,IE[0],0
LibFunc>hIE,Navigate,r,%IE[0]%,http://www.xxxxxxxx/
LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay
Let>FrameName={""}
Let>FormName={"frmLogin"}
Let>FieldName={"txtUsername"}
Let>FieldValue={"optimus"}
LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0
Let>FrameName={""}
Let>FormName={"frmLogin"}
Let>FieldName={"txtPassword"}
Let>FieldValue={"xxxxxx"}
// changed by me
// call submit directly, do not use click(btnLogin)
//LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0
LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,submit
// commented out by me
//Let>FrameName={""}
//Let>FormName={"frmLogin"}
//Let>TagValue={"btnLogin"}
//LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
// start of problem area ??
// added by me
// required to close windows security dialog
WaitWindowOpen>Windows Internet Explorer
Wait>delay
SetFocus>Windows Internet Explorer
Wait>delay
Press ENTER
LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay
libFunc>hIE,WaitNewIE,IE[1],0
libFunc>hIE,WaitIE,r,%IE[1]%
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
// end of problem area ??
// code below doesn't appear to happen
Let>FrameName={""}
Let>FormName={"frmSupplierAlertList"}
Let>TagValue={"btnContinue"}
LibFunc>hIE,ClickTag,r,%IE[1]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
Let>FrameName={""}
Let>FormName={"Form1"}
Let>TagValue={"btnContinue"}
LibFunc>hIE,ClickTag,r,%IE[1]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
Let>FrameName={""}
Let>FormName={"Form1"}
Let>TagValue={"91383.1"}
LibFunc>hIE,ClickTag,r,%IE[1]%,str:FrameName,str:FormName,A,TEXT,str:TagValue
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
Let>FrameName={""}
Let>FormName={"frmSupplierQuotation"}
Let>TagValue={"btnPrint"}
LibFunc>hIE,ClickTag,r,%IE[1]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
WaitWindowOpen>Print
SetFocus>Print
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
WaitWindowOpen>Print
SetFocus>Print
Let>FrameName={""}
Let>FormName={"frmSupplierQuotation"}
Let>TagValue={"Back"}
LibFunc>hIE,ClickTag,r,%IE[1]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFunc>hIE,WaitIE,r,%IE[1]%
Wait>delay
LibFree>hIE
Label>end_script