Jump to content

Can't seem to click a button on a web Page - using IE function


 Share

Recommended Posts

I am trying to automate logging in to a website.

I am able to have the user id and password entered using an autioit script but can't get the login button clicked.

Here is my code.

#include <IE.au3>
Local $oIE = _IECreate("http://www.helpkidzlearn.com")
Local $oForm = _IEFormGetObjByName($oIE, "form1")
Local $oUserName = _IEFormElementGetObjByName($oForm, "Login1_UserName")
Local $oPassword = _IEFormElementGetObjByName($oForm, "Login1_Password")
_IEFormElementSetValue($oUserName, "xxxxxxxxx")
_IEFormElementSetValue($oPassword, "yyyyyyyyyy")

to click the login button I have tried

_IELinkClickByText($oIE, "Login1")
_IELinkClickByText($oIE, "Login1_LoginButton")
_IELinkClickByText($oIE, "ctl00$Login1$LoginButton")
_IEFormImageClick($oIE, "ctl00$Login1$LoginButton", "name")
_IELinkClickByIndex($oIE, 19)

and can't seem to get it to work.

Here is the appropriate code (it think, not really know html)

<div class="AspNet-Login" id="Login1">
                             <fieldset>
                                 <label for="Login1_UserName" id="Login1_emailLabel">Username:</label>
                                 <input name="ctl00$Login1$UserName" type="text" id="Login1_UserName" /><span id="Login1_EmailValidator" class="valid" style="visibility:hidden;">*</span>
                                    
                                 <label for="Login1_Password" id="Login1_passwordLabel">Password:</label>
                                 <input name="ctl00$Login1$Password" type="password" id="Login1_Password" /><span id="Login1_PasswordValidator" class="valid" style="visibility:hidden;">*</span>
                                 <input type="submit" name="ctl00$Login1$LoginButton" value="Login" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$Login1$LoginButton&quot;, &quot;&quot;, true, &quot;HeaderLogin&quot;, &quot;&quot;, false, false))" id="Login1_LoginButton" class="register filter" />
                                 <input type="submit" name="ctl00$Login1$RegisterButton" value="Register" id="Login1_RegisterButton" class="login filter" />
                             </fieldset>
                             <div id="Login1_fail" class="fail">
                                 </div>
                        
</div>

Any help would be greatly appreciated.

Steven

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...