Cannot click on BUTTON in html page using IEAuto.dll

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Cannot click on BUTTON in html page using IEAuto.dll

Post by spar108r » Tue Oct 24, 2006 12:23 am

Hello support,

First time poster, long-time user, GREAT PROGRAM !!!

I have the following html page that I'm trying to click a button on
using IEAuto.dll through Macro Scheduler, but I can't seem to get the
script to click on the button, please help.

##########################################

HTML Source
(test.html, excerpt from original source targeting issue at hand)

##########################################


function ShowAlert(){
alert("Not implemented yet");
}



test.html





Search




##########################################

##########################################

Macro Scheduler Source

##########################################

Label>lblSetConstants
//Set Script Constants
Let>intDelay={5}
//Adjust for path of IEAuto.dll
Let>strIEAutoLIBDir={"C:\Program Files\WebRecorder"}
//Adjust for path of test.html
Let>strURLLogonPage={"C:\test.html"}
Let>strFrame_ID={""}
Let>strForm_ID={"ActionForm"}
Let>strForm_Search_TAG={"submitBtn"}
Goto>lblInitialize

Label>lblInitialize
//Load the Internet Exporer Automation COM
LibLoad>%strIEAutoLIBDir%\IEAuto.dll,hIE
If>hIE=0
MessageModal>Could NOT load the IEAuto.dll COM, make sure it is in the correct path.
Goto>lblExitScript
EndIf
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Goto>lblSetVariables

Label>lblSetVariables
//Set Script Variables
Goto>lblPerformActions

Label>lblPerformActions
LibFunc>hIE,CreateIE,IE[0],0
LibFunc>hIE,Navigate,r,%IE[0]%,strURLLogonPage
LibFunc>hIE,WaitIE,r,%IE[0]%
Let>FrameName=%strFrame_ID%
Let>FormName=%strForm_ID%
Let>TagValue=%strForm_Search_TAG%
//Why doesn't it click on the button here ???
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,BUTTON,NAME,str:TagValue
Goto>lblEndScript

Label>lblErrorHandler
//Add Error Handling Here
Goto>lblEndScript

Label>lblEndScript
LibFree>hIE
Goto>lblExitScript

Label>lblExitScript
//Exit Script Here

##########################################

If someone can attempt to debug this and provide a solution or workaround, it would be greatly appreciated.

Thank you in advance.

spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Post by spar108r » Tue Oct 24, 2006 12:26 am

Previous post does not show the full code, this post contains all the necessary code, thanks again.

Code: Select all

########################################## 

HTML Source 
(test.html, excerpt from original source targeting issue at hand) 

########################################## 

<script> 
function ShowAlert(){ 
alert("Not implemented yet"); 
} 
</script> 
<html> 
<title> 
test.html 
</title> 
<head> 
</head> 
<body> 
<form> 
<button>Search</button> 
</form> 
</body> 
</html> 

########################################## 

########################################## 

Macro Scheduler Source 

########################################## 

Label>lblSetConstants 
//Set Script Constants 
Let>intDelay={5} 
//Adjust for path of IEAuto.dll 
Let>strIEAutoLIBDir={"C:\Program Files\WebRecorder"} 
//Adjust for path of test.html 
Let>strURLLogonPage={"C:\test.html"} 
Let>strFrame_ID={""} 
Let>strForm_ID={"ActionForm"} 
Let>strForm_Search_TAG={"submitBtn"} 
Goto>lblInitialize 

Label>lblInitialize 
//Load the Internet Exporer Automation COM 
LibLoad>%strIEAutoLIBDir%\IEAuto.dll,hIE 
If>hIE=0 
MessageModal>Could NOT load the IEAuto.dll COM, make sure it is in the correct path. 
Goto>lblExitScript 
EndIf 
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt 
MouseMove>0,0 
Goto>lblSetVariables 

Label>lblSetVariables 
//Set Script Variables 
Goto>lblPerformActions 

Label>lblPerformActions 
LibFunc>hIE,CreateIE,IE[0],0 
LibFunc>hIE,Navigate,r,%IE[0]%,strURLLogonPage 
LibFunc>hIE,WaitIE,r,%IE[0]% 
Let>FrameName=%strFrame_ID% 
Let>FormName=%strForm_ID% 
Let>TagValue=%strForm_Search_TAG% 
//Why doesn't it click on the button here ??? 
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,BUTTON,NAME,str:TagValue 
Goto>lblEndScript 

Label>lblErrorHandler 
//Add Error Handling Here 
Goto>lblEndScript 

Label>lblEndScript 
LibFree>hIE 
Goto>lblExitScript 

Label>lblExitScript 
//Exit Script Here 

########################################## 

spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Post by spar108r » Tue Oct 24, 2006 12:29 am

Hello support,

lets try it one more time, this one is final and contains the full source code to be debugged. thanks yet again.

First time poster as you can tell, long-time user, GREAT PROGRAM !!!

I have the following html page that I'm trying to click a button on
using IEAuto.dll through Macro Scheduler, but I can't seem to get the
script to click on the button, please help.

###############################################

HTML Source (test.html --> excerpt of original targeting issue at hand)

###############################################

I don't know why certain attributes don't display properly when i post, but here is how it shoud look (html source):

Form name="ActionForm"
Button name="submitBtn" onClick="ShowAlert();"

Code: Select all

<script>
	function ShowAlert(){
		alert("Not implemented yet");
	}
</script>
<html>
<title>
test.html
</title>
<head>
</head>
<body>
<form>
<button>Search</button>
</form>
</body>
</html>
###############################################

Macro Scheduler Source

###############################################

Code: Select all

Label>lblSetConstants
  //Set Script Constants
  Let>intDelay={5}
  //Adjust for path of IEAuto.dll
  Let>strIEAutoLIBDir={"C:\Program Files\WebRecorder"}
  //Adjust for path of test.html
  Let>strURLLogonPage={"C:\test.html"}
  Let>strFrame_ID={""}
  Let>strForm_ID={"ActionForm"}
  Let>strForm_Search_TAG={"submitBtn"}
  Goto>lblInitialize

Label>lblInitialize
  //Load the Internet Exporer Automation COM
  LibLoad>%strIEAutoLIBDir%\IEAuto.dll,hIE
  If>hIE=0
    MessageModal>Could NOT load the IEAuto.dll COM, make sure it is in the correct path.
    Goto>lblExitScript
  EndIf
  //Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
  MouseMove>0,0
  Goto>lblSetVariables

Label>lblSetVariables
  //Set Script Variables
  Goto>lblPerformActions

Label>lblPerformActions
  LibFunc>hIE,CreateIE,IE[0],0
  LibFunc>hIE,Navigate,r,%IE[0]%,strURLLogonPage
  LibFunc>hIE,WaitIE,r,%IE[0]%
  Let>FrameName=%strFrame_ID%
  Let>FormName=%strForm_ID%
  Let>TagValue=%strForm_Search_TAG%
  //Why doesn't it click on the button here ???
  LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,BUTTON,NAME,str:TagValue
  Goto>lblEndScript

Label>lblErrorHandler
  //Add Error Handling Here
  Goto>lblEndScript

Label>lblEndScript
  LibFree>hIE
  Goto>lblExitScript

Label>lblExitScript
  //Exit Script Here
If someone can attempt to debug this and provide a solution or workaround, it would be greatly appreciated.

Thank you in advance.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Oct 24, 2006 7:21 am

This forum strips out certain html tags for security reasons. Therefore can you please copy the source of the web page to a .html file and then zip it up with your script and email it to support AT mjtnet.com. Then we can see the html properly and get you sorted.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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