Jump to content
Sign in to follow this  
Marcdk

filling webforms an easy way?

Recommended Posts

Marcdk

Hey, i'm trying to create a bot which can fill out webforms. This isn't hard using:

Send ("{TAB}")

write info..

Send ("{TAB}")

write more info

Send ("{TAB}")

etc. etc..

BUT most homepages can't be tabbed like that, because there isn't any focus in the first inputbox.. Just taking hotmail email signup as an example, also you can't do this with aol email or yahoo.

I don't want to manually click the first inputbox and then assign a hotkey to start it. I'm looking for another solution.. Any ideas?

Thanks for the help!

Share this post


Link to post
Share on other sites
PsaltyDS

Hey, i'm trying to create a bot which can fill out webforms. This isn't hard using:

Send ("{TAB}")

write info..

Send ("{TAB}")

write more info

Send ("{TAB}")

etc. etc..

BUT most homepages can't be tabbed like that, because there isn't any focus in the first inputbox.. Just taking hotmail email signup as an example, also you can't do this with aol email or yahoo.

I don't want to manually click the first inputbox and then assign a hotkey to start it. I'm looking for another solution.. Any ideas?

Thanks for the help!

Check out the _IE* functions of the IE.au3 UDF. Try out some the examples scripts in the help file.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Marcdk

Check out the _IE* functions of the IE.au3 UDF. Try out some the examples scripts in the help file.

:)

Thanks, found some usefull commands i can use in the future. However, i don't really understand how you find the value of a webform, and then after that put in whatever you like.. Could anyone give an example code of webform filling from hotmail.com's email signup page? Because i've tried and tried, looking at the Html source, searching it for the values described in the helpfile and so on. It just wont work for me.

Thanks for the help,

Marc

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks, found some usefull commands i can use in the future. However, i don't really understand how you find the value of a webform, and then after that put in whatever you like.. Could anyone give an example code of webform filling from hotmail.com's email signup page? Because i've tried and tried, looking at the Html source, searching it for the values described in the helpfile and so on. It just wont work for me.

Thanks for the help,

Marc

Please post the code you tried/don't understand. Have you tried a simpler web form first, like the ones in _IE_Example()?

Did you have any trouble understanding the example scripts for _IEFormElementGetValue() or _IEFormElementGetValue()?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Authenticity

This one search AutoIt3 using Yahoo's:

#include <IE.au3>
Opt('MustDeclareVars', 1)

Global $oIE, $sURL, $tForm, $FormElem

$sURL = 'http://www.yahoo.com/'

$oIE = _IECreate($sURL)

$tForm = _IEFormGetObjByName($oIE, 'sf1')
$FormElem = _IEFormElementGetObjByName($tForm, 'p')
_IEFormElementSetValue($FormElem, 'AutoIt3')
_IEFormSubmit($tForm, 0)
_IELoadWait($oIE)

Dim $output = 'Left: ' & $oIE.Left & @CRLF
$output &= 'Top: ' & $oIE.Top & @CRLF
$output &= 'Width: ' & $oIE.Width & @CRLF
$output &= 'Height: ' & $oIE.Height & @CRLF & @CRLF
$output &= 'Visible: ' & $oIE.Visible & @CRLF
$output &= 'Offile: ' & $oIE.Offline & @CRLF & @CRLF
$output &= 'StatusBar: ' & $oIE.StatusBar & @CRLF
$output &= 'MenuBar: ' & $oIE.MenuBar

ConsoleWrite($output)
Exit

There are some useful examples in the kit Autoit_123.zip.

Basically, you should be familiar with javascript and the like because you might find many cases where one line looks like a link but actually it isn't.

Share this post


Link to post
Share on other sites
Marcdk

This one search AutoIt3 using Yahoo's:

#include <IE.au3>
Opt('MustDeclareVars', 1)

Global $oIE, $sURL, $tForm, $FormElem

$sURL = 'http://www.yahoo.com/'

$oIE = _IECreate($sURL)

$tForm = _IEFormGetObjByName($oIE, 'sf1')
$FormElem = _IEFormElementGetObjByName($tForm, 'p')
_IEFormElementSetValue($FormElem, 'AutoIt3')
_IEFormSubmit($tForm, 0)
_IELoadWait($oIE)

Dim $output = 'Left: ' & $oIE.Left & @CRLF
$output &= 'Top: ' & $oIE.Top & @CRLF
$output &= 'Width: ' & $oIE.Width & @CRLF
$output &= 'Height: ' & $oIE.Height & @CRLF & @CRLF
$output &= 'Visible: ' & $oIE.Visible & @CRLF
$output &= 'Offile: ' & $oIE.Offline & @CRLF & @CRLF
$output &= 'StatusBar: ' & $oIE.StatusBar & @CRLF
$output &= 'MenuBar: ' & $oIE.MenuBar

ConsoleWrite($output)
Exit

There are some useful examples in the kit Autoit_123.zip.

Basically, you should be familiar with javascript and the like because you might find many cases where one line looks like a link but actually it isn't.

Christ, i love the support from this site, thanks a lot. I'll try to read the UDF file again for the points you've told me about, and also i'll take a look at the example script, Thanks =)!

Share this post


Link to post
Share on other sites
bobchernow

Christ, i love the support from this site, thanks a lot. I'll try to read the UDF file again for the points you've told me about, and also i'll take a look at the example script, Thanks =)!

I just learned how myself using the examples. There may be a better way but I just used the browser View Source to determine the Form name and the different input field names. Once you have that manipulating them is a breeze for IE. I have not had luck yet with the Firefox UDF since the MozLab Extension does not seem to work with the latest FF version.

Bob


--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Share this post


Link to post
Share on other sites
Stilgar

I just learned how myself using the examples. There may be a better way but I just used the browser View Source to determine the Form name and the different input field names. Once you have that manipulating them is a breeze for IE. I have not had luck yet with the Firefox UDF since the MozLab Extension does not seem to work with the latest FF version.

Bob

Use MozRepl instead of MozLab then the FF.au3 works with the latest FF version again.

Share this post


Link to post
Share on other sites
Marcdk

Okay i can't do this -.- i've been searching the hole forum several times now, without luck, i've been trying and trying to find a way to do this, using the example script in the Udf, but because the helpfile is so bad explained i don't fully understand how this should be set up..

The example code goes as the following:

#include <IE.au3>

$oIE = _IE_Example ("form") (I suppose this is the TITLE of the website? In my case i'll be using: Google)

$oForm = _IEFormGetObjByName ($oIE, "/search") (i suppose this is the FORM name? Which i can find seraching the html script)

$oText = _IEFormElementGetObjByName ($oForm, "f") (Name of the input box, it's a big guess i took looking at the source code from google -.-)

_IEFormElementSetValue ($oText, "Hey! This works!") (Writing the text to the $oText variable)

So this is basicly what i could come up with reading the helpfile... -.-

#include <IE.au3>

$oIE = Google

$oForm = _IEFormGetObjByName ($oIE, "/search")

$oText = _IEFormElementGetObjByName ($oForm, "f")

_IEFormElementSetValue ($oText, "Hey! This works!")

Share this post


Link to post
Share on other sites
PsaltyDS

Okay i can't do this -.- i've been searching the hole forum several times now, without luck, i've been trying and trying to find a way to do this, using the example script in the Udf, but because the helpfile is so bad explained i don't fully understand how this should be set up..

The example code goes as the following:

#include <IE.au3>

$oIE = _IE_Example ("form") (I suppose this is the TITLE of the website? In my case i'll be using: Google)

$oForm = _IEFormGetObjByName ($oIE, "/search") (i suppose this is the FORM name? Which i can find seraching the html script)

$oText = _IEFormElementGetObjByName ($oForm, "f") (Name of the input box, it's a big guess i took looking at the source code from google -.-)

_IEFormElementSetValue ($oText, "Hey! This works!") (Writing the text to the $oText variable)

So this is basicly what i could come up with reading the helpfile... -.-

#include <IE.au3>

$oIE = Google

$oForm = _IEFormGetObjByName ($oIE, "/search")

$oText = _IEFormElementGetObjByName ($oForm, "f")

_IEFormElementSetValue ($oText, "Hey! This works!")

Man, are you confused! :)

Try starting that off with:

$oIE = _IECreate("http://www.google.com")

:lmao:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Marcdk

Man, are you confused! :)

Try starting that off with:

$oIE = _IECreate("http://www.google.com")

:lmao:

I have a gui with internet explorer embedded, so i guess that's the wrong way to do it, am i right? Shouldn't it be:

_IENavigate ($PanTask, "http://www.google.com", 0)

This is my code...

$oIE = _IENavigate ($PanTask, "http://www.google.com", 0)

_IELoadWait ($PanTask)

$oForm = _IEFormGetObjByName ($oIE, "/search")

$oText = _IEFormElementGetObjByName ($oForm, "f")

_IEFormElementSetValue ($oText, "Hey! This works!")

It doesn't send any text to google, i think i found the wrong values?

Edited by Marcdk

Share this post


Link to post
Share on other sites
PsaltyDS

I have a gui with internet explorer embedded, so i guess that's the wrong way to do it, am i right? Shouldn't it be:

_IENavigate ($PanTask, "http://www.google.com", 0)

This is my code...

$oIE = _IENavigate ($PanTask, "http://www.google.com", 0)

_IELoadWait ($PanTask)

$oForm = _IEFormGetObjByName ($oIE, "/search")

$oText = _IEFormElementGetObjByName ($oForm, "f")

_IEFormElementSetValue ($oText, "Hey! This works!")

It doesn't send any text to google, i think i found the wrong values?

No. If you already have the object embedded then you already have that object's reference, as per the example in the help file for _IECreateEmbedded(). Your attempted use of _IE_Example() and "$oIE = Google" hardly make it look like you have created a working embedded browser object already.

And if you don't even know the difference between _IE_Eample() and _IECreate() yet, why are already trying to do an embedded browser, which only adds additional layers of complexity and requirements to the problem?

You should figure out these concepts on a basic browser first, then move on to using an embedded one.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Marcdk

No. If you already have the object embedded then you already have that object's reference, as per the example in the help file for _IECreateEmbedded(). Your attempted use of _IE_Example() and "$oIE = Google" hardly make it look like you have created a working embedded browser object already.

And if you don't even know the difference between _IE_Eample() and _IECreate() yet, why are already trying to do an embedded browser, which only adds additional layers of complexity and requirements to the problem?

You should figure out these concepts on a basic browser first, then move on to using an embedded one.

:)

This is just soo confusing. Could you just give an example on how to search google in an embedded Internet explorer? just so i can continue my work on my program, and learn the structere, reading the help file (Ie_create and Ie_example) doesn't help me at all

Thanks for the help, and sorry that i'm a bit unpatient.

Share this post


Link to post
Share on other sites
Authenticity

Read again the help file under the explanation about the _IECreateEmbedded function because this example (at the bottom) shows how to do this thing.

Share this post


Link to post
Share on other sites
bobchernow

Would you not want to first start out with an

$oIE =_IEAttach("Google")
to get the handle to work with.


--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Share this post


Link to post
Share on other sites
Marcdk

Read again the help file under the explanation about the _IECreateEmbedded function because this example (at the bottom) shows how to do this thing.

No it doesn't ? it just shows a gui with 4 buttons.. nothing else.

Share this post


Link to post
Share on other sites
Authenticity

#include <IE.au3>
Opt('MustDeclareVars', 1)

Dim $oIEEmbedded, $btSearch

$oIEEmbedded = _IECreateEmbedded()
GUICreate('Embedded', 800, 700)
$btSearch = GUICtrlCreateButton('AutoIt3', 370, 670, 60, 25)
GUICtrlCreateObj($oIEEmbedded, 10, 10, 690, 650)
_IENavigate($oIEEmbedded, 'http://www.google.com')

GUISetState()

While 1
    Local $msg = GUIGetMsg()
    
    Switch $msg
        Case -3
            GUIDelete()
            Exit
            
        Case $btSearch
            _SearchAutoIt()
    EndSwitch
    
    Sleep(50)
WEnd

Func _SearchAutoIt()
    Local $oForm, $oElement, $Find = 'AutoIt3'
    
    $oForm = _IEFormGetObjByName($oIEEmbedded, 'f')
    $oElement = _IEFormElementGetObjByName($oForm, 'q')
    _IEFormElementSetValue($oElement, $Find)
    _IEFormSubmit($oForm, 0)
    _IELoadWait($oIEEmbedded)
EndFunc

There is no <input> called "\Search" or so...

Share this post


Link to post
Share on other sites
Marcdk

#include <IE.au3>
Opt('MustDeclareVars', 1)

Dim $oIEEmbedded, $btSearch

$oIEEmbedded = _IECreateEmbedded()
GUICreate('Embedded', 800, 700)
$btSearch = GUICtrlCreateButton('AutoIt3', 370, 670, 60, 25)
GUICtrlCreateObj($oIEEmbedded, 10, 10, 690, 650)
_IENavigate($oIEEmbedded, 'http://www.google.com')

GUISetState()

While 1
    Local $msg = GUIGetMsg()
    
    Switch $msg
        Case -3
            GUIDelete()
            Exit
            
        Case $btSearch
            _SearchAutoIt()
    EndSwitch
    
    Sleep(50)
WEnd

Func _SearchAutoIt()
    Local $oForm, $oElement, $Find = 'AutoIt3'
    
    $oForm = _IEFormGetObjByName($oIEEmbedded, 'f')
    $oElement = _IEFormElementGetObjByName($oForm, 'q')
    _IEFormElementSetValue($oElement, $Find)
    _IEFormSubmit($oForm, 0)
    _IELoadWait($oIEEmbedded)
EndFunc

There is no <input> called "\Search" or so...

Thanks a lot!! Just an example like that i was searching for :) Love you man !

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.