Logo

dev-resources.site

for different kinds of informations.

Code Against the Clock: Creating the class hunter

Published at
8/16/2024
Categories
automation
node
lockdown
puppeteer
Author
programmerraja
Author
14 person written this
programmerraja
open
Code Against the Clock: Creating the class hunter

Hey there! Welcome to "Code Against the Clock," blog series where Iโ€™ll reveal how I turned my most boring tasks into streamlined, time-saving machines. Iโ€™ll share the exact steps I took to automate these chores and the cool tricks I discovered along the way. Ready to see how you can save time and make life a bit more exciting? Letโ€™s dive in and get your tasks on autopilot!

The COVID-19 Pandemic: A Turning Point

Who can forget the sudden halt in March 2020 when the COVID-19 pandemic brought the world to a standstill? Schools and colleges closed, and virtual classes became the new norm. As a college student, I was expected to attend online classes, but I had other commitments that couldn't be ignored. My family needed my assistance during the lockdown, and spending hours staring at a computer screen wasn't an option.

That's when I decided to take matters into my own hands. I had recently started learning Node.js, and I saw an opportunity to use my newfound skills to automate my virtual classes. Why not, right? I was already spending hours writing code, so why not write it in a way that would do all the class attendance for me?

Discovering Puppeteer

During my research, I stumbled upon Puppeteer, a powerful tool that can be used with Node.js to automate browser functions. It was the perfect solution for my problem, as I could create a script that would launch a browser, log into my online classroom portal, and attend classes on my behalf.

Breaking Down the Problem

Before I started coding, I needed to break down the problem into smaller, manageable tasks. I came up with an algorithm that would guide my script's logic:

The Algorithm

  1. Find Present Class: Identify the current class schedule and find the next class to attend.
  2. Start Browser: Launch a new browser instance using Puppeteer.
  3. Login: Determine the login method: use stored cookies to authenticate or sign in with Google.
  4. Open Class: Navigate to the online class platform and join the class.
  5. Check Number of Students: Verify the number of students in the class. If the student count is greater than a configured count, join the class.
  6. Leave Class (if necessary): If there are no students in the class, leave the class.
  7. Find Next Class Time and Join: Schedule the next class attendance based on the class schedule.
  8. Restart: Repeat the process for the next class.

The Result

It took me just a day to complete the project, and I started using it for my online classes. The feeling of automating a tedious task was incredibly empowering!

Your Turn!

Have you ever automated a task using code? Share your experiences and tips in the comments below! What tasks do you wish you could automate? Let's discuss!

Thanks for joining me on this automation adventure, and until the next time around these pages!

You can find the code here

Image description

If you found this blog insightful and want to support more content like this, consider buying me a coffee. Your support fuels my passion for exploring and sharing content like this

Finally, if the article was helpful, please clap ๐Ÿ‘and follow, thank you!

puppeteer Article's
30 articles in total
Favicon
How to Web Scrape with Puppeteer: A Beginner-Friendly Guide
Favicon
Running Puppeteer on a Server: A Complete Tutorial
Favicon
Collect All Requested Images on a Website Using Puppeteer
Favicon
Automate Web Testing in C#: A Guide with PuppeteerSharp and SpecFlow
Favicon
A step-by-step guide to setting up a Puppeteer screenshot API on Ubuntu
Favicon
Elevate Your Web Scraping with These Puppeteer Alternatives
Favicon
Creating a Next.js API to Convert HTML to PDF with Puppeteer (Vercel-Compatible)
Favicon
How to configure Swiftproxy proxy server in Puppeteer?
Favicon
installing google chrome in docker
Favicon
Code Against the Clock: Creating the class hunter
Favicon
Writing integration tests with jest and puppeteer
Favicon
Puppeteer Vs Playwright: Scrape a Strapi-Powered Website
Favicon
Mengirim Pesan WhatsApp dengan JavaScript
Favicon
Headless Browser โ€“ A Stepping Stone Towards Developing Smarter Web Applications
Favicon
Puppeteer junior
Favicon
Converting HTML web pages into PDF
Favicon
How to Scrape With Headless Firefox
Favicon
Top 5 Puppeteer Alternatives for Node.js
Favicon
How to generate PDF's with Puppeteer on Vercel in 2024
Favicon
Simplify PDF Generation in Node.js with html-to-pdf-pup
Favicon
How to do Web Scraping with Puppeteer and NodeJS in 2024 | Puppeteer tutorial
Favicon
Sometimes things simply don't work
Favicon
User browser vs. Puppeteer
Favicon
WebAuthn E2E Testing: Playwright, Selenium, Puppeteer
Favicon
Mastering Request Interceptions in Puppeteer
Favicon
How to grab all titles of products from an Amazon page
Favicon
Testing web components
Favicon
Rendering PDF from URLs and HTML input using express js
Favicon
Login with Puppeteer and re-use cookies for another window
Favicon
How to download and upload files in Puppeteer

Featured ones: