How to click a button in chrome using applescript?
I know it's website specific, but i'm just having a hard time understanding exactly how the do Javascript function works. For example, say I have this site to vote on and i wanted to run an apple script to basically over vote and make a specific contestant win, how exactly would i run the script (if we forget vote limits due to cookies/ip tracking etc). For example http://www.kraveradio.net/gallery.html is having a voting contest. So if i inspected the element for SUs it says the thumbs up is "i class="rw-ui-like-icon"></i". How would i make sure I get the button for Sus (or a specific contestant) and what would the code be for the button?
I'm familiar with python and not javascript so i'm a little lost! Sorry for the site being NSFW it was the best example i could find!
repeat 1 times
tellapplication "Chrome" toopen location "http://www.kraveradio.net/gallery.html"
delay 3
do JavaScript "document.getElementsByClassName('<i class="rw-ui-like-icon"></i>')[0].click()" in document 2
delay 5
end tell
end repeat
MacBook Air, OS X Mavericks (10.9.2)