hisky Posted May 29, 2006 Share Posted May 29, 2006 Hi, I am new around here . Using IE.au3 for browser automation. However could not get over drop-down menu and browser alert boxes Can anybody help on how to do that ? For dropdown : htm content goes like this <select name="Drop" id="DropDown" onchange="Select()"> <option value="0">Something goes here</option> </select> For browser alerts : No clue Link to comment Share on other sites More sharing options...
DaleHohm Posted May 29, 2006 Share Posted May 29, 2006 Hi,I am new around here . Using IE.au3 for browser automation.However could not get over drop-down menu and browser alert boxesCan anybody help on how to do that ?For dropdown :htm content goes like this<select name="Drop" id="DropDown" onchange="Select()"> <option value="0">Something goes here</option></select>For browser alerts : No clueUsing IE.au3 T2.0, look at _IEFormElementOptionselect() for the drop down. Look at _IEAttach("window title", "embedded") for the alert.Give it a shot and post some code you've tried and you'll get more help...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...
hisky Posted May 29, 2006 Author Share Posted May 29, 2006 Thanks for reply Dale, First problem is sorted out, tried out _IEFormElementOptionselect() , was not to effect yet.. followed the lead and used _IEFormElementSetValue() $value =1 $get_object=_IEFormGetObjByName ($browser,"Form") $select= _IEFormElementGetObjByName ($get_object,"Select Name") _IEFormElementSetValue($select,$value) And it worked !! ----------------------------------------------------------- But the alert window problem is still not solved.. Aim is to close it with "OK"/"Cancel" available in Alert. Alert has no sub-string to it and has default browser "Microsoft Internet Explorer" as name and The parent window has same string in name too "Application-Microsoft Internet Explorer".. Is this cause of problem ? Still I tried with $window=_IEAttach("Microsoft Internet Explorer","Embedded") ;tried with "Dialog box" too $ST=ControlClick($window,"OK",0) ;Not sure if _IEAction () could be used here ? Link to comment Share on other sites More sharing options...
DaleHohm Posted May 29, 2006 Share Posted May 29, 2006 I didn't quite follow your Select scenario, but I'm glad it worked. If your goal with the alert window is simply to click OK or Cancel, there are two ways to go about it. One is using IE.au3 functions and the other is using standard AutoIt functions. With standard AutoIt functions, using WinActivate() and then Send to send Enter keystroke of the window. This may be the easier way to go. Using IE.au3 you need to experiment with using _IEAttach to get a connection to it. With the the embedded or dialogbox options you can send either the window title or an HWND. 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...
hisky Posted June 14, 2006 Author Share Posted June 14, 2006 Hi, Thanks Dale for suggestion . Tried different options but no luck, issue seems to be related to modal status of alert box Did trials with both IE controls and with GUI, but issue is that script keeps waiting for action in parent window, where as access to that window is not possible as Alert window is modal So what ever I write _IEActivate, _IEAction or WinActivate, the controls keep on waiting in parent window How to take controls out of parent window, without closing it ? Thought timeout might help here, but no luck till time Link to comment Share on other sites More sharing options...
DaleHohm Posted June 14, 2006 Share Posted June 14, 2006 Hi, Thanks Dale for suggestion . Tried different options but no luck, issue seems to be related to modal status of alert box Did trials with both IE controls and with GUI, but issue is that script keeps waiting for action in parent window, where as access to that window is not possible as Alert window is modal So what ever I write _IEActivate, _IEAction or WinActivate, the controls keep on waiting in parent window How to take controls out of parent window, without closing it ? Thought timeout might help here, but no luck till timeAs you have found out, the alert box is causing your script to pause. You need to activate the button or whatever it out outside of the DOM so that your script can continue. You can do this using SEND or ControlSend. Here is an example that will work with T2.0: #include <IE.au3> $oIE = _IE_Example("form") $oForm = _IEFormGetObjByName($oIE, "ExampleForm") $oSubmit = _IEFormElementGetObjByName($oForm, "submitExample") $oSubmit.focus SEND("{Enter}") WinWait("", "ExampleForm Submitted") ControlClick("", "ExampleForm Submitted", "Button1") ; Replace the SEND command with this if you need to do this without the browser having focus ControlSend(_IEPropertyGet($oIE, "hwnd"), "", "Internet Explorer_Server1", "{Enter}") Note that there are different types of modal dialogs. The one above is NOT HTML, but rather a standard Win32 window that can be controlled with standard AutoIt functions. Use "AutoIt Window Info" to look at the dialog and if it shows a control of "Internet Explorer_Server1", it is an HTML browser window that you can attach to with _IEAttach using the "dialogbox" mode, if it does not (as this one), it uses standard window controls. 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...
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