Logicwrath Posted February 6, 2008 Share Posted February 6, 2008 I have spent quite a bit of time yesterday developing ways to click on an image link and I am at the point where I would like some help/advice: In the HTML code there is the following DIV: <div id="divPagerNumbers" class="pagerText"> <a id="btnFirst" class="pagerText" href="java script:__doPostBack('btnFirst','')">First Page</a> <input type="image" name="btnPreviousPage" id="btnPreviousPage" class="imgStyle" src="../images/domain/arrow_left.gif" style="border-width:0px;" /> <a id="btnPager1" class="pagerNumber" href="java script:__doPostBack('btnPager1','')">91</a> | <a id="btnPager2" class="pagerNumber" href="java script:__doPostBack('btnPager2','')">92</a> | <a id="btnPager3" class="pagerNumberSel" href="java script:__doPostBack('btnPager3','')">93</a> | <a id="btnPager4" class="pagerNumber" href="java script:__doPostBack('btnPager4','')">94</a> | <a id="btnPager5" class="pagerNumber" href="java script:__doPostBack('btnPager5','')">95</a> <input type="image" name="btnNextPage" id="btnNextPage" class="imgStyle" src="../images/domain/arrow_right.gif" style="border-width:0px;" /> <a id="btnLast" class="pagerText" href="java script:__doPostBack('btnLast','')">Last Page</a> </div> I want to find and click on the: <input type="image" name="btnNextPage" id="btnNextPage" class="imgStyle" src="../images/domain/arrow_right.gif" style="border-width:0px;" /> Right now, I have had limited success using DO move mouse around with logic UNTIL statusbar shows correct text THEN click. The problem the logic I have built for moving the mouse around is complex, unreliable and hard to manage. The image link often moves around and I want something better. example: $xmouse=430 $ymouse=840 Do Sleep(500) MouseMove($xmouse,$ymouse) $ymouse = $ymouse+4 $d = StatusbarGetText("domain.com","",1) If $d = "java script:showWhatsExport();" And $counter=0 Then $xmouse=430 $ymouse=840 $counter=$counter+1 ElseIf $d = "java script:showWhatsExport();" And $counter=1 Then $xmouse=438 $ymouse=840 $counter=$counter+1 Until $d = "selectleads.aspx?bas_type=uxe&bas_vendor=99831" MouseClick("left") This is not my complete code but rather an example that is not working very well right now. Specifically, I would like to find the arrow_right.gif, move the mouse to its location and click. Can anyone assist me? Link to comment Share on other sites More sharing options...
Zedna Posted February 6, 2008 Share Posted February 6, 2008 Use IE UDF. It's AutoIt's standard UDF and you will finf it in AutoIt helpfile also with many examples. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Logicwrath Posted February 6, 2008 Author Share Posted February 6, 2008 Use IE UDF. It's AutoIt's standard UDF and you will finf it in AutoIt helpfile also with many examples.I am not exactly sure what you mean. Are you suggesting using one of the many _IE... functions? I have reviewed them however, I am unclear which _IE function will do what I am looking for. I am not able to get the _IEImgClick to work in this case. Link to comment Share on other sites More sharing options...
Zedna Posted February 6, 2008 Share Posted February 6, 2008 I am not exactly sure what you mean. Are you suggesting using one of the many _IE... functions? I have reviewed them however, I am unclear which _IE function will do what I am looking for. I am not able to get the _IEImgClick to work in this case.Yes I menat this.Just deeply read helpfile and use _IE_Example() as start point.If your image is link then also look at _IELinkGetCollection Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Logicwrath Posted February 6, 2008 Author Share Posted February 6, 2008 Yes I menat this. Just deeply read helpfile and use _IE_Example() as start point. If your image is link then also look at _IELinkGetCollection I dont know how it works exactly. This is why I included the HTML example showing the: <input type="image" name="btnNextPage" id="btnNextPage" class="imgStyle" src="../images/domain/arrow_right.gif" style="border-width:0px;" /> example. None of these work: WinActivate("domain.com", "") $oIE = _IEAttach ("domain.com") _IEImgClick ($oIE, "http://www.domain.com/images/domain/arrow_right.gif") _IEImgClick ($oIE, "arrow_right.gif", "src") _IEImgClick ($oIE, "/images/doimain/arrow_right.gif", "src") $oImgs = _IEImgGetCollection ($oIE) $iNumImg = @extended MsgBox(0, "Img Info", "There are " & $iNumImg & " images on the page") For $oImg In $oImgs MsgBox(0, "Img Info", "src=" & $oImg.src) Next Worse, the image I am looking for in the DIV above arrow_right.gif does not show up in the For loop example I just said didnt work. I can tab 78 times and get the selection focus on the link however, the enter key does not work, it just refreshes the same page. It is like it requires a mouse click. Can I do a MouseMove to the location of the dotted box (focused selection)? This would be perfect I think. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 6, 2008 Share Posted February 6, 2008 input type=image is an odd bird in the DOM. It doesn't act fully like an image, a link or a form element. There is a special function just for it: _IEFormImageClick 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...
Logicwrath Posted February 6, 2008 Author Share Posted February 6, 2008 input type=image is an odd bird in the DOM. It doesn't act fully like an image, a link or a form element. There is a special function just for it: _IEFormImageClick DalePERFECT!Thank you! Link to comment Share on other sites More sharing options...
EscapeTheFate Posted August 11, 2011 Share Posted August 11, 2011 input type=image is an odd bird in the DOM. It doesn't act fully like an image, a link or a form element. There is a special function just for it: _IEFormImageClick DaleHow about submitting input type=image and setting the node / element whichever it is. button.x and button.y - is this impossible, whether through form submit or a POST another way? 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