Search the Community
Showing results for tags 'html link'.
-
Hi Guys, As I am still finding my feet with AutoIT, I thought that I would do a quick test. I therefore created some HTML code to create a small yellow non-functioning test button on a web page. <td><div class="wg-button"><a style="position:relative" href="javascript:void(1)"><img src="button.png" alt=""> <span style="position:absolute;left:17px;top:31px; cursor:pointer; width:126px;">TEST</span></a></div></td> I then tried to see if AutoIT could detect if I clicked on the button link. #include <Misc.au3> #include <Msgboxconstants.au3> LOCAL $sPos LOCAL $sColor LOCAL $sYellow = "#FFFF00" While 1 $sPos = MouseGetPos() $sColor = Hex(PixelGetColor($sPos[0], $sPos[1])) $sColor = "#" & StringMid($sColor,3) ToolTip($sColor) If (_IsPressed("01") = True) And ($sColor = $sYellow) Then MsgBox (262144,"Found it","X=" & $sPos[0] & " Y=" & $sPos[1]) EndIf Wend The code correctly detects when I click on the button. However, it also highlights on anything else yellow (e.g. a yellow background) that I click on, not just the button. I did change the link from "empty" to "www.google.com" and then checked if the current browser URL changed also, thereby indicating that I clicked on a yellow link rather than just a yellow background. That worked fine. However, as it is about improving my knowledge of AutoIT rather than for a specific project, can anyone think of another way which I could do it? Detecting a URL change is fine, but I then end up on a new page i.e. www.google.com. I would like to see if I can do it without changing the size. Any ideas? Many thanks, Pete
- 2 replies
-
- html link
- mouse click
-
(and 1 more)
Tagged with: