Hi,
I am trying to search a website automatically. After I put a query in the search box, I used clicktag to hit search button, I may get a microsoft internet window pop up if my query is invalid. I can also get a new page with the contents which I want to print if my query is valid.
I am not sure where I should put WaitWindowOpen > Microsoft Internet Explorer line in my scripts, since I dont' know if it is going to pop up or not before I hit search.
Here is part of my code, I read previous post which suggest using tab and enter, as well as a second macro to clear the pop up window.
How can I make it working using tab and enter? or can I combine the second macro into the first macro? is there any example? I am really new to macro, please help! Thanks a lot!
Here is my scripts. It works for invalid query, but not valid query. You can see that structure is not right.
IE_Navigate>%IE[0]%,http://apps.kemi.se/nclass/default.asp,r
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"http://apps.kemi.se/nclass/images/SubstanceSearch.jpg"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,IMG,HREF,str:TagValue,r
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"frmSearch"}
Let>FieldName={"TxtCas"}
Let>FieldValue={"71-43-2"}
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={"frmSearch"}
Let>TagValue={"btnSearch"}
//LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
MessageModal>I am here 1
WaitWindowOpen>Microsoft Internet Explorer
SetFocus>Microsoft Internet Explorer
Press Tab
Press Enter
MessageModal>I am here 2
Wait>5
IE_ContainsText>IE[0],,Please click,exists1
IF>{(%exists1%=1)}
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"frmSearch"}
Let>newline={" "}
ConCat>newline,line
ConCat>newline,{" "}
Let>TagValue=newline
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue,r
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"frmSearch"}
Let>TagValue={"http://apps.kemi.se/nclass/images/PrintReport.gif"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,IMG,HREF,str:TagValue,r
IE_WaitNew>0,IE[1]
IE_Wait>IE[1],r
IE_Wait>%IE[1]%,r
Wait>delay
//press CTRL+P to invoke print dialog
Press CTRL
Send>p
Release CTRL
//wait for print dialog to appear
WaitWindowOpen>Print
Wait>1
//Select PDFCreator option
Send>PDFCreator
Press Enter
//Wait for PDFCreator window
WaitWindowOpen>PDFCreator 0.*
Wait>1
Press Enter
//wait for Save As dialog to appear
WaitWindowOpen>Save as
//send the filename (value from input file)
Let>folder=c:\MacroCAS\%line%\
Send>%folder%%line%_Ref20_NCLASS
//press Save
Press ALT
Send>s
Release ALT
//wait for Save as and PDF creator windows to have disappeared before we continue
WaitWindowClosed>Save as
WaitWindowClosed>PDF Creator*
ENDIF
How to handle pop up window?
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
This may help:
http://www.mjtnet.com/blog/2008/03/04/o ... e-dialogs/
http://www.mjtnet.com/blog/2008/03/04/o ... e-dialogs/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
cannot close it now?
Thanks a lot for that post. It is helpful!
I decide to use IfWindowOpen command, however, I just cannot close this pop up window. I have tried Press Enter, Press Tab, then Enter. None of them work. Could you please let me know what's wrong. Thanks a lot!
Here is related scripts and I did get into this IF structure and got message of I am here 2.
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
Wait>5
IfWindowOpen>Microsoft Internet Explorer
SetFocus>Microsoft*
Press Tab
Press Enter
//MessageModal>I am here 2
Endif
Wait>5
IE_ContainsText>IE[0],,Please click,exists1
I decide to use IfWindowOpen command, however, I just cannot close this pop up window. I have tried Press Enter, Press Tab, then Enter. None of them work. Could you please let me know what's wrong. Thanks a lot!
Here is related scripts and I did get into this IF structure and got message of I am here 2.
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
Wait>5
IfWindowOpen>Microsoft Internet Explorer
SetFocus>Microsoft*
Press Tab
Press Enter
//MessageModal>I am here 2
Endif
Wait>5
IE_ContainsText>IE[0],,Please click,exists1
What about Window Action?
WindowAction>Action,window_title
Use this function to restore, minimize, maximize or close a window.
Action can be any one of the following:
0: Restore the window
1: Maximize the window
2: Minimize the window
3: Close the window
Code: Select all
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
Wait>5
IfWindowOpen>Microsoft Internet Explorer
WindowAction>3,Microsoft Internet Explorer
//MessageModal>I am here 2
Endif
Wait>5
IE_ContainsText>IE[0],,Please click,exists1