Skip to content

Instantly share code, notes, and snippets.

@xypnox
Last active August 4, 2022 07:44
Show Gist options
  • Save xypnox/d17c91b8ff2f6cf41de93fac8752e359 to your computer and use it in GitHub Desktop.
Save xypnox/d17c91b8ff2f6cf41de93fac8752e359 to your computer and use it in GitHub Desktop.
Automation Notes

Automation

We solve something that infuriates us everyday.

Linked In automation

let elems = document.getElementsByClassName('js-discover-person-card__action-btn'), i = 0;
while(i++< elems.length){
	console.log("Yo we hack and stuff");
	setTimeout(
		elems[i].click(),
	1000);
}

Twitter Liker

let elements = document.querySelectorAll('[data-testid="like"]'), i = 0;

while(i++< elements.length){
	console.log("We hacks twitter");
	setTimeout(
		elements[i].click(),
	1000);
}

Making a generalization

General Purpose clicker function

function clicker(elements) {
    Array.from(elements).forEach(
        element => {
        	setTimeout(
	            element.click(),
                500
            )    
        }
    );
}
Website element selector Action
Linked In document.getElementsByClassName('js-discover-person-card__action-btn') Sends follow request
Github document.querySelectorAll('[value="Star"]') Stars a repo
Twitter document.querySelectorAll('[data-testid="like"]') Likes a tweet
Instagram document.querySelectorAll('[aria-label="Like"]') Like a post

Task: Automate and like all the posts of the KOSS facebook page and win gift hamper in Python Workshop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment