-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
28 lines (20 loc) · 885 Bytes
/
index.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
const { Chromeless } = require('chromeless')
async function run() {
const chromeless = new Chromeless({debug: true, scrollBeforeClick: true, implicitWait: true})
await chromeless.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36')
await searchJob(chromeless)
const url = await chromeless.evaluate(url => window.location.href)
console.log(url)
await chromeless.end()
}
const searchJob = (chromeless) => {
chromeless
.goto('http://www.jobthai.com/')
.wait('a[href="http://www.jobthai.com/home/searchjob.php"]')
.click('a[href="http://www.jobthai.com/home/searchjob.php"]')
.wait('input[name="KeyWord"]')
.type('โปรแกรมเมอร์', 'input[name="KeyWord"]')
.click('input[id="buttonsearch"]')
.wait(5000)
}
run().catch(console.error.bind(console))