Sign in to follow this  
Followers 0
ajdicky

IE Formelement submit help please?

12 posts in this topic

#1 ·  Posted (edited)

how do i click/submit a form button without a name??

i used IE Builder and checked for the page's Form Elements

the button that i wanna click/submit has no name so i can't use this

$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")

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

_IEFormElementSetValue ($oText, "text")

_IEFormSubmit ($oForm)

heres the info for the Form Button i wanna click/submit

theres only an Index No.(2)/Tag(INPUT)/Name(None)/Extra Information(Form Input Type:submit,Value:Cast Again)/Object Type(DispHTMLInputElement)

i just want to submit that button and not input anything please help and thx!

Edited by ajdicky

Share this post


Link to post
Share on other sites



Have a look at _IEFormElementGetCollection in the helpfile, you need to know the index of the element though.

Share this post


Link to post
Share on other sites

How do i get the index of the element?!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I usually use the web developer plugin for FireFox to determine stuff like that, but you can also do some testing with javascript to determine the index, but

how do i click/submit a form button without a name??

i used IE Builder and checked for the page's Form Elements

the button that i wanna click/submit has no name so i can't use this

heres the info for the Form Button i wanna click/submit

theres only an Index No.(2)/Tag(INPUT)/Name(None)/Extra Information(Form Input Type:submit,Value:Cast Again)/Object Type(DispHTMLInputElement)

i just want to submit that button and not input anything please help and thx!

I don't know where from you got that info, but if it's accurate, its index might be 2.

Edit:

You could probably also run this javascript in your browser to determine which elements are of type submit:

Edit:

Nvm. I attached a text file that has the correct javascript code in it(the forum keeps fucking up javascript code, even inside code tags. >_>):

Edited by FreeFry

Share this post


Link to post
Share on other sites

What if theres 2 forms on 1 page?theres 2 forms and 2 same index number what do i do with that?=\

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You already have acquired the correct form with the _IEFormGetObjByName function.

When you have determined the correct index for the element, use this code to click the submit button:

$oSubmit = _IEFormElementGetCollection($oForm, element_index_here)
_IEAction($oSubmit, "click")oÝ÷ Ù±ßÛ
©§!ú+Zn­¶Z+++_ºw-áj÷²¢ëkçbµ«­¢+Ù}%½ÉµMÕµ¥Ð ÀÌØí½½É´¤

Some(quite a lot actually) forms runs javascript when they submit, and then using _IEFormSubmit wont work, in which case you will have to click the Submit button, which my previous example does.

Edited by FreeFry

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

argh..i tried both but the script would just end right away~i'll try to figure it out myself ~thx

btw please teach me how to use this javascript code thing you attached?

$oIE = _IEAttach("Fishing Shack")

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 2)

_IEFormElementSetValue ($oQuery, "")

_IEFormSubmit ($oForm)

it worked if i do this but is the SetValue nessesary?

and what is the "0" stand for at the last part of _IEFormGetCollection?is that the form number?or the element index no.?

Edited by ajdicky

Share this post


Link to post
Share on other sites

Oh, sorry, just paste the code in your address field, and press enter.

Share this post


Link to post
Share on other sites

thanks for everything:)

oh and could you help me with this too?

I'm trying to get the loop run base on the text

but the last part wouldn't work it won't click on the img link after the text have changed on the page and the script would just change~

$DWWORK = "You worked, using 2 energy"

$DWNOWORK = "You don't have enough energy to work, Get outa here!"

$DWGETTEXT = _IEPropertyGet($DWLUMBER,"innertext")

If StringInStr($DWGETTEXT, $DWWORK) Then

While 1

$sMyString = "Work Again?"

$oLinks = _IELinkGetCollection($DWLUMBER)

For $oLink in $oLinks

$sLinkText = _IEPropertyGet($oLink, "innerText")

If StringInStr($sLinkText, $sMyString) Then

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

_IELoadWait($DWLUMBER)

If StringInStr($DWGETTEXT, $DWNOWORK) Then

_IEImgClick($DWLUMBER,"navigation_08.gif","src")

EndIf

WEnd

EndIf

Share this post


Link to post
Share on other sites

Can you provide a link to the site you're testing this against?

Other than that, I suspect that you have to run $DWGETTEXT = _IEPropertyGet($DWLUMBER,"innertext") again after your loop, as the content inside $DWGETTEXT wont change to the new content on the page otherwise.

Share this post


Link to post
Share on other sites

I'm sorry, but I totally don't understand that site...

But did you try my suggestion?

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  
Followers 0