Last active
August 31, 2021 09:15
-
-
Save asifvora/427eb83bafc35928acd180956359644c to your computer and use it in GitHub Desktop.
Async/Await Essentials for Production: Loops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeoutPromise = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout)); | |
const list = document.querySelectorAll('.L3NKy'); | |
function clikOnLink(link){ | |
link.click(); | |
} | |
const asyncLoop = async () => { | |
for (let i = 0; i < list.length ; i++) { | |
await timeoutPromise(1000); | |
clikOnLink(list[i]); | |
} | |
} | |
asyncLoop(); |
how do I use it? I have to run on chrome evaluation?
How do we run it?
Alguem sabe como executar??
Press f12 and open console, put code there and press enter
This code does NOT work in console.
…On Sun, Jul 28, 2019 at 12:45 PM DanielBSS-dev ***@***.***> wrote:
Press f12 and open console, put code there and press enter
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/427eb83bafc35928acd180956359644c?email_source=notifications&email_token=AIHC36PXINCKCZOKSTKHFITQBXELHA5CNFSM4HMC4TY2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFWCNA#gistcomment-2983120>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIHC36NDX3Y2SWZOLR63OV3QBXELHANCNFSM4HMC4TYQ>
.
Here is the error,.
VM69:1 Uncaught ReferenceError: thesocialspider is not defined
at <anonymous>:1:1
…On Sun, Jul 28, 2019 at 6:29 PM JD Nazario ***@***.***> wrote:
This code does NOT work in console.
On Sun, Jul 28, 2019 at 12:45 PM DanielBSS-dev ***@***.***>
wrote:
> Press f12 and open console, put code there and press enter
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://gist.github.com/427eb83bafc35928acd180956359644c?email_source=notifications&email_token=AIHC36PXINCKCZOKSTKHFITQBXELHA5CNFSM4HMC4TY2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFWCNA#gistcomment-2983120>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AIHC36NDX3Y2SWZOLR63OV3QBXELHANCNFSM4HMC4TYQ>
> .
>
This code still does not work.
It gives the error i.showed earlier.
…On Mon, Jul 29, 2019, 10:39 AM DanielBSS-dev ***@***.***> wrote:
https://ibb.co/KjbGdbx
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/427eb83bafc35928acd180956359644c?email_source=notifications&email_token=AIHC36ISSXCBLUQUW4BTHL3QB36ILA5CNFSM4HMC4TY2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFWD5Q#gistcomment-2983896>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIHC36JHGBI62L4WMDFT3QTQB36ILANCNFSM4HMC4TYQ>
.
I've made a feel changes
`const timeoutPromise = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
const list = document.querySelectorAll('.L3NKy');
function clikOnLink(link){
if(link.TextContent == 'Seguir' ){
link.click();
}
}
const asyncLoop = async () => {
for (let i = 0; i < list.length ; i++) {
if(list[i].TextContent == 'Seguir' ){
clikOnLink(list[i]);
await timeoutPromise(1000);
}else{
await timeoutPromise(0);
}
}
}
`
well this just only follow the random people but i need something else
Your code work, thank you)
Bro how to use
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stops working after like 25 adds.