-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
80 lines (78 loc) · 2 KB
/
bot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* PT-BR */
let [i, limite, conteudo] = [
520,
99999,
document.querySelector(".scaffold-finite-scroll__content"),
];
let intervalo = setInterval(() => {
if (i >= limite) {
console.log("Finalizou a automacao " + limite);
clearInterval(intervalo);
}
i = i + 5;
try {
let botao = document.querySelector(`#ember${i}`);
if (botao.ariaLabel.toLowerCase().includes("conectar")) {
console.log(
botao.ariaLabel
.toLowerCase()
.replace("conectar", "")
.replace("para se", "")
.replace("convidar", "") + " Enviou solicitacao"
);
botao.click();
}
} catch (e) {
console.log("Erro - Botao nao encontrado");
try {
document.querySelector('button[aria-label="Entendi"]').click();
} catch (e) {
conteudo.scrollIntoView({
behavior: "smooth",
block: "end",
inline: "nearest",
});
// Skip
}
// Erro
}
}, 400);
/* EN */
let [i, limite, conteudo] = [
520,
99999,
document.querySelector(".scaffold-finite-scroll__content"),
];
let intervalo = setInterval(() => {
if (i >= limite) {
console.log("Finalizou a automacao " + limite);
clearInterval(intervalo);
}
i = i + 5;
try {
let botao = document.querySelector(`#ember${i}`);
if (botao.ariaLabel.toLowerCase().includes("connect")) {
console.log(
botao.ariaLabel
.toLowerCase()
.replace("connect", "")
.replace("to", "")
.replace("to invite", "") + " Send"
);
botao.click();
}
} catch (e) {
console.log("Error - Not found button");
try {
document.querySelector('button[aria-label="I understood"]').click();
} catch (e) {
conteudo.scrollIntoView({
behavior: "smooth",
block: "end",
inline: "nearest",
});
// Skip
}
// Erro
}
}, 400);