Coding a Checkout Bot - From Beginner To Professional | Ritesh Verma | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Coding a Checkout Bot - From Beginner To Professional

teacher avatar Ritesh Verma, Bot Developer | YouTuber | Student

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

13 Lessons (57m)
    • 1. Welcome to the Class

      0:54
    • 2. Installation

      3:30
    • 3. Why Puppeteer

      2:06
    • 4. Creating Your First Page

      3:44
    • 5. Adding Item to Cart

      6:59
    • 6. Fulfillment Step

      5:27
    • 7. A Quick Fix

      2:47
    • 8. Filling Out Billing Section

      10:08
    • 9. Filling Out Payment Section

      7:36
    • 10. Final Steps

      3:05
    • 11. Bonus - Optimizing Your Bot

      6:16
    • 12. Bonus - A Real Bot in Action

      3:30
    • 13. Where To Go From Here

      1:02
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

578

Students

--

Projects

About This Class

Class Description

Bot Development Masterclass – Create a Checkout Bot

In this class I want to teach you all how to code a checkout bot that checks out very limited, hard to get products within seconds. With people scrambling to attain new consoles, advanced GPUs, sports cards, etc. because of bots checking out items as soon as they restock, I have decided to teach the average person, with little to no experience in coding, how to program a bot that can server their purposes and help them beat the bots with their very own bot.

 -----------

The Goal and Material

The first video introduces our goal in this course, while the second and third videos show the necessary materials, we will be using to code our checkout bot. These materials are Node JS, NPM, and Puppeteer. We learn why we utilize a Node JS library such as Puppeteer and its many capabilities that enable software developers to program a user-like application.

Section One – Pre-Billing

Following the introduction and overall setup of the project, in the first section we will look at the necessary steps to get to the billing/delivery page of the website, Walmart. We will explore HTML parsing, JavaScript and Puppeteer methods, and overall browser functionality to assist in pressing buttons and navigating from one page to the next. The stages of this section include creating your first browser page, adding an item to cart, and coding the fulfillment steps of the checkout process.

Section Two – Billing and Payment

In the second section of this coding project, we will program our bot to fill out the “sensitive information” sections in the checkout process using HTML identification and user input handling. We will also make use of delays to ensure the bot runs smoothly. Certain challenges also come up as this is the “hardest” part of the process, but we find ways to get past these challenges using intuitive thinking and coding. We also submit our order and test our bot to make sure it works correctly. I ended up buying LED lights with it but you can purchase anything you want! This section is my favorite and I hope you all have your coder glasses on for this one, it’s going to be a journey!

Bonus Section

In the final section, I teach you all ways you can code to optimize the bot to make sure it runs as fast and error-free as possible. We make use of delays and JavaScript try catches to handle potential errors and improve the bot’s speed. I also show the bot, Quantum, which I created with a friend that has checked out over 100+ consoles (PS5 and Xbox Series X), GPUs, and sports cards at lightning speed.

-----------

Who am I?

My name is Ritesh – a student at the University of Maryland and on the side, I create academic YouTube videos about the SAT, college advice, coding, and productivity. My favorite videos to create are my computer science videos because as a computer science major, I love coding cool, unique projects that can help other individuals accomplish their own goals. A developer for the people you can say! I feel that I’ve learned a lot in my years as a software engineer, so I’ve decided to create an extensive, in-depth series of Skillshare classes to share my knowledge of the best project I have ever dove into: creating a fast and competitive checkout bot.

Other Helpful Links:

Instagram - https://www.instagram.com/riteshkv_/?hl=en

Twitter -  https://twitter.com/riteshkv_

LinkedIn: https://www.linkedin.com/in/ritesh-verma-b35bb0169/

Meet Your Teacher

Teacher Profile Image

Ritesh Verma

Bot Developer | YouTuber | Student

Teacher

Hey there, my name is Ritesh Verma.

I am a college student + YouTuber + CEO of SmartMinds Tutoring who loves creating videos based on computer science, bettering yourself, and financial wealth.

Due to the recent craze in attaining limited items and my 2 year experience in coding checkout bots, I created extensive Skillshare classes to teach students worldwide how to develop bots that they can use to finally get products that sell out within seconds.

If you'd like to stay in touch with me, please be sure to my Skillshare profile, and if you like my content and have useful ideas for classes, then send me a message/email and I'll take it into consideration.

 

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome to the Class: Hello there, My name is rotation or a developer, one of the most dominant retail checkout Bas there are on the market today. In this course, I'll be teaching you guys how to create Checkout button that you can use to check out Limited items. You may have come from a YouTube videos or you may have found me through surfing through Scotia. This is the only place lash course, I'll be going in depth and all the nuances when it comes to creating a fast checkout. But trust me, if it worked for me or for you. Now, why should you learn how to create a checkout? But aside from the fact that I bought two overs are getting pay hundreds of thousands of dollars for the bus they are making. There's also a great product to include on your resume. Now before we jump into the coding, I wanted to give a quick debrief on my background, I have one of two developers of the butt quantum AIO, which has been used to check out over a 100 plus items, including PS5, xbox series x's, limited sports cars, and a bunch of other stuff. Now if you want to join the $1 million industry, Let's get coding right now. 2. Installation: Now to develop our bot, we're going to need to set everything up to make sure the entire development process is nice and easy. So the first thing we're gonna do is we're going to have to create a new folder on our desktop. And let's name it. But development. And now what we do is we go to our IDE. I use Visual Studio Code a, personally you guys can use whatever IDE you like. I do recommend Visual Studio Code just because I feel like it's industry standard. If you're a beginner, it's really easy to use a very user friendly. So we're going to open the folder. But development. So open this folder. Now we're going to do that is going to create a new file within it. Let's call it bought ab.js. Okay. Now, in order to actually drove are, but really what you need to download Node.js. Now NodeJS is what we're going to use to create the bot and it's very easy to download. Now, I have a Mac personally, as you can see right here. So I'll be using the MacOS installer, but all you have to do is literally click it and then you wait for it to download, open up. And then you just press Continue. You press Continue again. You accept the license, and you continue again. And then you'll click the Install button and then no JS will install a new way for it to install. Now I already have it. So mock-up, click the button. But once it installs, you would just go back to your file. And then you would open a new terminal. And now you already have no JS. But what you also have to initialize the NPM. Npm is a package manager that we're going to use to install certain libraries to use in our project. So we're going to do is we're going to call npm init. Is press Y and I can press Enter, Enter, Enter, Enter, Enter, Enter, Enter is okay. Yes. Okay, And now you see you have package.json and now you want to do npm installed. And now you have packaged dashed lock a day so that ice on. Once you have both these files in your file view, then everything is set up. Now all we have to do is actually one last thing. We're going to install puppeteer. Puppeteer is of library we're going to use to really create our bot. So all you have to do is go puppeteer, puppeteer npm. And you quickly go to this link and you will see the command npm install puppeteer. Okay, so let's do npm install puppet tiered with Fortran. Stop up a tear. It may take some time this way. Okay, and it's good not to make sure that we actually have puppeteer and everything's good. Let's make a variable called puppeteer equals. Require puppet to do console.log. Hello. We're going to run this really quick. To run it. We do node, but dot js and new got no errors. So everything's working. We got everything installed properly and now we are ready to begin coding. 3. Why Puppeteer: Now I want to make it apparent as to why we are using puppeteer as a main framework for creating our bot. So puppeteer is this amazing no library which has well, as it says, high level API to control Chrome or chromium. Chromium is basically like a browser that looks exactly like Chrome, is very customizable and it's very lightweight. So a lot of bots use a chromium. But the amazing thing about puppet to you guys is that it literally mimics a user. And when you are creating a bot, you want to seem like a user as much as possible because we've seen websites can do when they did, when they detect your, uh, but they may ban your IP. They may prevent you from accessing the website ever again. They may make you solve endless captures that take millions of years to solve. So to prevent that, we want to mimic a real user because you would never get a capture if you're a real person, kind of check out our product. But certain things, certain times websites can find out that you are a bot. Now puppeteer allow you to do is mimic the actions of a user like click on element or press Next or move your mouse all over the screen. So that way the website would never be like, Hmm, maybe this guy isn't a real person. It's a bot to program that's trying to check out the product. But not only that public key has been used extensively and you can see a bunch of YouTube videos about it. So if you're ever confused or you're ever want to crease the more puppeteer here. This is like a stepping stone and your path. And it also has a lot of examples that you can use online and it's very well documented. And when you are trying to use a library for a very potentially profitable as well as in-depth projects such as this bot that we are going to develop. You want to make sure the resources you're using are well-documented. So that way if you have any questions or getting any weird errors, you can easily find the answer online. So that is why we're using puppeteer. I use it for my robot that you got and see when the bonus videos at the end of this course. So stay tuned for that. And you guys will hopefully like it to. So let's get coding and let's create this bot. 4. Creating Your First Page: All right, so now that we have puppeteer imported or we're going to do is create our first page of puppeteer. Now a page is basically an instance of a browser that you would be interacting with. And how are we going to do that? Is we're going to make an async function. Let's call it checkout, or it's called Create page. What we're gonna do is we're going to do make a browser. And now there's a certain argument called headless. And what headless means is that if how this is set to true, then when you run your program, you won't be actually seen. The browser window pop up, I think is going to be behind the scenes at quicker. What is behind the scenes? When you do headless false, then you could actually see the browser and you can see what's happening with the page. Now when you're testing your bot and we're making sure everything works, you want to set how the street falls that way you can see everything that's going on. So for now, let's just have this default. Then we'll create a page. All you gotta do is call the browser dot new page method, right? And now what you do is you want to make the page go to a certain URL, right? So our bot will be focusing on Walmart. And right here, you would put in the product URL for whatever product you're trying to buy, right? So let's make a quick URL is called. Let's find a URL that we want. So it's got Walmart.com and you can get anything. Let's just go buy a lavalier mike. Because that way my audio will be better for my future videos, although I think the audio is pretty good. So we'll copy the link here. We'll paste it right here, put a semicolon there. And now when we call dysfunction, what should happen is a browser should open up. Let me close this one showing you guys. And you're going to see the pit, you're going to see that that product page loaded. So let's call the function create page. Save this off. You'll see right here, the product page, it right before you guys. And now if I set had listed true, so if I erase a program and I set headless to true. And let's see this console.log done. This way. We know the page has been loaded and the browser actually went to the page. The reason I'm console.log being done is because this way we'll see that Hey, everything happening and we didn't see anything because headless set to true. So I'm saying this again. So right now behind the scenes, that page has got loaded and now you see done. Right. Because like I said, we didn't see anything that was going on since how this was set to true. And when you are actually running your bot and I think is finished, you do on-site how this to true because a hub, the bottom go faster and obviously speed is a big thing when it comes to check down or product. Well, that's, I create your first page and puppeteer. And now it will be building on this fundamental. And we're going to check out this product. 5. Adding Item to Cart: Welcome back guys. In this video we're going to be actually adding the product to our cart. Now let's rename this function a little bit. Let's call this checkout because this is going back to match a function does everything. You always want to have some good names for your methods. Okay? So we don't need this anymore. We're just back to fall so we can see everything. And now we're gonna do here is we are going to create a quick function. Well, this function is going to do, is basically going to give us a page, right? And this was going to go in here is basically everything that's in here. And I can say this is like the master method that calls everything else. So it will go to the page and I'm going to go to the URL and return the page. So take that out. Now we will create a page object. So wait if page. And now what we're gonna do is we're going to pass this into a function. It's called Add to Cart, right? Where you're passing the page. Okay? Now, again, this is obviously not needed. It just creates a mix, everything well organized, and you want to create a nice, simple workflow that anyone can follow, right? So this function is giving us a page and now we create a function to ask the cart. So it's called Add to Cart. And it takes this page object. And guys, like I said, this page object, you can think of it as a browser, right? The entire window you see, you can think of that as a page. Okay. So what we're gonna do oxy first, we're going to make the page go to the URL, right? And now we're actually going to add to cart. So the question is, how are we adding this to cart? Well, if I run this program, you see I get a capture. Now if you guys do get a captured during the any phase of this course, you just saw the capture and usually once you solve it, once, it won't ask you for a catcher for a while, of course. And the course we will be going over how to solve these captures this little bonus thing about this course and people don't know about. But for now to solve a capture. Okay, so he solved the capture and now we're on the product page. You may see it's a little weird the way it looks. Few Maximize screen may help a little bit, but that's really not our problem right now. Well, we do the open DevTools. Once we open depth to 0, we have to do is we have to use this selected element in the page to inspect it, right? It says little cursor that basically highlights the HTML in the code of whatever we're hovering over. And this is our best friend for everything when it comes to making this bot. So what we're gonna do is when I hover over this Add to Cart button. And we're not going to hover over the text. We're going to hover over the actual button. And you click the button, you see the element right here, right? This is the exact element that in the code that renders as this Add to Cart button, you see as a certain class. And now the thing about everything on a page, everything on HTML page is usually in major sites like Walmart, Nike, target, you see elements and they all have a certain class or certain ID depending on the website. In this case, you'll see that this button has no ID. And the unique thing about an ID is an ID is assigned to just one element and is unique to that element. So since this button doesn't have an ID, we're going to use its class. And since this looks like the only major button, as you know, add to cart on the entire screen. We're going to assume that this class, this button spin, but in products CTA corresponds to this button only. And if so, we're going to use this, this class to identify the button in the code. Now if what I sowed, not what I said sound a little funky. You asked to see very shortly what I mean. So let's copy that. Let's say edit attribute. So now we've got the class, this command C, so we copy it. Now we go over to the code, or we're going to do is Puppet tier has this built-in function called click, right. Where it basically clicks and aliment that you have to identify on the HTML page. And like I said, you can identify via the class, the ID. Anyway, that basically tells puppeteer, Hey, I want you all to click this specific element. So in our case, we're gonna do, is we're gonna do button class equals, let's say double-quotes, because we're going to specify that class. And there you go. That's the class, correct? Right. So now this is a select this as the element that we are targeting, right? It is a button with a class that is this entire class right here. And the only element on entire page that is a button with that specific class. It is Add to Cart button. So now what we're gonna do is we're gonna do the LM lambda, l m dot Click. Okay. So what we're telling what we're talking about materials basically, hey, click this button, okay, find this element and then click it. Wherever it is, it hasn't really know. So button, it just says find the element that corresponds to whatever is passed into here. One good practice is to do await dot page for weight, page towel, wait for selector. What this basically does is sometimes when your connection slow or, or the page rendering is slow. Sometimes this selector, this unique identifier, it's not there in HTML yet, right? Because that button actually hasn't been created an HTML because the page is slow for whatever reason. So maybe only the baby, only this top part has rendered and this part over here hasn't rendered. So if it hasn't rendered, then the code won't reflect. It. Does reflect it. Well, you say, Hey, click this button right here, and as you know the page, you're gonna get an error. If you just wait for a selector WayForward appear, then it basically makes your code foolproof. Looks like we messed up the quotations a bit here. Okay, that should work. And now what we're gonna do is we're just going to help me cancel. That should work. And now we're gonna do is we're going to call it, hopefully does. Let me put a quick semicolon here. Okay. So it loads the page. See right there, add it to the cart. 6. Fulfillment Step: Welcome back guys. So we left off over here and we're gonna get back right into it. So it's basically the same process as adding to cart. You have to identify this button within the HTML. And we do that by clicking the selector tool, clicking a button, seeing it, clicking this class, and then adding the attribute, copying the class. And then we do a wait page dot wait for Selector. And again, same thing. We're gonna do. Button class equals a passing the class. Okay? So now again, once the page loads and a selector appears, that's what we wanted the next line and all we really have to do is do a weight page dot Click. Same thing, but in class equals passing the class. And what do we want to do with this selector? Well, we want to do, you're going to click it. There you go. We are called the click function, although Element. Cool. Now we run it and hopefully we get to the billing page. So we run it. It's going to add to cart. There JOS adding to cart. And it didn't check out. So let's see what happened. Are you guys would have fixed the error. What I do is I call it a method called wait for navigation. And then what this method does is it basically waits for the page to load, right? So when we have this, we technically don't even need a weight page. I wait for selector, but this just makes it even more safer. Let's try taking this out and see it still works. So if we do know about dot js, we run it. You'll see asked to cart. And then it clips the Checkout button. And now we are at Continue without a calculator. Alright guys, so now for this button, what we're gonna do is we're going to follow the same process. We're going to find the HTML was button. And you see right here, there's this class right here. But for this button particular, since there are two buttons on this screen, what I'm gonna do to be a little more safer is I see that as a datum data automation ID of new guests continue button. I'm going to target this attribute instead of the class. So I'm a copy it. And I go to the code. I'm going to have I'm going to do await page dot way for navigation. And then again await page dot click button. Class equals oops, my class data out of automation ID. There, you know where I put that because the equipment of the element. Now this should work. Let's clear this. Call it. So we add to cart. We check out, and there you go. And now we have to do one more button. Wow. So we're gonna do is we're going to get data automation ID. So let's edit the attribute is copy it. Copy these lines of code right here. Paste it. Copy it again. It's very repetitive, but it works. And what they want to add right here, just because usually when the building stuff comes close and you're like one barn away. For some reasons, sites like to mess up the timing a little bit. And just to be safe, I'm going to have a quick 1 second delay at right here. And hopefully what it does, it, it makes everything work smoothly. Now, when you guys are running your code, you may find that for some time is not working so far is not going all the way. What you can do is you can either rerun it. Sometimes you rerun it will work perfectly. Or I'm going to show you guys another option. But what you can see right here is that we have got to the building page, so everything seems pretty good. Hopefully you guys are with me. And like I said, if your thing is not working all the way, just rerun it and you'll probably get back to here. So we made it to billing and now we have to do, if you have to fill out this entire form without typing anything ourselves. We're going to make our programs work for us. And that's going to happen in the next video. 7. A Quick Fix: Hello there. So in this video, I'm actually going to do a quick little fix. This, not really a fixed and it depends on your computer. So if you've been running this at your card method, sometimes you may see that all the buttons aren't clicked and you may get an error in the console. So what I realized is that sometimes a penny on New York computer, depending on how fast your computer is, your Add to Cart may not get you all the way to the billing page. Right? So what I did was I created another little method, Utrecht cart number 2 or version 2. And you can use this and copy this code. You can use this instead of the regular Add to Cart. And what should happen is if this doesn't work, this should take you to the billing page. Now, what exactly did I change? Well, you can see right here, I still go to their product URL. I still wait for that first Add to Cart button I click it may for navigation. But public tier has a method called eval, which is almost the same as page I click. There's really not much difference. You can see that I'm getting this element and then I'm just calling its Click method because it's a button. But I also have a 2 second delay and a 1 second delay. While in the regular active car only have a 1 second delay. Now the delays basically enable year, enable public tier to just wait a little bit, make sure everything is loaded just fine. And one unique thing that I really want to point out is this evaluate method. This evaluate method. Sometimes it works better than the regular puppeteer click method simply because this evaluate method is injecting pure JavaScript into the computer. The page right is going to evaluate this JavaScript. Now this is a JavaScript method document.getElementById class name, that's a native JavaScript, a method where basically you input the class name and it will turn you a array or a list of all the elements on the page with that class name. In this case, there's only one element with the class name button and margin top, and that is the one that we want to click. So we get that first element in the list and then we call the click method because it has a button and we know that. So this is injecting pure JavaScript while the click method isn't really injecting pure JavaScript. So this is why sometimes the evaluate method is a more sure-fire way of making sure your button click actually occurs. And if this doesn't work either what you really should, you can always up your delays and you can fix them later when you optimize your bot at the end of this course. So you can incorporate this Add to Cart two and is called HER2 instead of regular Add to Cart, if you're Add to Cart was already working day, you don't even have to worry about this. But that's just a quick fix. 8. Filling Out Billing Section: All right, everyone, now we will be filling out the delivery section of this Walmart checkout process. So, you know the drill, let's first make our method. Let's call it a sinc function. Fill building. Passing the page object, we're going to have a quick delay of like a second. Make sure you know, everything is loaded. And now we're going to do the research part which we had been doing some tire time, right? We need to identify these selectors. Okay, so right here, you have name equals first name, id equals firstname. Okay, so we're going to, we're going to fill out these fields, and we've identified these fields through their IDs. So the ID is this value right here. Id equals firstName. So the firstName is for this one, was the ID for this one. Address line one. So you can see the ID by the hashtag, right? So you don't have to look at the HTML. You see right here. If you do look at ID equals address line one, and when you highlight it, you will see the hashtag ad or Stein one that tells you that this is the ID of the element. And the ID, in my opinion, one of the best ways of identifying an element on a page because only one element can have an ID that's unique to it, right, is one ID per element. Lastname, Ok, so capital N, We don't need this. Okay? So I'm trying to commit this to memory. So let's start at the start codons little bit. All right, so first we're going to fill out the first name, right? So we're gonna do, is we're going to type called a type method puppeteer do ID equals firstName. Okay? Now what is this doing? This is saying, hey, let's get the input element with the ID of firstName. What's the input element with the ID of firstName? See right here, this is the input element right here. Id equals firstName. Now we could identify by the name as well, right? But I'm just picking ID just because I like it didn't find elements by their ID, can then ensures uniqueness or type my name British. Now we're gonna do the same thing for last name. Input ID equals lastName, and type my last name, Burma. What else was another one? Input ID equals. Now, obviously God, you don't have to commit this to your brain. You can just write down by Pisa note paper right beside you. But I'm being special, I guess. Frederick Road, the very unique and my approach. Okay. So we got we got this, right. We've got the IDs and this should fill out FirstName, LastName, street address. Okay, now let's go to phone and email. So for fall and just hashtag, phone, email. Just hashtag, email. Okay. So do the same thing for those two. Also, I'm going to throw in a quick delay between each one. Like I said, Guys, we're going to optimize a box and make sure it's as fast as possible. Because obviously a delay does make the little slower because it's a delay. But depending on your computer, you may not need this delay, right? You may not, you may not need this 1 second delay, the beginning, and it's a 100 millisecond delay in between typing in each element. But a 100 millisecond delay is really nothing like as fine. Nothing, not a big deal whatsoever. And now I'm sure you got something else you can do. So, you know how I am. Identify the element by doing input and ID equals lastName. You could also just do this hashtag phone. That is it, because it's an ID, right? So only one element will have this ID on the page. So easy when identifying the ID. And no, this is not my real number. So please do not call me. You can try calling this number is not mine. So if you've got to try to contact me, you know, to draw my Discord. We're also going to type in the email hashtag, email RV business. Now you can contact me my email. This is my real email. Okay, So now if we run this, so Node JS, can we actually, okay, Oops, oops, oops, oops. I never call the method. So they would have never have done it. Okay. Now let's try it. So it's going to add it's a cart. Ok. And there you go. So it filled out all of the elements you made it fill up. Now, one thing you realize is there already is a city reading in the state and zip code. That's because Walmart already gets your geolocation right. Now the state, you really don't want to change, but sometimes you may want to change the city. Usually in advanced bot development of people what they do, they run this program multiple times under different user accounts. So all user accounts can't be from the same city. Now, if you're just trying to check out, I don't for yourself, you can just leave city and zip code the way it is. And it's pressed the Continue button, which we will do very soon. But just in case you do want to change the city and zip code, I'm going to show you something very unique. Okay? So if you do this weight page, dot wait for. And then we make it type in the field. You're going to notice that we're going to error. And this is the error. And we'll show you guys right away. So Aztec city, let's say k info. So now if I run it, you're going to see that at types K1s though in front of that we know, but we don't want that right. We want to delete, went OK and then write just Keynesian social look like just this. Now, how would we do that? This is a neat little trick I puppeteer is very cool. So we're going to do, is we're going to call this method say constant input equals identify the element input ID equals City. Now with this represents this input variable that represents the element on the page which is input with the id city. So that represents this element right here, this HTML. Now what we're gonna do is this. We're going to do a weight input dot click, and then parameter will be count three option, right? Well the arguments. So at this, what will happen now is this will be clicked three times. So what happens when it's clicked three times? You see it's highlighted. So obviously when you highlight text and you press any character, a race of that old text. So by clicking this three times, what's going to happen is gonna be highlighted. And then we can type in the field and really do the same thing for zip code. So input two, input, two input to put in to 12 to eight. And that was the idea of this hashtag postal code, or postal code. Okay, So now this is pretty cool thing. You're going to see it. Live happy writer, funny you real quick. Let me have a quick delay. So real quick, I did forget to do one thing that is called weight. You gotta make sure you wait for the page, actually get this HTML element. So now let's run it. And you see right here, there you go. You see how just like delete the text and wrote what mattered. And now that's billing is done. Now we just have to click the Continue button, which is very simple. You guys can just probably skip forward because I do this and skip forward because very easy to do. Same thing as we're doing this entire time. Edit attribute, let's copy it. Over here. We'll do a weight dot page dot wait for well, a 100 or 200. And then we just do await page dot evaluate. We're inject pure JavaScript. Okay, I wanted my class name. That's the class. We're going to first element within the list because only one element with that class. Click. And this will take you to the payment, a page which we will focus on the next video. 9. Filling Out Payment Section: All right. So hopefully you guys have made two payments. Just like me. I did change my way of calling a method cause I am and are running the program at evaluating and worked for me. So I use the eval method instead and work. And you could also use a quick method, whichever works for your computer guys. But now we will move on to the final step. And that is payment. So payment and then pass the page. And let's do a weight payment. Patient bucket. So I should just call it a scarf bill payment because he said Phil building. So you gotta keep that consistency. But the same process once again, this way of quick 1 second. And now what we're gonna do guys, you actually be pros at this now, all right. Straight pro guys and girls. You see your name and your last name already on the RTFO. Doubt your photo is already filled out. So you only have four fields to fill out the card number, expiration date, year, and it put so. Alright, let's grab the car number. What's this? Does have an ID, does IDs credit card. Okay. So we're gonna do is you're going to do a weight page that type credit card. You know, put your real credit card number if you are trying to check out a product. Or what we can do is when you're testing, I could do this a lot and I feel like you guys to learn this is FE, credit card numbers. Now, you know this sort of testing, right? So there you go. Visa. This is not illegal and I tap away. This is purely for testing. What happens is there's a certain algorithm called the lungs algorithm, which is used to validate credit card and certain credit cards will be validated according to the algorithm. But in the back-end, the site would check, Hey, this is not a real credit cards, then they're just going to revoke your order. So no harm, no foul. Everyone's happy. And now we're going to be awake that page dot wait for right. What is this typing? Okay, So now we're going to type out the next few that we care about, which is the CVP. So input hashtag CVP. Okay? And that's for like two to one is fine. Okay, So we got critical bagasse the thought out. Now you guys might be thinking, all right, so now how do we activate this drop-down and pick what we want? Well, like I said, this is why puppeteer is so amazing. Poverty actually has a built-in method called page dot select. And this is basically choosing a selecting element on the page. So you can see right here, makes a selection equal to the current object. So a site is good for drop-downs basically, right? So in this case, you know, you're trying to select this list and pick one of the elements, pick one of the values in the list. You call the select method. So it's going to select that drop-down. Was the first year. Find the ID of course, right? Hashtag month dash chooser. Okay? So month dash chooser. So now it's going to activate that drop-down you want. They are. So what month? Let's say up every decimal dashboarding. And now we're just going to copy this. I'm sure expiration date should have similar ID, year ID should be able to see you again kinda guess these ideas, the more experienced you are. What year do we want to expire and see what the values are? Okay, so let's say 24. Okay? And that's it really, That's really it. And now he's click review your order. So let's get this button. And again guys over here with these buttons, you know, but, uh, there was little special. You gotta, you gotta sometimes use one of three methods. Either click method, this eval method, or evaluate. Weight page dot. Let's try this. Try click. Let's see, Let's see You click is back in action is working for us. But in class. Okay? Right, So we're gonna run this and hopefully it works. All right, So I cut the video because she didn't work. There was an error with the year chooser. I'm pretty sure it's because we're doing is we're filling out the C V first. And I don't want to waste your time, guys. So what I'm gonna do is There you go. I'm going to CV last. Okay. Male make like a 2 second delay here. And this should help the work. Let's run it. Alright, so Rob building, you see it's filling it out. It clicks the button again without expiration date there. So I'm going to fix this and I'll get back to you guys when I fix it. All right, guys. So this is actually a perfect way to teach you guys how you have to adapt a sneaky websites. All right, so I've inspected the, the element, right? So when we hit the drop-down we see 21, 22, 23, 24. But when we actually look further like yes, open this HTML and we look at the actual options. The value c value equals 2021, 2022, 2023, 2024. And it says 24, the actual value is 2024. So the reason it wasn't working was because we were passing in 2004 and that's not an actual value. If we pass in 2024, this will actually work. And that just goes to show guys, you have to be very careful when you are trying to make a bot for any website. Or I could this approach of those standard approach for any website, you know, you use HTML, you inspect the element, you get the Elmo, you type in a click it, whatever you got to do, but that right butt website to cover their tracks like to make it really hard for the developer. And that's what you gotta do. You have to think, you know, with that mindset, like, let me really make sure I understand everything that's going on within the HTML of this page. Very big lesson. I'm glad I made that error. All right, So it's filling out the building and goes to the next puzzle, that credit card. There you go, bush review order. And now we're at place order guys. So we made it to here. And this is the last step. Once you click this button, our orders submitted. 10. Final Steps: So now we are at the last step of our entire butt, right? We have to click place order and the order will have it successfully checked out. Now since eyes are fake credit card, right? Obviously the order won't go through, but if you use your real credit card information, it will actually work. I'm going to do that towards the end of this video. So let's get his class. So let's get the class. There you go, you copy the class. Now we create a function that's going to submit the order. So Submit Order page for me. Okay. We're gonna make a quick delay. So we wait for 2000 and then we're going to call the evaluate method document and levels of class name. This obviously like I said, it returns a list of elements with this class name. We know only one element on the tire page has this class name, right? So you have the first element, which is a button by the Place Order button, will cause click method. And then we'll call the actual function itself. And this should work, right? We wait two seconds and then we run the evaluate method. We inject pure JavaScript into the browser, and then we will click the button. So let's run this program. You'll see what happens. All right, So it's filling out the building and now it's filling up the payment or you order. And now it placed the order right here. You can see the loadings in both. And now it took me back to the payment page because like I say guys, I use a fake credit card number. But if you use a real credit card number, it would ask you work. And now I'm going to show you that right now. Alright guys, so I just filled out my real information and I changed the URL to LED strip lights because actually need those. So that's run the program. I am to my real information. So if you see blurred stuff, no obvious reason why. But on okay, let's get to it. C checks out. It goes to continue without account. Prices continue. Now we are at a place order, and there you go. The order is placed. I successfully checked out a Walmart product using my bot LED lights. That is and yeah, there you go. Proof that our bot works. 11. Bonus - Optimizing Your Bot: So at this point we have successfully developed a working bot that you guys can use, check out a product or Walmart. And of course, you can use the same bar and just change like the links, the classes that you're looking for and make your work on any site, whether it be Nike, finish line, Foot Locker, whatever. But now in the real bonding world, what happens is products sell out very fast. So you want to make sure your bot is as fast as possible. So how can we optimize our bot so that we make it run faster? How can you guys optimize the bot? So if you look at our code, you see that we have all of these delays, right? Like the weight for 10000. What that's doing is it's telling the browser, hey, wait 1 second before doing anything else, before executing the next step in our code, right? So in this case, only the click method. So over here we make a way for two seconds when we are using this method. And then another second right here, when we're filling out the building, we make wait 1 second beginning that in-between we have a 100 millisecond delay. So we can optimize this by doing the following. For example, if you look at your computer and this will take a lot of testing, right? If you see that your computer is pretty fast, connections good, and your will be pretty fast and you can decrease these delays. So right here I have a 2000 delayed, but if I make it maybe 500 and I run the code and the Barstow works, that can leave it as 500, right? That's, that's the idea of optimizing the spot. You want to make sure the delays are as small as possible, but the bots still works. So I'm sure you all have realized that sometimes the button won't get clipped, right? We'll tell the button, hey click this class using the click method and it wouldn't work. But then we use an eval method and starts working. What you can do because in real time you don't want your bot to crash, right? Almost that. What you can do is you can put, you can make a method. So we'll make a new method actually. Let's call it async function. Guaranteed click, Okay. Probably spell that wrong. Guarantee quick, little confusing. Let's call it super click. Okay. All right, what we're gonna do is we're going to do a try-catch. Well, this basically says is tried this and it doesn't work and it results in an error, then do whatever is in this block. So we're going to try, let's say it's passing class to class name. We're going to do try page dot Click class name. Okay? And we're gonna do lm, lm dot click. Okay. And so what this is doing is it's calling the click method. If it doesn't work, what we're gonna do is this. We're gonna do page dot e Val, again class name, and then lm, lm dot clip. So now what's going to happen? And we actually probably should change this. So let's do what ten class equals. So then x2 plus the class name. And then it will be, there you go. This should work. Oh, yeah. Okay. So this is doing is it's going to insert the class name within this format and rude to the same thing for here as well. And what's going to happen is if this clip doesn't work, right and results in an error, they're going to try this click, this way of clicking the element. And one of these should work. But if we want to be super sure and say what if neither of these work that we do another try catch within the first catch, this is, this is where it gets a little complicated. I know it's a little weird actually, you don't really, you don't really want to do this. Usually one of these should work. You've paid out evil, right? Again. So what happens is, we tried this and this doesn't work as well. We're going to call page dot evaluate, right? And never do a document dot getElementsByClassName. And this will be just passing the class name directly. 0 dot click. So one of these will work, right? One of these three have to work. If neither of them works, then that means you need a delay. You make sure delays are good because if you're doing isn't good, then the HTML must not have rendered on the screen, which is why the selectors not found. Yeah, that's a super clicks. So now wherever you see like the click method, you would just do a weight, a weight. She put up those class copy the class first, obviously. Yeah. And then you do await super click. And there were passing the page and then the class name. There you go. So now what it's going to do is call this method. It's going to try all the possible ways. Right? Now. If this one works, then we're done. This one works were done somewhere else, we're done, right? So instead of yes and instead of e-value is called soup clip. Again, basically replace all of the ways we click the element with the superclass method. That's another way of optimizing the bot and making sure it doesn't crash. Because like I said, guys, you do not want the bot to crash during the time of product drop because these products sell out fast. All right, so you want make sure your butt is fast as possible. But this is how you optimize your bot. Like I said, your browser's be your connection. Your internet is different. So you'd delays are going to be different than the person sitting next to you. So as this could require some testing on your end, but I'm sure you guys can do it. You can optimize your bot to make sure it as fast as possible with your connection. 12. Bonus - A Real Bot in Action: Welcome everyone to this bonus video where I will show you guys the actual bought my friend and I created that right now focuses on Walmart only, but we're going to add other sites soon. The body is called Quantum. This is it's Twitter. And this bar has had a lot of success. You can scroll down to our Twitter posts. One of that, one of our users actually checked out 27 PS50 in one drop. And then he, another person checked out around a PS50 here and nine PS fives here. So we've had a lot of success with our bot. And obviously there's more to come. But here is a bot itself. This is how a real bot looks like after we spent around three months of development on this, but we'll actually five months of development on this. But a lot of huge learning curve, right? This is the first I've ever created. And this is probably the biggest software project I've actually worked on. But you see right here, we have this thing called tasks. And these tasks do is they send requests to Walmart server to check out our product. So when you create a task, you have to pick the store right now it's only Walmart. You put him put the link of the product. So say I wanted to get these nerve blasters. I'll just copy the product. Then I'll paste it here. And then you pick a profile. A profile is, is basically has all your information, like your billing information, your payment information, and then proxy, you don't have to worry about right now. That's a little more events of a topic. And then you pick how many tasks you want to create. In this case, I already have 20 loaded, so I'm not actually going to create anymore tasks, and that's really it. So you click Create and then you would have all your task created. But this is how it looks like. And since my profile is not entirely valid, I put a fake credit card number in. There is not the product won't actually check out. But I'll show you guys how it will look like if I were to check out the product. Although have to do is click the Start button. And then it will search for the product. Will add to cart. Rack up more tests, is the required viewing cart. Shipping is going really fast, right? So many order is going to fail over here. Yeah, it fills over there because I have a fake credit card. But if I, you know, real credit card number of dense gonna go through. But you can see how facet is. So that's six tasks right here and right now it just got blocked, so it's solving a captcha. So it's going to happen is this capture will be solved and wants to solve capture the task. We'll go back to try and check out the product. And that's how you check out 27 PS5 within a minute. And that's how that's what a button able you to do. That's the overall gist of a bot. So hopefully you guys see right here you can see the capitalist solve. And now it's going to try to check out the product once again. And you can obviously start all the tasks at once. And that's really how a realistic real-life bot works. And so right now you guys are at the beginning stage of your body love and careers. But let's say eight months from now you will probably be overdo this as well. So keep sticking with the guys. And I know you all will do great things in the bot development world. This is how the proxy looks like. By the way, this is our profiles look like this is settings. And yeah. So thank you guys for watching piece. 13. Where To Go From Here: Congratulations, you have successfully created a checkout, bought that now you can use to check out whatever products you want. And now the techniques that were shown in this course can be applied to any website. So do not think you're limited to only checking out products on Walmart. You can easily recreate and replicate this process on any other site, including finish line, Foot Locker, Champs, whatever website you want to maybe invest bought you get those GPUs are dropping very soon. And you can create a bot for all of these sites. So be sure to be curious, creative, and to live when creating a checkout. But for all its other sites, you already know the process. Now you just got executed. If you all want to reach out to me after completing this course, be sure to check out the description for my e-mail, check quantums, Twitter, and message me there. So be sure stay in touch and if you like this course, be sure to give this course the best possible rating. Tell your friends, let everyone know that you can create a bot and get the products you want at lightning speed. So thank you all for watching. I hope you enjoyed this course and see you next time. Peace.