Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// this function allows us to stop our code for |ms| milliseconds.
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// I've put our main code into this function.
async function addPeople() {
ul = $('ul.mn-pymk-list__cards')[0];
firstLi = ul.querySelector('li');
count = 0; // this is the count of how many people you've added
while(firstLi && count < 100){ // stop after adding 100 people
buttonToClick = firstLi.querySelector("button[data-control-name=invite]");
// make sure that this button contains the text "Connect"
if (buttonToClick.innerText.includes("Connect")){
buttonToClick.click();
count += 1;
console.log("I have added " + count + " people so far.");
}
ul.removeChild(firstLi);
await sleep(1000); // stop this function for 1 second here.
firstLi = ul.querySelector('li');
}
}
addPeople();
@ravichalla

This comment has been minimized.

Copy link

commented Jul 28, 2018

The 8th line in code .... has to be replaced with
ul = $("ul#ember1225")[0];
to work , as UI side changes has been made .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.