PeterPE Posted July 27, 2011 Share Posted July 27, 2011 (edited) I have some issues with setting the cursor in an input field with ie.au3. I tried everything and nothing worked. Here is an example that fails in IE9: #include <IE.au3> ; Create a browser window and navigate to hotmail $oIE = _IECreate("http://mail.yahoo.com") ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "login_form") Local $o_login = _IEFormElementGetObjByName($o_form, "login") Local $o_password = _IEFormElementGetObjByName($o_form, "passwd") Local $username = "your username here" Local $password = "your password here" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) _IEAction($o_password, "focus") The above code works in IE8, but not in IE9. There is no error message either. So it looks like this is an IE9 bug? Or did the API change in IE9? I couldn't anything about this, though? Any ideas? Edited July 28, 2011 by PeterPE Link to comment Share on other sites More sharing options...
Bert Posted July 27, 2011 Share Posted July 27, 2011 Have you set your browser to IE8 mode? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
PeterPE Posted July 27, 2011 Author Share Posted July 27, 2011 Thanks for your quick response. Yes, I did - as mentioned above in my post. And it works in IE8 (or IE9 in compatibility mode which emulates IE7/IE8). My question is how to make it work in IE9. This should be possible, unfortunately I couldn't figure it out (and I usually I am always able to figure it out :-) Link to comment Share on other sites More sharing options...
PeterPE Posted July 28, 2011 Author Share Posted July 28, 2011 (edited) I edited my OP to include an executable example to make it easier to reproduce this problem. Edited July 28, 2011 by PeterPE Link to comment Share on other sites More sharing options...
PeterPE Posted July 28, 2011 Author Share Posted July 28, 2011 There is even an easier example in the help file :-)#include <IE.au3>$oIE = _IE_Example("form")$oForm = _IEFormGetObjByName($oIE, "ExampleForm")Local $oInputFile = _IEFormElementGetObjByName($oForm, "fileExample"); Assign input focus to the field and then send the text string_IEAction($oInputFile, "focus")Send("C:\myfile.txt")Unfortunately the code fails in IE9 (but not IE8). Link to comment Share on other sites More sharing options...
DaleHohm Posted July 28, 2011 Share Posted July 28, 2011 I would guess that this is the same problem as has been uncovered with .click trancexx appears to be on the path to fixing this, so I would expect it in a future beta. 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...
PeterPE Posted July 28, 2011 Author Share Posted July 28, 2011 Yes, indeed same problem. Would you happen to have a link or so :-) Link to comment Share on other sites More sharing options...
PeterPE Posted July 28, 2011 Author Share Posted July 28, 2011 Dale, found the link (didn't find anything with the keyword focus, but with click many :-) I guess we have to wait now for a fix Link to comment Share on other sites More sharing options...
Exit Posted July 28, 2011 Share Posted July 28, 2011 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
PeterPE Posted July 28, 2011 Author Share Posted July 28, 2011 (edited) Thanks (good job!) This is not really a workaround for me, the site doesn't work well with IE8 (no box shadow, or rounded corners, some other css3 doesn't work and so on).Hope the AutoIt devs will be able to fix/adapt the Com Interface soon (the click and focus methods work with everything else. VB and Javascript for example). Edited July 28, 2011 by PeterPE Link to comment Share on other sites More sharing options...
Seldon Posted August 4, 2011 Share Posted August 4, 2011 (edited) In my case, the 'focus' doesn't work even in IE8 compatibility mode for a control (input file), instead the focus is set to the address bar. I'm using the "Focus" and "Send {Space}" trick to open a dialog box. Edited August 4, 2011 by Seldon Link to comment Share on other sites More sharing options...
Seldon Posted August 4, 2011 Share Posted August 4, 2011 A little update... the control seems to get the focus (it changes its color) , but the "Send {Space}" command is sent to the address bar of IE (actually the address bar is cleaned like if I select it and press the space bar). Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 18, 2012 Share Posted February 18, 2012 (edited) Did you ever find a full work around on this? I'm running on a work computer using IE7 (yeah we are a bit behind...) and the focus nor click seems to work. Thoughts? edit: correction - it works if it's in a stand alone short script, but doesn't seem to work in my main program. The only difference between the two is the main program is passing variables to the input box then focusing on submit and hitting space. In the stand alone script - it's just a static value of '42', then focus, then space, etc. Again - the stand alone works perfectly fine 100% of the time. The main program does not. Edited February 18, 2012 by xeroTechnologiesLLC 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