-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
25 lines (20 loc) · 877 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
const puppeteer = require('puppeteer');
(async (isbn) => {
const browser = await puppeteer.launch({headless: false})
const page = await browser.newPage();
await page.setDefaultTimeout(30000000);
await page.goto(`https://www.google.com/search?q=cairn`);
await page.waitForSelector('#rso > div:nth-child(1) > div > div > div > div > div > div > div.yuRUbf > a');
await Promise.all([
page.click('#rso > div:nth-child(1) > div > div > div > div > div > div > div.yuRUbf > a'),
page.waitForNavigation({waitUntil: 'networkidle0',}),
]);
await page.mouse.move(0, 0);
await page.mouse.down();
await page.mouse.move(190,0);
await page.mouse.move(190, 16);
await page.mouse.click(190, 16);
await page.keyboard.type(isbn)
await page.mouse.move(525, 16);
await page.mouse.click(525, 16);
})('9782706121371')