views:

49

answers:

3

So I'm trying to debug my website... basically what I need to do is write a script that will periodically follow a link on my page, but I need to see the result in my browser which is why I need it to happen in the browser. I want it to click on the same link every few seconds without any human interaction. The resulting page each time will have the same structure as the last, so the link will have the same attributes and everything... which leads me to think I can probably use Javascript for this task, but I'm not sure how. Maybe greasemonkey in firefox? The problem is the only language I'm any good at is PHP and I can't think of any solution using that. One thing I'd like to do with it is make it do it at pseudo-random intervals... like between 15 seconds and 60 seconds... That's why I think I need a script rather than an existing program or something... So if anyone has any ideas, thanks!

A: 

Yes, you can auto-click link (and do a lot more) with really cool addon of firefox iMacros. The good thing about this addon is that it is really easy to use, you just record a macro and that's it, no coding required for the basic tasks.

iMacros website for more about it.

Sarfraz
Ah, this looks perfect. I remember reading about this addon a while ago, but I don't remember why I never installed it. Any idea how I could make it operate at random intervals though?
RobHardgood
@RobH: you can see its documentation, it is fairly easy to use. thanks
Sarfraz
+1  A: 

You can use Firebug with automation.

Am
+1  A: 

You can also use JavaScript to refresh the page automatically after a given time period. Here, we are refreshing the page 5 seconds after the page loads. This results in the page continuously refreshing every 5 seconds.

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>
Petah