Guide to Start Web Automation Using JavaScript

Web automation substitutes software or scripts in the place of humans in doing repetitive and tedious tasks on the web such as form filling, screen scraping, data extraction, and many other tasks. Web automation is generally done using the help of many frameworks because these web frameworks not only simulate browser activity but have many other features.

I started with HTML and CSS, aiming to learn how to create some websites. I learned the basics from w3schools and other online tutorials. Then I came across JavaScript and found out real programming on the web comes with this and HTML and CSS were just markup and styling languages that were easier to learn but need a high level of creativity on creating beautiful websites.

I was not splendid at designing, so my interest diverted to the logical part, JavaScript (which we use in the design’s working).

I watched a video to learn JavaScript; I knew C and C++ very well, so I found that learning basics of JavaScript were not a difficult task. In the beginning, I played with it on my browser console. I was really excited and motivated in learning the language.

I started with basic examples such as changing HTML contents and attributes using JavaScript HTML DOM (With the HTML DOM, JavaScript can access and change all the elements of an HTML document.). Then I started doing every activity that we do manually on a webpage using the browser console and Javascript. I started using browser console as my web terminal, used it for filling input boxes, clicking buttons and opening links on a new window or new tab.

Working on the console gave me an idea of automating some boring tasks we do on the web. I surfed YouTube and Google for automation tutorials and examples using Javascript and came across a tutorial to do auto like images on Instagram. I learned how the code works and started researching to create a new automation script using vanilla JavaScript.



MY FIRST AUTOMATION SCRIPT


I am a frequent user of Instagram, and I had a problem with the site. I wanted to delete my pending requests that I have sent on Instagram. Luckily, Instagram has an option to see the usernames of the people we have requested and are still pending for confirmation. The list was huge and the only way I could cancel the requests I had sent was by copying the usernames one at a time, search it and open the profile then cancel the request. The number of times I have to do this process was longer than you could imagine considering the number of people I have requested. So I started to work on this problem with my little knowledge using only pure vanilla JavaScript (not even JQuery).

To be honest, it took more time to complete the script than I thought, but the work was very satisfying and I loved the process. All I knew to complete the automated script to cancel sent pending requests on Instagram was some basic functions in JavaScript, HTML DOM selectors and methods and programming knowledge like loops and conditional statements. These are the introductory things you will learn in JavaScript.


WAYS I LEARNED JAVASCRIPT


w3schools
Creating an Instagram Bot with JavaScript (video tutorial that I began with)
Instagram Pending Request Cancel Script (My First JavaScript Automation Script)


CONCLUSION


I hope I could motivate you to learn and use JavaScript for web automation and other useful purposes. The Instagram idea was a small one, but it solved my problem and made my task easier. Likewise, I suggest you find your own problems on the web that you can automate using JavaScript to make your workflow easier and faster. Happy automating using JavaScript.
Guide to Start Web Automation Using JavaScript Guide to Start Web Automation Using JavaScript Reviewed by Jobin Jose on November 18, 2019 Rating: 5

1 comment:

  1. JavaScript for Automation (JXA) and AppleScript are the two primary languages Apple has provided for application automation. While they both can generally achieve the same results, each language offers advantages and disadvantages. JXA is very flexible providing a rich set of default libraries for some basics like character, date, and URL handling. It also offers a very powerful Regular Expression engine built-in. thanks~ Charlotte W. from software development company

    ReplyDelete

Powered by Blogger.