PoojaKrishna Posted September 8, 2011 Share Posted September 8, 2011 Hi, I'm trying to click on a button on IE but I failed to do so using IEAction and IEFormSubmit. I'm trying to click on the 'Login' button on URL: https://briefing.met.ie/login.php. Please see the source code of page below <form id="login" action="./login-result.php" method="post"> <div class="section"> <h1>Authentication</h1> <div id="login_section"> <p> <input type="hidden" name="action" value="login"/> <label for="username">Username:</label> <input type="text" id="username" name="username" /> </p> <p> <label for="password">Password:</label> <input type="password" id="password" name="password" /> </p> </div> </div> <div class="section"> <input class="navButton" type="submit" value="Login" /> </div> </form> Is there any specific method to click on button of class navButton? Please help me. Link to comment Share on other sites More sharing options...
JohnOne Posted September 8, 2011 Share Posted September 8, 2011 I suggest you show your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
PoojaKrishna Posted September 8, 2011 Author Share Posted September 8, 2011 Sorry for not posing my code. I'm adding code below. #include <IE.au3> #include <INet.au3> #RequireAdmin Global $oIE ;IE object. Global $sURL = "https://briefing.met.ie/local.php" ;URL Global $sUserName = "Pooja" ;Login name Global $sPassword = "Pooja" ;Login password $oIE = _IECreate ($sURL,1) ;Create IE $o_form = _IEFormGetObjByName ($oIE, "login") ;login form $o_login = _IEFormElementGetObjByName ($o_form, "username") ;Handle to UserId input $o_password = _IEFormElementGetObjByName ($o_form, "password") ;Handle to Password input _IEFormElementSetValue ($o_login, $sUserName) ;Set user name _IEFormElementSetValue ($o_password, $sPassword) ;Set password $oLoginBtn = _IEFormElementGetCollection ( $o_form , 3 ) ;Get Login button object _IEAction ($oLoginBtn, "focus") ;Set focus on Login button => Does not work _IEAction ($oLoginBtn, "click") ;Click the button => Does not work _IEFormSubmit ( $o_form) ;Submit login form => Does not work _IELoadWait ($oIE) ;Wait until page loads Link to comment Share on other sites More sharing options...
DaleHohm Posted September 8, 2011 Share Posted September 8, 2011 You should better define what you mean by "does not work". Also, if IE9, try putting the page in compatability mode first to see if you get a different result. 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...
JohnOne Posted September 8, 2011 Share Posted September 8, 2011 I had a little go, trying to do it with a sneaky send enter but it never worked. I see the navbutton is in a different class, maybe that has something to do with it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
PoojaKrishna Posted September 9, 2011 Author Share Posted September 9, 2011 Hi, Dale, thank you so much. I added the site to view in compatibility mode through Tools-> Compatibility view settings and it worked. Thanks friends for your help. Regards, Pooja. 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