Skip to content

Instantly share code, notes, and snippets.

@ykdojo
Last active December 29, 2020 21:49
Show Gist options
  • Save ykdojo/aea4cf27fec4bbb5a175e11bae39cb2d to your computer and use it in GitHub Desktop.
Save ykdojo/aea4cf27fec4bbb5a175e11bae39cb2d to your computer and use it in GitHub Desktop.
// 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
Copy link

ravichalla 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 .

@eladmw
Copy link

eladmw commented Dec 29, 2020

ember+___ it's not consistent.

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