Help with _IEFormGetObjByName

Recommended Posts

Mithrandir 0

Mithrandir 0

Hello, my problem is this:I want to enter a user and password in a site, I took this to practice because it has a test zone in http://forums.linkbucks.com/newthread.php?...thread&f=12 and I looked at the example _IEFormElementSetValue that is in C:\Program Files\AutoIt3\Examples\Helpfile

The problem is that in this example (the _IEFormGetObjByName one that is also in C:\Program Files\AutoIt3\Examples\Helpfile )

; *******************************************************
; Example 1 - Get a reference to a specific form by name. In this case, submit a query
; to the Google search engine. Note that the names of the form and form
; elements can be found by viewing the page HTML source
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

It says "Note that the names of the form and form elements can be found by viewing the page HTML source" . Indeed, I went to the source code of google.com.uy and I found that the name of the form to search was "f" and then the "q" . Here it is the source code of google.com

I don't find the "f1" that is the name of the form to enter the user (I suppose).

I would be glad if you can help me as well as if you can show me an easier way of making what I want. Sorry if I inserted too much code but I read in other posts that people asked for the code of what the others where doing so as to help them better. In any case I don't put too much code next time. :smt005

NOW!!!, you can TAKE this scriptlet and run with it... or use the IE Builder to understand where and how I got the needed data...So you can do this and more on your own later!!

8)

Thank you a lot! I will look into it for sure because I like to know how things work (I like to eat fish but I like more to fish hehe). Just a question: I downloaded the IE Builder but in that post you said we need "IE.au3 version T2.0-370 or later, and latest beta of course" but I have installed the latest full version of autoit (autoit-v3-setup) and the advanced version of scite (SciTE4AutoIt3) Do I need to install anything else?

PS:Nahuel35 from http://www.emesn.com/autoitforum/ recommended me www.debugbar.com and I wanted to share with you as it may prove useful for working with IE explorer

Share this post

Link to post

Share on other sites

Mithrandir 0

Mithrandir 0

Valuater: I wasn't able to run IE-library_v2.0 . I downloaded and installed the latest beta of autoit as well as the IE Builder and decompressed it in a folder in my desk. I read the problem from JerryD here http://www.autoitscript.com/forum/index.ph...st&p=133794 and I copied the file IE.au3 from C:\Program Files\Autoit\include\ into C:\Program Files\Autoit\beta\include\ as you said there but I keep getting this error

Look at the source code, maybe I can't use _IEFormGetObjByName because the form there has javascript (i don't know i am wondering) and i should use another function maybe as it suggests in the helpfile "For many HTML forms it is not sufficient to use _IEFormSubmit() because there is often custom Javascript tied to an onclick event for its Submit button. In these cases you'll need to simulate a click of the submit button instead of using _IEFormSubmit(). See the example for the "click" action of _IEAction().

As well, some form processing relies on the "value" of the submit button being passed along with the rest of the form data (often when there is more than one submit button in the form and they are designed to trigger different results). This function will not result in a submit button value being passed. The solution is to use the "click" action of _IEAction() as above."

But how do I get to enter a reference to the username field or even to the button log in for instance?? I am quite confused Ok here is the code:

Share this post

Link to post

Share on other sites

Valuater 108

Valuater 108

Valuater: I wasn't able to run IE-library_v2.0 . I downloaded and installed the latest beta of autoit as well as the IE Builder and decompressed it in a folder in my desk. I read the problem from JerryD here http://www.autoitscript.com/forum/index.ph...st&p=133794 and I copied the file IE.au3 from C:\Program Files\Autoit\include\ into C:\Program Files\Autoit\beta\include\ as you said there but I keep getting this error