Jump to content

How to set form element on IE for an INPUT tag


Recommended Posts

Hi 

 

I am trying to set the form element for this html

<input name="ctl00$MPH$pnlOutstandingPayments$ctlPaymentFileListing$ctl28" class="VerySmallFormEntry" style="width: 173px;" type="text">

 

by using the below ( i am trying 2 method first by _IEFormElementSetValue then by using a For Loop to loop through the Inputs 

;Select Accounts matching
$AccountsID = _IEFormElementGetObjByName($oIE, "ctl00$MPH$pnlOutstandingPayments$ctlPaymentFileListing$ctl28")
_IEFormElementSetValue($AccountsID, "TEST1")
If @error Then
   ConsoleWrite(@CRLF & "Can't set value")
EndIf

Local $Divs = _IETagNameGetCollection($oIE, "input")
For $Div In $Divs
    ;~ Check if Button InnerText equals Log In and perform an action.
    ;~ Uncomment the _IEAction line below to submit the form.
    If $Div.innerText = "TEST1"    Then
       if @Error then
          ConsoleWrite(@CRLF & "Error finding submit button")

          Endif
        MsgBox(64, 'A TEST1 account found', 'Div found with value: ' & $Div.InnerText, 2)
        ExitLoop
        Sleep(4000)
    EndIf
 Next

However I get the console write of the first error but it doesn't do anything on the For loop (it doesn't hit the IF @error 

 

Link to comment
Share on other sites

3 hours ago, CaptainBeardsEyesBeard said:

 

$AccountsID = _IEFormElementGetObjByName($oIE, "ctl00$MPH$pnlOutstandingPayments$ctlPaymentFileListing$ctl28")
_IEFormElementSetValue($AccountsID, "TEST1")
If @error Then
   ConsoleWrite(@CRLF & "Can't set value")
EndIf

@CaptainBeardsEyesBeard

Could your problem be that the first parameter of the _IEFormElementGetObjByName() function should be the form object, not the IE application object?  Look at the help file's example for the _IEFormElementGetObjByName() function.  Notice how they get the form object, using _IEFormGetObjByName(), right before they use it in the _IEFormElementGetObjByName() function in the next line?

Edited by TheXman
Link to comment
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
 Share

  • Recently Browsing   0 members

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