jkm Posted October 25, 2006 Share Posted October 25, 2006 Hi, I am trying to reboot a device from a embedded web. But when pressing the reboot button, it gives me a control I have not been able to handle. This I found in the html source: <input name='submit' type='submit' value='Reboot' onclick="java script:return confirm ('Are you sure you want to reboot?')"' /> It gives a "control" with the title "Microsoft Internet Explorer" and 2 buttons (OK and Cancel). I am not able to figure out how to click these buttons. I have been using the Autoit3 for a while now and have so far been able to solve the problems by looking in this forum, but this one is challenging me. Might be one of the you have a solution. Any ideas?? Br /jkm Btw I use the IE.au3 for html interaction. Link to comment Share on other sites More sharing options...
DuncanM Posted October 25, 2006 Share Posted October 25, 2006 jkm - I am having the exact same problem. I have posted several questions but have yet to come up with an answer. I'm desperate to get this working! Link to comment Share on other sites More sharing options...
iamthetboz Posted October 25, 2006 Share Posted October 25, 2006 I am also stuck on the same thing. I can't get any IE commands to click any of the links created by javascript. I can set element values but can't get forms to submit. Link to comment Share on other sites More sharing options...
DaleHohm Posted October 25, 2006 Share Posted October 25, 2006 (edited) I am also stuck on the same thing. I can't get any IE commands to click any of the links created by javascript. I can set element values but can't get forms to submit.I don't believe that what you are saying is the same, actually is the same as what the previous two posters mention. If you have HTML that is actually being generated by Javascript, then your biggest challenge is likely that View Source will not show it to you and that you need to use _IEBodyReadHTML() to see it. Please open a separate post to discuss this in the V3 support forum.DaleEdit: typo Edited October 25, 2006 by DaleHohm 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 More sharing options...
DaleHohm Posted October 25, 2006 Share Posted October 25, 2006 @jkm, @duncanmPlease look through these posts for starters:http://www.autoitscript.com/forum/index.php?showtopic=32162http://www.autoitscript.com/forum/index.php?showtopic=32216http://www.autoitscript.com/forum/index.php?showtopic=29518http://www.autoitscript.com/forum/index.php?showtopic=26872Assuming you're talking about dealing with popups, there are techniques and descriptions of the challenges faced.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 More sharing options...
DuncanM Posted October 26, 2006 Share Posted October 26, 2006 @jkm, @duncanmPlease look through these posts for starters:http://www.autoitscript.com/forum/index.php?showtopic=32162http://www.autoitscript.com/forum/index.php?showtopic=32216http://www.autoitscript.com/forum/index.php?showtopic=29518http://www.autoitscript.com/forum/index.php?showtopic=26872Assuming you're talking about dealing with popups, there are techniques and descriptions of the challenges faced.DaleHi Dale - thanks for your suggestions. I have tried using Send, ControlClick, etc, but nothing seems to have any effect on the dialog box. Am I missing something simple here? Link to comment Share on other sites More sharing options...
jkm Posted October 26, 2006 Author Share Posted October 26, 2006 Hi Dale, Thanks for replying. I will have a look at the suggested threads. However I also tried the controlclick and send. I also tried winactivate("Microsoft Internet Explorer") and then send("{ENTER}"), but the popup is not encountered, and the au3 script will not continue until I press OK or Cancel. I will read the threads to see if it could provide the solution. /jkm Link to comment Share on other sites More sharing options...
jkm Posted October 26, 2006 Author Share Posted October 26, 2006 Hello again, did some test. No luck. I also used the AdlibEnable, but this is not responding when the "popup" is activated. It is like the au3 script stops until the ok or cancel is selected. Also I had no luck by giving focus and send("{ENTER}") /jkm Link to comment Share on other sites More sharing options...
DuncanM Posted October 26, 2006 Share Posted October 26, 2006 Hello again,did some test. No luck.I also used the AdlibEnable, but this is not responding when the "popup" is activated. It is like the au3 script stops until the ok or cancel is selected.Also I had no luck by giving focus and send("{ENTER}")/jkmI'm having the exact same results.. Link to comment Share on other sites More sharing options...
DaleHohm Posted October 26, 2006 Share Posted October 26, 2006 Sorry, "had no luck" is of no value as feedback if you are serious about getting help. Neither is "I'm having the exact same results". 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 More sharing options...
DuncanM Posted October 26, 2006 Share Posted October 26, 2006 Sorry, "had no luck" is of no value as feedback if you are serious about getting help. Neither is "I'm having the exact same results".DaleThe net result is that I'm unable to interact with the dialog box. I have a references to the form and the element (i.e. the RESET button) created, no problem. I then, using one of the suggestions from the links you included, use _IEAction, set focus to the element reference. However, when the dialog box appears, nothing I send to it will allow me to select OK or CANCEL - rather, it the script pauses until you manually click one of the 2. Also, none of the Window commands (WinWait, WinExists, etc.) work on the dialog box. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 26, 2006 Share Posted October 26, 2006 The net result is that I'm unable to interact with the dialog box. I have a references to the form and the element (i.e. the RESET button) created, no problem. I then, using one of the suggestions from the links you included, use _IEAction, set focus to the element reference. However, when the dialog box appears, nothing I send to it will allow me to select OK or CANCEL - rather, it the script pauses until you manually click one of the 2. Also, none of the Window commands (WinWait, WinExists, etc.) work on the dialog box.These have always been problems with java scripts, more than likely neither of the buttons have focus.Many times the text on the window has focus.Experiment with Send("{TAB}") and see if one of the buttons gets focus.Even with out a script you can do the same thing, wait for the screen to appear, don't use the mouse.Use the tab to determine how many tabs is needed to give the correct button focus. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DuncanM Posted October 26, 2006 Share Posted October 26, 2006 These have always been problems with java scripts, more than likely neither of the buttons have focus.Many times the text on the window has focus.Experiment with Send("{TAB}") and see if one of the buttons gets focus.Even with out a script you can do the same thing, wait for the screen to appear, don't use the mouse.Use the tab to determine how many tabs is needed to give the correct button focus.Sorry, should have mentioned, I've tried sending ("{TAB}") in different combinations before ({ENTER}), and nothing has had any effect on the dialog box. Oddly enough, the active window tool does recognize it and each of the (OK/CANCEL) buttons, yet ControlClick doesn't work either! Frustrating.. Link to comment Share on other sites More sharing options...
DaleHohm Posted October 26, 2006 Share Posted October 26, 2006 I suggest you construct a reproducer and show all of your code. If you start with the examples for _IEFormSubmit, they will produce an alert box that will pause the script in this way - although it simply has an OK button. 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 More sharing options...
jkm Posted October 27, 2006 Author Share Posted October 27, 2006 Hi Dale, Sorry about the "had no luck" comment. I was just trying to tell what I did. Anyway I will try to be more precise in the future, because I surely would appreciate your help and guidance on this one. I can reproduce the situation with this piece of html: ------- <html> <form action='admin.cgi' method='post' enctype='text' name='reboot'> <input name='reboot' type='hidden' size='' value='0' /> <input name='submit' type='submit' value='Reboot' onclick="java script:return confirm ('Are you sure you want to reboot?')"' /> </form> </html> ------- I have saved it as testjavascript.html(I can open it on my local webserver: "http://localhost/test/testjavascript.html"), and then I use this au3 code to: ----- #include <IE.au3> main() Func main() web_reboot() EndFunc Func web_reboot() $o_IE = _IECreate () $URL = "http://localhost/test/testjavascript.html" ;open browser _IENavigate ($o_IE, $URL,0) _IELoadWait($o_IE) $o_form = _IEFormGetObjByName($o_IE, 'reboot') $o_Button = _IEFormElementGetObjByName($o_form, "submit") AdlibEnable("clickonthatpopup") $o_Button.click ; here it stops until I press one of the buttons. AdlibDisable() EndFunc Func clickonthatpopup() MsgBox(0, "info", "all I want is to click the popup") If ControlFocus("Microsoft Internet Explorer","OK",1) Then Send("{ENTER}") ;ControlClick("Microsoft Internet Explorer", "", "Button1") EndIf EndFunc -------------- Br /jkm Link to comment Share on other sites More sharing options...
BitRot Posted October 27, 2006 Share Posted October 27, 2006 I can reproduce the situation with this piece of html:I've tested that HTML and AI-code on my system (still running Win98), and did not encounter any problems (although I did change the "http://" url to a "file://" one). Have you checked if that "$o_Button" actually returns an object ? Allso, have you tried a short delay between loading the page and trying to access its contents ? Link to comment Share on other sites More sharing options...
jkm Posted October 27, 2006 Author Share Posted October 27, 2006 I inserted the: $o_Button = _IEFormElementGetObjByName($o_form, "submit") MsgBox(0, "info","Button: " & $o_Button) And it returns: The problem is not to press the reboot button on the web page, but to press the button on the popup. /jkm Btw. I am using win XP and IE 6.0... Link to comment Share on other sites More sharing options...
DaleHohm Posted October 27, 2006 Share Posted October 27, 2006 Unfortunately, you missed one of the key points in all of those posts you read. You need to replace: $o_Button.click ; here it stops until I press one of the buttons.oÝ÷ Û«¢+Ù}%Ñ¥½¸ ÀÌØí½} ÕÑѽ¸°ÅÕ½Ðí½ÕÌÅÕ½Ðì¤)M¹ ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤ 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 More sharing options...
BitRot Posted October 27, 2006 Share Posted October 27, 2006 (edited) The problem is not to press the reboot button on the web page, but to press the button on the popup.... and neither is the problem that. What is the problem is that the "$o_Button.click" does not seem to want to return, untill you've answered the pop-up. <grrr...> While looking for an answer, I tested if I could retrieve the "onclick" contents. All I got was a single question-mark. :mellow. At a hunch I thought that the following could maybe work : $o_Button.onclick="" And yes, it did : no popup-confirmation coming-up anymore <Yeah!> That solves two problems in one stroke : a "click" not returning, and a popup-box that needs to be clicked on. This is the code I've used : Func web_reboot() $o_IE = _IECreate ("http://localhost/test/testjavascript.html") $o_form = _IEFormGetObjByName($o_IE, 'reboot') $o_Button = _IEFormElementGetObjByName($o_form, "submit") $o_Button.onclick="" $o_Button.click EndFuncHope that helps. @DaleHolm: Unfortunately, you missed one of the key points in all of those posts you read. You need to replace: <snip>I was looking for a method like that, but got stuck on the thought of moving the mouse to the button and than execute a mouse-left-click. But I think I found another nice way to solve the problem, don't you think ? Edited October 27, 2006 by BitRot Link to comment Share on other sites More sharing options...
DaleHohm Posted October 27, 2006 Share Posted October 27, 2006 Whether this actually produces desirable results depend on what is being done in the onclick script. If it is truly non-essential then clearing it is OK. It may do more elaborate processing however - you must study the code in each case, The code in my previous reply will always work. Dale ... and neither is the problem that. What is the problem is that the "$o_Button.click" does not seem to want to return, untill you've answered the pop-up. <grrr...> While looking for an answer, I tested if I could retrieve the "onclick" contents. All I got was a single question-mark. :mellow. At a hunch I thought that the following could maybe work : $o_Button.onclick="" And yes, it did : no popup-confirmation coming-up anymore <Yeah!> That solves two problems in one stroke : a "click" not returning, and a popup-box that needs to be clicked on. This is the code I've used : Func web_reboot() $o_IE = _IECreate ("http://localhost/test/testjavascript.html") $o_form = _IEFormGetObjByName($o_IE, 'reboot') $o_Button = _IEFormElementGetObjByName($o_form, "submit") $o_Button.onclick="" $o_Button.click EndFuncHope that helps. 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 More sharing options...
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