Jump to content

_IEFormGetObjByName Problem


Go to solution Solved by DW1,

Recommended Posts

hello, i have problem that the website i want to fill forms in it has no object name or id

in google there's

_IEFormGetObjByName($oIE, "f") ; the obj name is "f"
_IEFormElementGetObjByName($oForm, "q") ; and the form is "q"

 

in website i want, there's no the fObjName PART.

what should i do?

the source of the forms

</div> 
    <div id="rightcontent"> 

    <div class="box_one"> 
    <div class="box_one_title">User panel</div> 
    <form action="/" method="post">
    
        <table border='1' cellpadding='0' cellspacing='0'>
        <form method='post' action='index.php'>
        <input placeholder='Username' name='username' autocomplete='off' class='login_input' type='text'><br> 
        <input placeholder='Password' name='password' autocomplete='off' class='login_input' style='margin-top: -1px;' type='password'><br> 
        <input value='login' name='submit' class='loginbtnwidth' style='width:100%;margin-top: 4px;' type='submit'><br> 
        </form>
        </table>
        <br />
        <center>
        <a href='?pg=reg' class='button small green'>&nbsp;&nbsp;Register Now !&nbsp;&nbsp;</a><a href='?pg=forgotpw' class='button small gray'>Forgot Password ?</a>
        </center>       
        </div>

any help would be appreciated,

thanks.

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

Read the helpfile - see the remarks section of the two _IE functions you mention.

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

@Dale

i tried that but didn't work :S

#include <IE.au3>
 
Local $oIE = _IECreate("www.thewebsite.com", "1")
_IELoadWait($oIE)
$oForm = _IEFormElementGetCollection($oIE, 0)
_IEFormElementSetValue($oForm, "testttt")

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

Any help??

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

Well, I'm sorry not to have time to test but try to use_IEFormGetCollection which returns an object variable with a collection of all forms in the document.

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Link to comment
Share on other sites

@EKY32

notworking also :/

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

first step
find all forms in the page with

$Forms =  _IEFormGetCollection($oIE)

read the @extended value to see how many forms are there
if there is only one form then you can point to that by indexing 0

$MyTargetForm =  _IEFormGetCollection($oIE, 0)

if there are more forms, than you have to increment the index (0) till you point to your targhet form

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

tired of trying, it seems there's one form, but actually there's 2

here's the site and i hope i didnt break the rules

http://sj-sro.zapto.org/

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

  • Solution

#include <IE.au3>
Local $oIE = _IECreate("http://sj-sro.zapto.org/")
$oForm = _IEFormGetCollection($oIE, 0)
$oUser = _IEFormElementGetObjByName($oForm, 'username')
$oPass = _IEFormElementGetObjByName($oForm, 'password')
_IEFormElementSetValue($oUser, "username")
_IEFormElementSetValue($oPass, "password")

You were using _IEFormElementGetCollection when you should have been using _IEFormGetCollection to get the form, then you were trying to set the form to text which isn't going to work because you need to get the element first.

Link to comment
Share on other sites

#include <IE.au3>
Local $oIE = _IECreate("http://sj-sro.zapto.org/")
$oForm = _IEFormGetCollection($oIE, 0)
$oUser = _IEFormElementGetObjByName($oForm, 'username')
$oPass = _IEFormElementGetObjByName($oForm, 'password')
_IEFormElementSetValue($oUser, "username")
_IEFormElementSetValue($oPass, "password")

You were using _IEFormElementGetCollection when you should have been using _IEFormGetCollection to get the form, then you were trying to set the form to text which isn't going to work because you need to get the element first.

Many thanks <3

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

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