Typing and Click Simulation - using jQuery - Automatic Form Submission

simulation-typing-javascript

Sometimes when we try to automate a human like behavior on a web page using scripts, we have to trigger the events such a clicks and keyboard pressing events (i.e. keypress, keydown, keyup). This task can be accomplished using plain JavaScript OR jQuery. In this demonstration, i am using both JavaScript and jQuery for accomplishing this goal because it makes it easier.

Goal of the typing simulation script

I am to write a script which will fill with a typing simulation and submit the "Feedback / Contact" form automatically provided below. The user have to click on the buttons given in this blog post section to start the event. Firstly, i will make a self executable function which will contain all the function and it will run when document (this page) is completely loaded in browser.

$(document).ready(function(){
  //code goes here
});

I have provided four buttons in this post which shall act as a trigger for firing the events. The first will simulated the name entry in the feedback form. The Second will simulated the email id part of the same. The third will fill the message part of the form which is also mandatory. Finally the fourth will trigger the click on send button to submit the form.

Mission Control (works only in desktop mode)
Name Email Message Send
{contactform}

Attaching event listeners

Now it's time to attach event listeners to the above four button which will call the respective functions to simulate event when clicked. For this, i have assigned each button an unique ID being nameBut, emailBut, msgBut and sendBut. To attach an event listener using jQuery follwing code is used.

$(document).ready(function(){
  $("#nameBut").on("click",function(){
      //Code to type name goes here
  });
  $("#emailBut").on("click",function(){
      //Code to type email goes here
  });
  $("#msgBut").on("click",function(){
      //Code to type message goes here
  });
  $("#sendBut").on("click",function(){
      //Code to simulate click
  });
});
  

At this point, we need a function which is capable of taking an string input as argument and simulate keypress for each and every character one by one. In order to make it look like an automated typing bot, we have to include some kind of delay in between the two keypress event OR keydown event. So, the function i came up with looks like this.

function type(i, charToType, target){
	setTimeout(function(){
	target.dispatchEvent(new KeyboardEvent('keypress',
	{'key':charToType}));
	}, 200 * i);
}
function typeSetter(data, target){
	target.focus();
	target.addEventListener('keypress', (event) => {
	target.value += event.key;
	});
	for(var i = 0; i<data.length; i++){
		type(i, data[i], target);
	}
}
  

So, using above, if i pass a string and target (which is the ID of the element on which typing has to situlated) to the typeSetter function, it will first put cursor on that element and further adds an event listener for keypress event. Whenever a key is simulated OR physically pressed, the listener will add the pressed key to the value of the target element. The reason to add listener here is that we can't simulate actual keypress or keydown events using JS or jQuery due to security limitation. Now its time to store the values which are to be typed in variables alongwith IDs of the target elements for further use in this script.

var name = "A Person Passing By :)";
var email = "abc@example.com";
var message = "Wow, it works!!";
var nameField = $("#ContactForm1_contact-form-name")[0];
var emailField = $("#ContactForm1_contact-form-email")[0];
var msgField = $("#ContactForm1_contact-form-email-message")[0];
  

Most of the things are done at this point, we just need to call the typeSetter function with relevant arguments when above given trigger / buttons are click. Finally for simulating a click event on send button we need one more line of code. So, here goes the final version.

$(document).ready(function(){
    var name = "A Person Passing By :)";
    var email = "abc@example.com";
    var message = "Wow, it works!!";
    var nameField = $("#ContactForm1_contact-form-name")[0];
    var emailField = $("#ContactForm1_contact-form-email")[0];
    var msgField = $("#ContactForm1_contact-form-email-message")[0];
    function type(i, charToType, target){
        setTimeout(function(){
            target.dispatchEvent(new KeyboardEvent('keypress',
            {'key':charToType}));
        }, 200 * i);
    }
    function typeSetter(data, target){
        target.focus();
        target.addEventListener('keypress', (event) => {
            target.value += event.key;
        });
        for(var i = 0; i<data.length; i++){
            type(i, data[i], target);
        }
    }
    $("#nameBut").on("click",function(){
        typeSetter(name, nameField);
        $("#nameBut").off("click");
    });
    $("#emailBut").on("click",function(){
        typeSetter(email, emailField);
        $("#emailBut").off("click");
    });
    $("#msgBut").on("click",function(){
        typeSetter(message, msgField);
        $("#msgBut").off("click");
    });
    $("#sendBut").on("click",function(){
        $("#ContactForm1_contact-form-submit").trigger("click");
        $("#sendBut").off("click");
    });
});
  
Give it a try and comment down below to share your experiments and improvements of this script & don't spam me using the triggers, please 😁. Happy Coding!! {alertSuccess}

93 Comments

  1. Sir can't we hack Nitro type using inspect element and the local storage , I was able to make me gold and have any car but before qualifying race , I clicked on race and I found myself gold and with Gotham but after qualifying race the data is not being saved.. I have given the hack on YouTube also but unscripted for you and some other NT hackers so that you can modify that so sir if you one time check that will be a matter of respect for me as only you can make that hack permanent
    The link is:-https://youtu.be/7MVEiDWSq0c
    A lot of respect and love for you from Bengal you are the pride of india

    ReplyDelete
    Replies
    1. Great work buddy, it looked into it and find out that it will work visually only.. No way to push these values on server. However, we can use it to give our profile NT gold feeling. I will am a video about it and give you credit. Thanks for figuring it out.

      Delete
  2. No no sir I am happy that you have seen my video that's my credit☺☺ and no need to give me credit as I don't have any wish of YouTube channel I just want that I could inform you so that you can modify them �� and the credit fully goes to who make the video so you can remove the credits sir. I just want to be little rich on NT ☺☺ , and my credit will be having someone great like you in my friend list ❤❤..
    My user name :- jyotiprasadjpc
    Thank you sir for making the video .. no need to give me credit I just love and respect you☺☺ and sir I am participating in the giveaway������

    ReplyDelete
  3. Sir thank you so so so much sir you are so great and so kindhearted sir means I have no word to thank you sir .. means you made my dream true sir thank you so so much sir.. Sir I am now looking through the inspect element and have found a quite things in the application tab then frame section top then scripts and then ga.js there are all things like cash scripts if you say sir I will make a private video about it

    ReplyDelete
    Replies
    1. I just created a discord server for discussing things about NT. Here is the link - https://discord.gg/ZtUvTxB will invite Ginfio also. It would will easy to share code etc on discord.

      Delete
  4. Ok I clicked in the discord now what I will do??

    ReplyDelete
    Replies
    1. i can't see you in chat,, complete the log in process and join server using this link https://discord.gg/eS9mNt

      Delete
  5. Ok I downloaded the discord thank you for giving me an opportunity to join you sir

    ReplyDelete
  6. I did not had the discord it is my first time and it is downloading sir

    ReplyDelete
    Replies
    1. ok buddy, do it. i will be back after dinner.

      Delete
  7. I cant do that? It is riged and it is not working.

    ReplyDelete
  8. Those who are having issues while downloading files. Refresh the page, wait till complete load, click on fetch button, wait for few second, click on Go To Link button, then press download button. For help, DM on discord prRai#5855

    ReplyDelete
  9. awwwww how do i download the auto typer

    ReplyDelete
  10. sad monment i dont even know how to get it whaaat

    ReplyDelete
  11. I don't know how to do it because im dumb and i need help doing it

    ReplyDelete
  12. hmmmmmmmmmmmm but I got banned on my alt account when testing...

    ReplyDelete
  13. my bot would not type
    i folowed every step but when i start the race it doesnt type

    ReplyDelete
  14. I download everything and do it right it says lesson recieved and does not start the race and say mission conpleted and doesn't work pls help

    ReplyDelete
  15. Hello there, i was wondering if this is still in active development, as it has seemed to have stopped working.

    ReplyDelete
  16. I dont know how to start this thing it wont start running

    ReplyDelete
  17. mine will keep stopping after the first lesson,how can i fix that?

    ReplyDelete
  18. how do you do that bot I need your help. I want the gold nitro type my name is trillionaismeandgold plz i need more money and nitro typ gold can you give some nitro type gold

    ReplyDelete
  19. DeFine what "run the executable" In the instructions plz I don't what ur talking about :(

    ReplyDelete
  20. For help dm me on discord prRai#5855 or join this discord server https://discord.gg/jPNAJffjuP

    ReplyDelete
  21. Hey, can you make a version for chromebook, I did it on my dad's windows laptop but can't do it on my chromebook which is what I mainly use.

    ReplyDelete
  22. how do i work this thing

    ReplyDelete
  23. uuum it says that i need to install the newest one why?

    ReplyDelete
  24. i have it but when its done scanning it says download the updated version

    ReplyDelete
  25. It says lesson recieved and then doesn't type at all what do I do?

    ReplyDelete
  26. Hey man! I've been using your bot for a while and it works flawlessly! Just a question, you are a really advanced scripter so would it be possible to make a script so it displays the racers as a higher value while making it seem like your person is racing, whilst you just receive the races as an integer without having to actually race with the bot? Idk if you can but yeah it would be pretty cool!

    ReplyDelete
  27. can someone give me link to discord server please

    ReplyDelete
  28. im on chrome for school and windows is not cmpatible is there another way

    ReplyDelete
  29. getting error on Kali linux:
    ┌──(kali㉿kali)-[~/Downloads]
    └─$ sudo ./nitrotyper
    ./nitrotyper: 1: Syntax error: "(" unexpected

    ReplyDelete
  30. how do i uplode the code.

    ReplyDelete
  31. it didn't let me select my speed, it just put me at 87 WPM

    ReplyDelete
  32. but my average is like 30

    ReplyDelete
  33. how did you get this to work c'mon help if you no

    ReplyDelete
  34. I wanted to do it so i can get some money in my bank account after completing races. I can't get nt gold so I was trying to get some cash from completing races and it doesnt work can u help me out

    ReplyDelete
  35. How do I stop it from disqualifying me mid race? I only get like 10 races done and it disqualifies me. Thanks, A5tro_

    ReplyDelete
  36. sir how do i work the code thingy im new to using cheats and i dont know how to make it work..

    ReplyDelete
  37. I dont have permision to Extract the file

    ReplyDelete
  38. when i double click on the nitrotyper file and it says, "destination file couldnt be created

    ReplyDelete
  39. please give me staps on what to do for i am stuck

    ReplyDelete
  40. it worked fine for about 150 races then it said that

    ReplyDelete
  41. Hey there!
    I can't get past the *download* part, when I click fetch, it takes me to the *download* but when I click it, it loads for a moment and then says *Invalid Request*. My broswer ( Google Chrome ) is up do date although my device is kinda old. I tried it on another laptop and it worked, but it doesn't work on my PC. Its 32bit Windows 7, got anything to do with that?

    ReplyDelete
    Replies
    1. Same - I think the download link for the bot is now broken.

      Delete
  42. Where is version 5.4.0

    ReplyDelete
  43. That is the version we neeeeeeeeeeeeeeeeed

    ReplyDelete
  44. does this work on a Chromebook?

    ReplyDelete
  45. no it doesnt work on chromebook

    ReplyDelete
  46. does it work on dell

    ReplyDelete
  47. yo can you make it possible to do bigger sessions

    ReplyDelete
  48. it's not working for me

    ReplyDelete
  49. how do i install the hack

    ReplyDelete
  50. it dose not work for me

    ReplyDelete
  51. how does this work?

    ReplyDelete
  52. does anyone use this bot for nitro type?

    ReplyDelete
  53. well there goes everything

    ReplyDelete
  54. can i do it on lenovo chromebook

    ReplyDelete
  55. i need the mt but can not find it

    ReplyDelete
  56. wow do you get the ceats

    ReplyDelete
  57. it says out of date

    ReplyDelete
  58. how do i use it and get it?

    ReplyDelete
  59. first comment after a long time
    you guys texted here all the way from 2021
    dang

    ReplyDelete
Post a Comment
Previous Post Next Post