简体   繁体   中英

Why I'm getting errors while writing this javascript autoclicker?

I have just started writing a afk checker bypass for a website running with js but I need help with the code because Im very new in the js. What I want to do: I want to write a script that click when a windows opens or modal I dont know what is it there is two buttons and a timer -I'll write down the code- one of the buttons "Evet" makes me show online and hides the message box and the other button "Hayır" makes me log off so I want to write a script that autocliks the Evet button the timer is 30secs and If you dont click "Evet" in 30 seconds it automaticly clicks "Hayır" and logs off.

here is the box.

 < <div id="musercontrol" class="modal fade" role="dialog" style="display: none;" aria-hidden="true"> <div class="modal-dialog bounceInDown animated"> <div class="modal-content"> <div class="modal-header font-weight-bold text-uppercase d-flex py-3 align-items-center bg-danger text-white"> <div class="mr-1"><svg class="svg-inline--fa fa-id-badge fa-w-12 fa-fw fa-2x py-0" aria-hidden="true" focusable="false" data-prefix="far" data-icon="id-badge" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" data-fa-i2svg=""></svg><!-- <i class="far fa-id-badge fa-fw fa-2x py-0"></i> -->&nbsp;</div> <div class="flex-fill">Orada mısınız ?</div> </div> <div class="modal-body d-block text-justify"> <div class="mb-2">you are afk now</div> <div class="mb-2 text-center font-weight-bold">stay online?</div> <div class="small font-italic text-muted mb-0">counter started.</div> </div> <div class="modal-footer d-flex py-1 align-self-stretch"> <a href="/safe-logoff/" class="btn btn-danger d-flex align-self-stretch text-uppercase"> <div class="align-self-center mr-2"><svg class="svg-inline--fa fa-times-circle fa-w-16 fa-fw" aria-hidden="true" focusable="false" data-prefix="far" data-icon="times-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""></svg><!-- <i class="far fa-times-circle fa-fw"></i> --> &nbsp;Hayır</div> <div class="align-self-center small">(<span id="musercontroltimer" data-seconds-left="30" class="jst-timeout"></span>)</div> </a> <div class="flex-fill"></div> <button type="button" class="btn btn-success text-uppercase" onclick="hidePortalTimeOut()"><svg class="svg-inline--fa fa-check-circle fa-w-16 fa-fw" aria-hidden="true" focusable="false" data-prefix="far" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""></svg><!-- <i class="far fa-check-circle fa-fw"></i> --> &nbsp;Evet</button> </div> </div> </div> </div> <script> var PortalTimeOutStatus=0; var PortalTimeOut=360000; $(function(){setTimeout(function(){showPortalTimeOut();},PortalTimeOut)}); function showPortalTimeOut() { PortalTimeOutStatus=1; $('#musercontroltimer').html(''); $('#musercontrol').modal({backdrop: "static"}); $('#musercontroltimer').startTimer({onComplete:function(){ if (PortalTimeOutStatus==1){location.href='/otomatik-safe-logoff/'}}}); } function hidePortalTimeOut() { PortalTimeOutStatus=0 $('#musercontroltimer').html(''); $('#musercontroltimer').trigger('complete') $('#musercontrol').modal('hide'); setTimeout(function(){showPortalTimeOut();},PortalTimeOut) } </script>

 // ==UserScript== // @name auto click for x // @namespace http://tampermonkey.net/ // @version 3.0 // @description auto click afk check button // @match bad website // @author ace // @grant none // ==/UserScript== window.onload=function ace(){ setInterval(ace,5); } function ace() { document.querySelector(document).ready(function() { document.querySelector("a:contains('Evet')").click(); }); };

I tried this and take error from chrome that is: Error code: "SBOX_FATAL_MEMORY_EXCEEDED"

Edit1: I Changed and removed something for copyrighhts.

Edit 2:

 // ==UserScript== // @name auto click for x // @namespace http://tampermonkey.net/ // @version 3.0 // @description auto click afk check button // @match bad site // @author ace // @grant none // ==/UserScript== window.onload=function ace(){ setInterval(ace,5); } function ace() { document.querySelector(document).ready(function() { var doc = document.querySelector(document).querySelector("a"); doc.each(function() { if (document.querySelector(this).text() == "Evet") { document.querySelector(this).click(); } }); }); };

I tried this one but this gave me nothing on website. Edit 2 end.

Tried this one but also get the exceeded error

 // ==UserScript== // @name auto click for x // @namespace http://tampermonkey.net/ // @version 3.0 // @description auto click afk check button // @match bad website // @author ace // @grant none // ==/UserScript== window.onload=function ace(){ setInterval(ace,5); } function ace() { document.querySelector(document).ready(function() { document.querySelector("button:contains('Evet')").click(); }); };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM