-3

I want to auto click on this link on a website.

<a href="/wall/withdraw.php?processor=ppp">Withdraw</a>

Thanks!

Umer
  • 15
  • 5
  • what do you mean by auto click – janith Jan 02 '13 at 03:19
  • I mean when a page load contain this link, code will click auto on this link, and proceed further to next page? – Umer Jan 02 '13 at 03:23
  • I want a code like this : setTimeout(function() { document.evaluate("//input[@value='Submit Now' and @type='submit' and contains(@class, 'button')]", document, null, 9, null).singleNodeValue.click(); }, 2000); that will work with it? thanks in advance dear! – Umer Jan 02 '13 at 03:34
  • IIRC, you cannot click on a link programmatically. But you can read the href attribute, and use `window.location.replace` method to load the URL. –  Jan 02 '13 at 03:48
  • @ bvukelic thank, I'm noob, can you please tell me how to add code of window.location.replace with auto clcik code? – Umer Jan 02 '13 at 04:11

1 Answers1

1

You can fire it's click() method.

<a href="/wallet/withdraw.php?processor=ppp" id="foo">Withdraw</a>

document.getElementById("foo").click();

You'll need some way to select the element, I gave it an ID and used getElementById()

sachleen
  • 30,730
  • 8
  • 78
  • 73
  • but I'm not able to edit or add an id in this code, because, this code is not in my site, I just want to click on it, code will click auto on this link, and proceed further to next page? – Umer Jan 02 '13 at 03:28
  • I want a code like this : setTimeout(function() { document.evaluate("//input[@value='Submit Now' and @type='submit' and contains(@class, 'button')]", document, null, 9, null).singleNodeValue.click(); }, 2000); that will work with it? – Umer Jan 02 '13 at 03:33
  • and thanks for your answer, but its not work for me? – Umer Jan 02 '13 at 03:36
  • @Umer you'll have to be more specific than "doesn't work" – sachleen Jan 02 '13 at 03:59
  • thanks very much, dear I'm very noob in coding, I just want to auto click on a html link, and I'm not able to add ID in that link, because I'm not the owner of that site. thanks again bro. – Umer Jan 02 '13 at 04:09
  • You'll need a way to select the element. See http://stackoverflow.com/questions/7266631/selecting-elements-without-jquery for other ways of selecting elements. – sachleen Jan 02 '13 at 04:13
  • ok, thank for your help, I will try something other. Peace! – Umer Jan 02 '13 at 04:28