greenmachine Posted February 20, 2006 Share Posted February 20, 2006 All these posts about making a DarkThrone auto-recruiter made me want to try my hand at the task. So I made my own DarkThrone Recruiter. It works beautifully - except for one step. There is an image link on the login page that defies all automation attempts I can think of. The following is a load of information related to said image.That's what it looks like. Simple enough.Form info relating to the image button (single form):Form Name: "" (blank)Form Method: postForm Action: http://www.darkthrone.com/login.dtWhen that form is selected, this is the element info for the 3 elements:Label: "" (blank), Field Name: submit, Type: hidden, Current Value: TRUELabel: "" (blank), Field Name: email, Type: text, Current Value: [email address]Label: "" (blank), Field Name: password, Type: password, Current Value: [password in *]Unfortunately, _IEFormSubmit does not work on this form (tried many times already).Under links (referring to the submit image link):Name: Submit QueryAddress: http://www.darkthrone.com/login.dtType: Form SubmissionTarget: "" (blank)Access Key: "" (blank)_IEClickLinkByText and _IEClickLinkByIndex don't work either, because evidently that isn't considered as a standard link in the document.Under media (referring to the image itself):Address: http://www.darkthrone.com/templates/notlog...tons/submit.gifType: InputAlternate Text: Not Specified (none)Count: 1_IEClickImg doesn't work because it's not a true image - at least that's what it seems.In the source:<form action="/login.dt" method="post"> <input type="hidden" name="submit" value="TRUE"> <div class="box_border" style="width: 250px"> <table width="100%"> <tr> <td colspan="2" class="box_header">Login</td> </tr> <tr> <td class="box_content" width="32%">Email</td> <td class="box_content" width="68%"><input type="text" name="email" style="width: 100%"></td> </tr> <tr> <td class="box_content" width="32%">Password</td> <td class="box_content" width="68%"><input type="password" name="password" style="width: 100%"></td> </tr> </table> </div> <input type="image" src="templates/notloggedin/images/buttons/submit.gif" class="submitImg"> </form>If anyone knows how I can click this image or submit this form without using mouseclicks (as I do currently) or ControlSend/Click (since there's no control ID), please let me know. Link to comment Share on other sites More sharing options...
Valuater Posted February 20, 2006 Share Posted February 20, 2006 i think this will do the trick $oButton = _IEFormElementGetObjByName ($o_SearchForm, "submit") $oButton.click 8) Link to comment Share on other sites More sharing options...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 (edited) Didn't appear to work. Click returned 0, meaning no click. Edited February 20, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Valuater Posted February 20, 2006 Share Posted February 20, 2006 you got this first right??? $o_SearchForm like $o_SearchForm = _IEFormGetObjByName ($o_IE, "LOGIN") ; where"LOGIN" is the NAME of the form...then $oButton = _IEFormElementGetObjByName ($o_SearchForm, "submit") $oButton.click Link to comment Share on other sites More sharing options...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 Feel free to try it yourself. There is no name to the form, I got it by index. There was no point in getting an object by name since I knew the index. Got all the objects I need, tried the click. Nothing. Feel free to prove me wrong though. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 20, 2006 Share Posted February 20, 2006 Feel free to try it yourself. There is no name to the form, I got it by index. There was no point in getting an object by name since I knew the index. Got all the objects I need, tried the click. Nothing. Feel free to prove me wrong though.I think you'll find the background you need here:Internet Explorer Automation UDF library - clicking Image ProblemDale 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...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 Thanks a ton Dale, I was hoping you'd come help. Link to comment Share on other sites More sharing options...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 Double-posting only so people are aware of the new post, because it is almost important (contains useful code). I had to edit it quite a bit to work to what I needed to do. Here's the finished product: $SubmitButtonSource = "templates/notloggedin/images/buttons/submit.gif" $oInputs = _IETagNameGetCollection (_IEDocumentGetObj ($IEObject), "input") For $oInput In $oInputs If $oInput.src <> "" And StringInStr ($oInput.src, $SubmitButtonSource, 0) Then $oInput.click ExitLoop EndIf Next Link to comment Share on other sites More sharing options...
Valuater Posted February 20, 2006 Share Posted February 20, 2006 nice job green.... ( and thanks for trying Valuater ) I am going to add that one to my IE.au3 Demos inside Welcome to AutoIt 1-2-3 thx 8) Link to comment Share on other sites More sharing options...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 (edited) Good point - thanks for your attempt Valuater (too bad the easy way didn't work in the first place). And sorry for the attitude I had after your reply. I respect you trying to help, it's just that I was annoyed that everything I had tried wasn't working. Edited February 20, 2006 by greenmachine Link to comment Share on other sites More sharing options...
FreeFry Posted February 20, 2006 Share Posted February 20, 2006 (edited) You could make use of javascript to do this... send this into the adressbar: java script:void(document.forms[0].submit()) change the 0 to whatever form it is(depending how many forms there are in the page) Edit: Um.. there should be no space between java and script... dunno why it puts a space there... Edited February 20, 2006 by FreeFry Link to comment Share on other sites More sharing options...
greenmachine Posted February 20, 2006 Author Share Posted February 20, 2006 Nice try, but that doesn't work. According to the error received, "the object does not support this property or method." Also, this is the equivalent of doing _IEFormSubmit, which I tried several times, and which failed every time. The code I posted above does work, and that's all I need. Link to comment Share on other sites More sharing options...
FreeFry Posted February 20, 2006 Share Posted February 20, 2006 Oh, I didnt try it I just know it works on must other pages, where there is an form which submits data. I think it doesnt work because of that its using css to submit the data in some way. I'm not into html and such, i just know a little basic javascript. Anyways, good you found something that workt =) Link to comment Share on other sites More sharing options...
DaleHohm Posted February 20, 2006 Share Posted February 20, 2006 Oh, I didnt try it I just know it works on must other pages, where there is an form which submits data. I think it doesnt work because of that its using css to submit the data in some way.I'm not into html and such, i just know a little basic javascript.Anyways, good you found something that workt =)Not CSS, but typically Javascript on the button used to submit -- it is very common these days instead of using the standard form submit action.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...
Andrew Sparkes Posted March 20, 2006 Share Posted March 20, 2006 I hope no one minds me raising this topic from the dead, but I put together greenmachines code and made a function... I don't know if this is in the new IE.au3, but if anyone wants it, it works just like _IEClickImg() ... Func _IEFormClickImg($o_object, $s_linkText, $s_mode = "src", $i_index = 0, $f_wait = 1) $doc = _IEDocumentGetObj ($o_object) $oInputs = _IETagNameGetCollection (_IEDocumentGetObj ($o_object), "input") $found = 0 $s_mode = StringLower($s_mode) For $oInput In $oInputs Select Case $s_mode = "name" $linkText = $oInput.name Case $s_mode = "src" $linkText = $oInput.src Case Else ;; Invalid mode SetError(99) Return 0 EndSelect If StringInStr($linkText, $s_linkText) Then if ($found = $i_index) Then $result = $oInput.click Sleep(500); Allow readystate to change before proceeding If ($f_wait = 1) Then _IELoadWait($o_object) SetError(0) Return 1 EndIf $found = $found + 1 EndIf Next SetError(1) Return 0 EndFunc ---Sparkes. 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