Jump to content

filling webforms an easy way?


Marcdk
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 =)!

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!")

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

#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 !

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