First of all you have to press a control+f on your chrome window and search for a word present on a website.

Then print screen, paste on paint, cut a rectangle about 10x1 pixels of the color orange (you can fine tune this part) from the word highlighted and save this little rectangle as orange.png

This script, when you press control + 1, will click on the first word "notifications" that appear on a site. to click other word or text element just change the third line to the desired string
Code: Select all
^1::
send, ^f
send, notifications
loop
ImageSearch, Foundx, Foundy, 0, 0, A_screenwidth, A_screenheight, *1, orange.png
until ErrorLevel = 0
sleep 100
click, %Foundx%, %Foundy% ; if you are wanting to just wait for the element, dont put this line
return
Advantages over classic imagesearch:
resolution independent
font independent
autoscroll to the first found element
can be ported to any software with find function that highlights the found string
No need to learn com object or complex code
can be used to wait for a text element to appear
you can also do an offset to click something that is not a text:
Code: Select all
^1::
send, ^f
send, notifications
loop
ImageSearch, Foundx, Foundy, 0, 0, A_screenwidth, A_screenheight, *1, orange.png
until ErrorLevel = 0
sleep 100
Foundx := Foundx + 100 ; a 100 pixel offset to the right
Foundy := Foundy + 100 ; a 100 pixel down offset
click, %Foundx%, %Foundy% ; if you are wanting to just wait for the element, dont put this line
return