The webpage's code is as follows :
<div id="content">
<div class="container-fluid">
Slots
<p>The current jackpot is 23220!<p/>
<p>You lose.</p>
<form method=post action=/games/slots.php>
<input type=hidden name='hash_sub' value='MjEzOA=='>
<input type=hidden name='act' value='spin'>
<input type=submit value='Spin again!'>
</form>
<a href='slots.php'>Go Back</a>
</div>
</div>
My code :
setInterval(function solo() {
jQuery('content').children('submit[value="Spin again!"]').click();
}, 1000);
I am not sure what I am missing, the page loads but the button is not clicked at all. There are no console log errors.
You need to use
#
with ID and.find()
instead of.children()
. As.children()
only traverses immediate children where as.find()
will look into descendants.Use
Also when you use
children('submit[value="Spin again!"]')
it looks forsubmit
element with valueSpin again!
.DEMO