Jump to content

IE help


Jewtus
 Share

Go to solution Solved by jdelaney,

Recommended Posts

I'm having some issues with an IE form not inputting data or submitting and I'm not sure why.

This is the code 

$oForm = _IEFormGetObjByName($oIE, "EditForm")
$o_Rate = _IEGetObjById($oIE, "invoice.formattedHourlyRate")
_IEFormElementSetValue($o_Rate, "100.00")
_IEFormElementCheckBoxSelect($oForm, "on", "", 1, "byValue");Accept terms
_IEFormSubmit($oForm)

for the _IEFormElementCheckBoxSelect I had to use byvalue and "on" because there a few check boxes (they vary every time) so I cannot use index, and when I use name, it doesn't seem to work.

I've also been getting lots of errors on the console readout (I'm using the beta version of autoit FYI)


 

--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormGetObjByName, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormSubmit, $_IESTATUS_InvalidDataType

 

Here is a screenshot of the HTML.

2z4n7dg.png

Anyone have suggestions? Only the submit part isn't working at this point.

Link to comment
Share on other sites

Everything DOES work except the submit button, which is why I'm so confused. I did state that only the submit button has issues in the OP.

Edited by Jewtus
Link to comment
Share on other sites

maybe instead of trying to use ieformsubmit  try 

_IEFormElementGetObjByName (); to get the name of the form submit button
_IEAction (); click on the form submit button

:alien:

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

Everything DOES work except the submit button, which is why I'm so confused. I did state that only the submit button has issues in the OP.

Actually, that's not what you said.

 

I'm having some issues with an IE form not inputting data or submitting and I'm not sure why.

Then you posted a bunch of errors that indicates an issue with _IEAttach. Can you post a complete script that demonstrates the issue(s) that you are experiencing?

Link to comment
Share on other sites

Actually, that's not what you said.

 

 

 

Anyone have suggestions? Only the submit part isn't working at this point.

 

Not trying to be combative, but, I did specify that.

I'll try what alienclone suggested

Link to comment
Share on other sites

Well Alienclone, that didn't work, but it did let me identify what the issue is. When I use:

$oSubmit=_IEFormElementGetObjByName($oForm,"submit")
_IEAction($oSubmit,"click")

it ends up moving to the next page (but not hitting the submit button). This seemed odd so I dived into the HTML a little more and found that there are a number of elements with "submit", but this is the one that gets bound to when I use the above code:

 

<input name="updateRequests" class="linkBtn" id="submit" type="submit" value="Next 50 >"/>

 

Is there a way to bind to something with a value? line that I'm trying to bind to is:

 

<input class="formBtn" id="submit" type="submit" value=" Submit For Review "/>

 

I did find this article:

'?do=embed' frameborder='0' data-embedContent>>

and I tried adding this:

Local $oInputs = _IETagNameGetCollection($oIE, "input")
For $oInput In $oInputs
    If $oInput.Type = "submit" and $oInput.Value = "Submit For Review" Then
        _IEAction($oInput,"click")
        ExitLoop
    EndIf
Next

but no dice...

Edited by Jewtus
Link to comment
Share on other sites

  • Solution

You can grab ALL the elements, and then loop through for your particular one, or you can use my signature, and add an xpath to find your specific element. (just noticed you attempted this...you are missing the leading and trailing spaces on the value...or you can use what you have, but use a StringInStr compare...or use StringStripWS on the actual value, and compare against that.).

Your xpath would be:

"//input[@id='submit' And @value=' Submit For Review ']"

or

"//input[@id='submit' And contains(@value,'Submit For Review')]"

I always suggest doing this through xpaths, because then, when you at some point need to test in IE and firefox, or chrome, you can easily use the same variables, and just switch out to the proper function call.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

You can grab ALL the elements, and then loop through for your particular one, or you can use my signature, and add an xpath to find your specific element. (just noticed you attempted this...you are missing the leading and trailing spaces on the value...or you can use what you have, but use a StringInStr compare...or use StringStripWS on the actual value, and compare against that.).

The Xpath stuff is a bit over my head, but this part is exactly what I needed!

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