-
Notifications
You must be signed in to change notification settings - Fork 0
/
applier.js
80 lines (54 loc) · 2.19 KB
/
applier.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
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage()
const email = "email"; //use your email address
const password = "password";// use your own password
const location = "Vienna"; //change it to any city u want
const keywords = "qa Automation"//u can write one or many keywords here
var jobNo = 1;
//await page.screenshot({ path: 'keyboard.png' })
await page.goto('https://linkedin.com', { "waitUntil": "networkidle0" });
await page.type('#login-email', email); // your login here
await page.type('#login-password', password); // your password here
page.click('#login-submit');
await page.waitForNavigation();
await page.goto('https://www.linkedin.com/jobs/')
// Type location
await page.evaluate(function () {
document.querySelector('input[id^="jobs-search-box-location-id"]').value = ''
})
await page.type('input[id^="jobs-search-box-keyword-id"]',keywords);
await page.type('input[id^="jobs-search-box-location-id"]', location);
await page.waitFor(2000);
await page.keyboard.press('ArrowDown');
await page.keyboard.press('ArrowDown');
await page.waitFor(1000);
await page.keyboard.press('Enter');
await page.keyboard.press('Enter');
await page.waitForNavigation();
// li.page-list > ol > li:nth-child(2)
async function pappu() {
for (let i = 1; i < 26; i++) {
await page.click('.occludable-update:nth-child(' + i + ') p.job-card-search__description-snippet');
await page.waitFor(1000);
if (await page.$('.jobs-apply-button__text') !== null) {
console.log("Applying to job number : -->" + jobNo);
jobNo++;
await page.click('#jobs-apply-button__text');
}
//if().jobs-apply-button__text
}
}
pappu();
console.log("finished the first loop --> clicking page 2\n no more logs for loops after this");
await page.click('li.page-list > ol > li:nth-child(2)');
pappu();
await page.click('li.page-list > ol > li:nth-child(3)');
pappu();
for (var k = 4; k < 100; k++) {
await page.click('li.page-list > ol > li:nth-child(' + k + ')');
pappu();
}
await browser.close()
})()