Jump to content
Sign in to follow this  
Technika

Unable to script for entering account number in a field

Recommended Posts

Technika

Hi guys

New to Autoit and this forum. Hoping to get some quality advice here. I am trying to write a script that will open a website in IE and enter an account number and do a search. I can get as far as opening up the website, however Can't really work out why it fails to input the account number and do the search. Could you guys please help me work out where I am going wrong? Thanks 

 

My script:

#include <IE.au3>
$oIE = _IECreate ("https://www.test.com/test/index")
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_account = _IEFormElementGetObjByName ($o_form, "ACCOUNT_NO")
$o_signin = _IEFormElementGetObjByName ($o_form, "Wam.Action.Search")
$accountnumber = "123456789"
_IEFormElementSetValue ($o_account, $accountnumber)
_IEAction ($o_signin, "click")

And the following from Page Source:

 

<HEAD>
<META name="GENERATOR" content="IBM WebSphere Studio">
</HEAD>
<table class="form" cellpadding="2" cellspacing="0" border="0" width="100%" align="middle">
<form action="/test/index" name="mainform" method="POST">


<input type='hidden' name='Wam.Tid' value='13ea875dae5'>
  
<tr> 
<td  colspan="4">Account no: &nbsp;<font face="Verdana" size="2">
<INPUT TYPE="TEXT" NAME="ACCOUNT_NO" VALUE="" SIZE="9" MAXLENGTH="9"></font>
&nbsp;&nbsp;Customer no: &nbsp;<font face="Verdana" size="2">
<INPUT TYPE="TEXT" NAME="mainform1" VALUE="" SIZE="9" MAXLENGTH="9"></font>
&nbsp;&nbsp;
<INPUT TYPE="SUBMIT"VALUE="Search" NAME="Wam.Action.Search">


<INPUT TYPE="HIDDEN" NAME="FIELDMAP" VALUE="{ACCOUNT_NO=Params.AccountNumber}{mainform1=Params.CustomerNumber}">
</form>
   
</table>     
<script> 
document.mainform.ACCOUNT_NO.focus();
// turn off right click on web browser to make it more difficult to print / view source
if(navigator.appName.indexOf("Microsoft") != -1) document.oncontextmenu=function(){return false}
</script>   
Edited by Technika

Share this post


Link to post
Share on other sites
mikell

Try

$o_form = _IEFormGetObjByName ($oIE, "mainform")
 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×