-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
36 lines (28 loc) · 926 Bytes
/
test.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
const puppeteer = require('puppeteer');
const sleep = require('sleep');
(async () => {
const browser = await puppeteer.launch({
ignoreHTTPSErrors: true,
headless: false,
slowMo: 50,
width: 1280,
height: 860,
args: [
'--window-position=0,0',
'--window-size=1336,768',
'--disable-infobars'
],
});
const page = await browser.newPage();
page.setViewport({ width: 1336, height: 768 })
await page.goto('http://www.capes.gov.br');
await page.type('#portal-searchbox-field', 'Headless Chrome');
await page.keyboard.press('Enter');
await page.waitForSelector(".documentFirstHeading");
await page.click("#area-contenttags");
await page.$eval('#search-searchword', el => el.value='');
await page.type('#search-searchword', 'no headless Chrome');
await page.click('#searchForm > div > div.span3 > p > button');
sleep.sleep(3);
await browser.close();
})();