Re: How can I automatically click a link if it appears on a given page?

43 views
Skip to first unread message
Message has been deleted

Jian Zhang

unread,
May 8, 2013, 9:24:59 PM5/8/13
to greasemon...@googlegroups.com
var links = document.getElementsByTagName('a');
for(var i = 0; i < links.length; i++){
  if(links[i].innerText == "View Amazon Product Page"){
    links[i].click();
  }
}

在 2013年4月18日星期四UTC+8上午4时23分37秒,helpm...@yahoo.com写道:
<p><a href="http://www.amazon.co.uk/gp/product/B006X03YT0">View Amazon Product Page</a></p>




Obviously the destination URL will vary, but the text will always say "View Amazon Product Page"

So, can I do this in Javascript, please? 

Racking my brain and doing JavaScript tutorials to try and get my head around this. 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages