ajdicky Posted March 28, 2008 Posted March 28, 2008 (edited) how do i click/submit a form button without a name??i used IE Builder and checked for the page's Form Elementsthe 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/submittheres 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 March 28, 2008 by ajdicky
FreeFry Posted March 28, 2008 Posted March 28, 2008 Have a look at _IEFormElementGetCollection in the helpfile, you need to know the index of the element though.
FreeFry Posted March 28, 2008 Posted March 28, 2008 (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 March 28, 2008 by FreeFry
ajdicky Posted March 28, 2008 Author Posted March 28, 2008 What if theres 2 forms on 1 page?theres 2 forms and 2 same index number what do i do with that?=\
FreeFry Posted March 28, 2008 Posted March 28, 2008 (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 March 28, 2008 by FreeFry
ajdicky Posted March 28, 2008 Author Posted March 28, 2008 (edited) argh..i tried both but the script would just end right away~i'll try to figure it out myself ~thxbtw 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 March 28, 2008 by ajdicky
FreeFry Posted March 28, 2008 Posted March 28, 2008 Oh, sorry, just paste the code in your address field, and press enter.
ajdicky Posted March 28, 2008 Author Posted March 28, 2008 thanks for everything:)oh and could you help me with this too?I'm trying to get the loop run base on the textbut 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) ThenWhile 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
FreeFry Posted March 28, 2008 Posted March 28, 2008 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.
ajdicky Posted March 28, 2008 Author Posted March 28, 2008 ah ok thanks~i'll try thatthe site is a text based game it requires signing up to get in but if you want here the linkhttp://www2.dark-warriors.net/register.php?ref=8992
FreeFry Posted April 1, 2008 Posted April 1, 2008 I'm sorry, but I totally don't understand that site... But did you try my suggestion?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now