Jump to content

Clicking a button fails (however it does click the button


Recommended Posts

Hi 

So I'm clicking this button which has submit in the inner text  and I use this code to do it

;~ Get all Buttons
Local $oButtons = _IETagNameGetCollection($oIE, "Button")
For $oButton In $oButtons
    ;~ Check if Button InnerText equals Log In and perform an action.
    ;~ Uncomment the _IEAction line below to submit the form.
    If $oButton.InnerText = "Submit"       Then
       if @Error then
          ConsoleWrite(@CRLF & "Error finding submit button")

          Endif
        MsgBox(64, 'Log In Button Found', 'Button found with value: ' & $oButton.InnerText, 2)
        Sleep(2500)
        _IEAction($oButton, 'click')
        Sleep(4000)
    EndIf
 Next

However when I run my program I get this in the console 

 

(41) : ==> The requested action with this object has failed.:
If $oButton.InnerText = "Submit"       Then
If $oButton^ ERROR
>Exit code: 1    Time: 39.17

It does click the Submit button so I'm wondering why it fails on the following line:

If $oButton.InnerText = "Submit"       Then

 

Link to comment
Share on other sites

My curiosity would push me to understand why this button is giving trouble.  I would first set a counter to know which button is badly reacting.  Understanding the DOM of this object would allow to skip it in some way.  If you don't have that curiosity, just add a COM error handler.

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...