A friend of mine has recently posted his javascript game online. You first go to the homepage and then you click on a button that brings you to the game.
Something like this when I inspect element:
onclick="playgame()"
When somebody clicks this, a counter increments so he knows how many people have played. He only did this for practice as he doesn't actually expect anyone to play.
I want to surprise him though, by having a script continuously click this button over and over and make him think he has 1000's of plays. He'll love the prank when I tell him ;)
Does anyone know if this is possible? I'm experienced in c#, but from looking online, php seems to be more suitable? I'm 100% open to any other methods Thanks
EDIT: I was looking at something like this
<?php
echo '<script type="text/javascript">'
, 'jsfunction();'
, '</script>'
;
?>
But then I don't know how I will execute this on his website
EDIT 2: Actually seems like python would be the correct option
I am not sure, if this work in your situation, but if you would like to do something x times, you can do it with a loop like in any other language.
For example if you would like to call a function x times, you could do it this way:
function someFunction(x) { console.log(x) }
var iterations = 1000;
for (var i = 0; i < iterations ; i++ ) {
someFunction(i);
}
Infinite
var iterations = 0
while(true) someFunction(iterations++)
Just use simple iteration, make a function like this and run it.
function click1k() {
var clicks=1000;
for (var i=clicks; i>0; i--) {
playgame();
}
}
And run:
click1k();
If it's a website you could use something like iMacros addon for firefox and just record a macro, you can even use js for more complex scripts but a simple loop would do it.
You can trigger that button continuously. Here is the code.
setInterval(function(){
$("Selector").click();
}, 5000);
It will click automatically selected button or any element every 5 seconds. You can increase or decrease the time so it will look real to get play counter in time gaps