Skip to main content

Interact With Webpage Using Chrome and jQuery - Mass Follow on Twitter!


Introduction:
This tutorial is on how to use basic jQuery knowledge and Google Chrome to manipulate a webpage.

Notes:
The webpage we will be using for this is Twitter of which we will be following a page full of users with a simple, one line jQuery command.

First:
You need to find a list of users of which have the 'Follow' button displayed next to them. I would recommend going to a Twitter user, then going to their 'Following'/'Followers' list, scroll down a bit for a few more pages to load.

Second:
Right click on the follow button and click 'Inspect Element'. As you can see, you should get something like this...

  1. <button class="user-actions-follow-button js-follow-btn follow-button btn small small-follow-btn" type="button">

We want to select one of the classes of the HTML button element, so we will use the class;
'.js-follow-btn'

We also want to narrow down the results by scrolling up the console inspect element Chrome window and finding the containing div's class for the list of users, we get this...

  1. <div class="GridTimeline-items" role="list" data-cursor="1468283911446037111">

So we will use the following class as well;
'.GridTimelines-items'

jQuery:
Now for the programming jQuery part.

First we use the document/page by using the dollar sign ($) symbol, then inbetween brackets we set the string(s) of the elements we want to interact with (these will be the classes we discovered earlier). Finally we want to close of the string(s) and brackets, then use dot-notation to invoke the click function. So in the end it should look something like this...

  1. $('.GridTimelines-items .js-follow-btn').click();

Console:
To use the above code simply click on the 'Console' tab in the Chrome 'Inspect Element' developer window and type it in followed by pressing the 'Enter' key. Chrome will then find all of the element on the current webpage which has the class '.js-follow.btn' an element of class '.GridTimelines-items' and invoke the click function (emulate a left mouse click on it), therefore following all the users on that page, at once!

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.