Jump to content

Problem with _IEFormGetObjByName


 Share

Recommended Posts

hi, im trying to get this script to work which is supposed to log me in this site ("www.ogame.de")

well but it doesnt work... this is what i tried:

#include <IE.au3>

$sUsername = "Your Username"

$sPassword = "Your Password"

$sUni = "60. Universum"

$oIE = _IECreate("www.ogame.de")

; get pointers to the login form and username and password fields

$oform = _IEFormGetObjByName($oIE, "formular")

$ouni = _IEFormElementGetObjByName($oform, "Uni")

$ologin = _IEFormElementGetObjByName($oform, "login")

$opassword = _IEFormElementGetObjByName($oform, "pass")

; Set field values and submit the form

_IEFormElementSetValue($ouni, $sUni)

_IEFormElementSetValue($ologin, $sUsername)

_IEFormElementSetValue($opassword, $sPassword)

_IEFormSubmit($oform)

I'm not sure whether the names are correct or not, if someone could take a look at this part of the sourcecode an tell me if they are ok? i would really appreciate that!

</script>

<form name="formular" action="" method="post" onsubmit="changeAction('login');"></form>

<tbody><tr>

<td align="center" background="img/main/login_back.gif" valign="top"><br>

<table cellpadding="0" cellspacing="0" width="97%">

<tbody><tr>

<td><img src="img/main/arrow.gif"></td>

<td> <select tabindex="1" name="Uni" class="eingabe" style="width: 150px;">

<option value="">Universum auswählen...</option><option value="uni1.ogame.de">1. Universum</option><option value="uni2.ogame.de">2. Universum</option><option value="uni3.ogame.de">3. Universum</option><option value="uni4.oga....(...)

</select>

<script type="text/javascript"> document.formular.Uni.focus(); </script>

</td>

<td>

<img src="img/main/arrow2.gif" alt="Username">

</td>

<td>

<nobr>

<span class="rahmen"><input tabindex="2" alt="Login" class="eingabe" name="login"></span>

<span class="rahmen"><input tabindex="3" maxlength="20" alt="Passwort" class="eingabe" name="pass" type="password"></span></nobr>

</td><td>

<input src="img/main/login.gif" value="Login" border="0" height="15" type="image" width="40">

</td>

<td align="left" width="100%"><span class="rahmen"></span></td>

</tr>

<tr>

<td colspan="4" align="left"><span class="black_small"><br>Mit dem Login stimme ich den <a href="?go=agb&lang=de">AGB</a> zu | </span> <a href="?go=register&lang=de" class="footer_link">Registrieren</a> <span class="black_small"> | </span> <a href="java script:changeAction('password');" class="footer_link">Passwort vergessen?!</a></td>

</tr>

when i start the script the IE opens but it doesn't fill in any values....

and i get these errors:

--> IE.au3 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType

im really sorry as this is probably a realy newbish question ;)

oh and i'm sorry for my bad english too (i'm german)

Link to comment
Share on other sites

maybe...

#include <IE.au3>

$sUsername = "Your Username"
$sPassword = "Your Password"
$sUni = "60. Universum"

$oIE = _IECreate("www.ogame.de")

$oFrame = _IeFrameGetObjByName ($oIe, "mainframe")

; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oFrame, "formular")
$ouni = _IEFormElementGetObjByName($oform, "Uni")
$ologin = _IEFormElementGetObjByName($oform, "login")
$opassword = _IEFormElementGetObjByName($oform, "pass")

; Set field values and submit the form
_IEFormElementSetValue($ouni, $sUni)
_IEFormElementSetValue($ologin, $sUsername)
_IEFormElementSetValue($opassword, $sPassword)
_IEFormSubmit($oform)

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

ah thanks alot! ;)

(..)

[edit] oops ... errors still there :lmao:

i will try to find out if the frame name is different

--> IE.au3 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType

Edited by hardburn
Link to comment
Share on other sites

#include <IE.au3>

$sUsername = "Your Username"

$sPassword = "Your Password"

$sUni = "60. Universum"

$oIE = _IECreate("www.ogame.de")

$oFrame = _IeFrameGetObjByName ($oIe, "mainframe")

; get pointers to the login form and username and password fields

$oform = _IEFormGetObjByName($oFrame, "formular")

$ouni = _IEFormElementGetObjByName($oform, "Uni")

$ologin = _IEFormElementGetObjByName($oform, "login")

$opassword = _IEFormElementGetObjByName($oform, "pass")[/autoit]

that will fix the universum selection

; Set field values and submit the form

_IEFormElementOptionselect($ouni, $sUni, 1, "byText")

_IEFormElementSetValue($ologin, $sUsername)

_IEFormElementSetValue($opassword, $sPassword)

_IEFormSubmit($oform)

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

this changed something... (where did you get that "trk" from? ^^)

the errors from above are gone but now it says this:

>Running:(3.2.0.1):C:\Programme\AutoIt3\autoit3.exe "C:\myscript.au3"

C:\PROGRA~1\AutoIt3\Include\IE.au3 (1246) : ==> The requested action with this object has failed.:

$o_col = $o_object.document.forms.item ($s_Name)

$o_col = $o_object.document^ ERROR

do i have to add another include? or whats going on there? :/

Link to comment
Share on other sites

this changed something... (where did you get that "trk" from? ^^)

the errors from above are gone but now it says this:

do i have to add another include? or whats going on there? :/

that is odd...I thought IE.au3 always reported errors to the console itself, but that's an autoit error.

Better let Dale grab this one.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

that is odd...I thought IE.au3 always reported errors to the console itself, but that's an autoit error.

Better let Dale grab this one.

I try.

I have two strategies for error handling.

First I try to anticipate common errors and check to prevent them from occurring. For the most part, these are the ones reported to the console. Second, with certain pieces of code I know that errors are inevitable, like in _IELoadWait where I am try to check the status of objects that are changing underneath me. In these cases, starting in version 2, I check for and deregister a user error handler, register my own, trap and handle the errors and re Register the user error handler. I have only migrated to this second technique where it has been absolutely necessary.

The first scenario is not foolproof, because things like browser redirects and such can occur in the milliseconds after I test for object validity and when it is actually referenced - this is where errors like the one reported here typiaclly occur. They can also occur if I have made a mistake or have not anticipated all that I could as well however, so I like to understand the circumstances to see if there is more that could be done.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

[...]

where did you get that "trk" from? ^^

[...]

looked at the source of ogame.de in Firefox - it shows tro frames. One "Mainframe" and one "trk"

@Dale: Cool, I didn't realize how much work went into the error checking...I will look through/admire the code later... ;)

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

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