AriD Posted February 4, 2012 Posted February 4, 2012 I have a page with a button I need to have AutoIT click for me, but the button doen't have an ID, just a Value. How can I do this?Here's the html:<link rel="stylesheet" href="style.css" type="text/css"><title>Reset</title> <form name="resetform"><table border="0"><tbody><tr><td class="header"><strong>Reset</strong> </td></tr><tr><td class="small"><strong>Warning! Resetting the system will terminate all network connections and reset your browser connection.</strong></td></tr><tr><td><hr></td></tr><tr> <td><input class="button" value=" Reset System " onclick="onReset()" type="button"> & nbsp; <input class="button" value=" Restore Factory Default Settings and Reset System " onclick="onRestoreReset()" type="button"></td></tr></tbody></table></form> <form name="hform" method="POST"><input name="CLEARCONFIG" value="" type="hidden"> <input name="RESET" value="NORMAL" type="hidden"> </form>The relevant line appears to be: <input class="button" value=" Reset System " onclick="onReset()" type="button">I need to click on the button with the value " Reset System " (and not the "Restore Factory Default")So, I've tried this (from a ) with no luck yet:$oButtons = _IETagNameAllGetCollection($o_IE, "button") For $oButton in $oButtons If String($oButton.value) = " Reset System " Then _IEAction($oButton, "click") ExitLoop EndIf NextIs there a way to accomplish this button press?Thanks,Ari
DaleHohm Posted February 4, 2012 Posted February 4, 2012 There could be other conditions expected in the Javascript bound to that button (on MouseOver, for Example). See the second example for _IEAction for another approach. 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
AriD Posted February 4, 2012 Author Posted February 4, 2012 (edited) Thank you for the suggestion. I think the problem here is that these functions all get form objects by name. The web page does not give the buttons "names", just some text. So the second example in the _IEAction help doesn't work for me.I also tried$oForm = _IEFormGetObjByName ($o_IE, "resetform") _IEFormSubmit ($oForm)but this did not work either. Edited February 4, 2012 by AriD
DaleHohm Posted February 4, 2012 Posted February 4, 2012 You're missing the whole point of that example. You need to study the second half of it. If it isn't clear to you what to do, you need to spend more time studying and playing with other examples first. 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
langtudongnai45 Posted October 26, 2012 Posted October 26, 2012 I have this problem too. pls help me!!! <label class="layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge" for="utydruc2"><input value="Share Photo" type="submit" id="utydruc2"></label> Id is alway change !! How can i click button with Value ??
6105 Posted October 26, 2012 Posted October 26, 2012 I have this problem too. pls help me!!! <label class="layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge" for="utydruc2"><input value="Share Photo" type="submit" id="utydruc2"></label> Id is alway change !! How can i click button with Value ?? $oIE = _IECreate('D:DropboxProjectsau3IE_Buildertest.html') $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs $newID = $oInput.id Next ConsoleWrite('New ID = ' & $newID) [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
ileandros Posted October 27, 2012 Posted October 27, 2012 (edited) Local $test $oButtons = _IETagNameAllGetCollection($o_IE, "input") For $oButton in $oButtons If String($oButton.value) = " Reset System " Then $test = $oButtons _IEAction($test, "click") ExitLoop Next Edit: Oups didnt saw the date Edited October 27, 2012 by ileandros I feel nothing.It feels great.
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