Amazon auto signup script


Scripts are very powerful as they give us different features with which we can manipulate web apps and websites. Javascript being the most popular scripting language also has these features with which we can manipulate the contents of websites and web apps. In this article, we will make use of simple javascript code(script) which will allow us to fill the Amazon registration form without manually filling in the details. We will make use of JQuery which is a javascript library with which DOM(Document object model) manipulation becomes much easier.

Step 1:

Go to the link: Amazon-Signup and paste the javascript code given below in the Developer tools console window.

Note: To open javascript console in developer tools press Ctrl+Shift+k on windows or Command+Option+K on mac.

How it works:

The code given below will automate the process of amazon signup once you put it inside the web console, with all the values like name, email being picked automatically from the code and then you can edit the phone number section manually and then the password similarly.

filter_none

edit
close

play_arrow

link
brightness_4
code

/*-- Code section 1 --*/
  
javascript: var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
document.body.appendChild(fileref);
   
/*-- Code section 2 --*/
  
// list of names
let nameArr = [
    'Jeevan Rudraraju',
    'Sawan Tasha',
    'Kuberchand Raman Sadaram',
    'Sugriva Ahsen',
    'Deviprasad Muqtedar',
    'Mulkraj Lokesh',
    'Yashodhara Rasiah',
    'Mukul Latiyan',
    'Dushyanta Darsha',
    'Mayank Agarwal',
    'Priyabrata Manavendra Jai',
];
  
// list of emails
let emailArr = [
    'ishanimalavika1561@yourdomain.com',
    'gautambibekchinmay4851@yourdomain.com',
    'amshulaharku841651@yourdomain.com',
    'immukullatiyan@yourdomain.com',
    'vidyacharanhariramraviram55686@yourdomain.com',
    'siddhikusagra948151@yourdomain.com',
    'lakshavenkateswaran6815531@yourdomain.com',
    'lalitamohanapujitasaibal651124@yourdomain.com',
    'vedivarahabhotla5451521@yourdomain.com',
    'janakiraviprabhashreeyash8415@yourdomain.com',
];
   
/*-- Code section 3 --*/
  
let ranName = nameArr[Math.floor(Math.random() * nameArr.length)];
let ranEmail = emailArr[Math.floor(Math.random() * emailArr.length)];
console.log('script ran');
  
/*-- Code section 4 --*/
  
$("#ap_customer_name").value = ranName;
$("#ap_email").value = ranEmail;
$("#ap_password").value = 'mypass';
$("#ap_phone_number").value = '805'; // Enter your own valid phone number
setTimeout(function () {
    $("#ap_phone_number").focus();
}, 8000);

chevron_right


Explanation:

The above code is divided into four sections(1-4) with each doing different things.
Section 1:
The first section is about creating a DOM element which we name as ‘script’ and then set the ‘type’ and ‘src’ of this element using the DOM setAttribute() method which adds the specific attribute to an element, and gives it the specified value. This element is basically the script which we are trying to run(jQuery code) and in the last line of this section, we append this element into the DOM body.
Section 2:
The second code section contains two arrays ‘nameArr’ and ’emailArr’ which contains several names and emails which we can iterate over and randomly choose values from. These randomly choosen magic takes place in code section 3, while the assigning to the DOM in code section 4.
Section 3:
In this section we are making use of Math.floor() and Math.random() methods provided by the Math Object in javascript. Math.random() method is used to return random numbers or elements from an array, notice we are multiplying it to the array length so that it covers the entire array. Then we make use of Math.floor() method which is to round off. Then we assign the values obtained to a variable which we will later pass to the DOM elements which will ultimately get inserted into the form.
Section 4:
In the last code section, we are basically assigning values to the DOM elements that we extract using the JQuery ‘$’ sign which demands a selector inside it and then it performs some action on it. Here we are just selecting and assigning values and then finally a setTimeout() method.

Output:



My Personal Notes arrow_drop_up

Competitive Programmer, Full Stack Developer

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.