Last active
March 22, 2019 02:16
-
-
Save vsemozhetbyt/20469874edba6f1e3fe933e773c32786 to your computer and use it in GitHub Desktop.
Revisions
-
vsemozhetbyt revised this gist
Mar 22, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const puppeteer = require('puppeteer'); try { const browser = await puppeteer.launch({ headless: false }); const [page] = await browser.pages(); page.setDefaultTimeout(0); await page.goto('https://www.kbb.com/mini/countryman/2013/cooper-s-hatchback-4d/?intent=buy-used&pricetype=private-party&mileage=34000'); -
vsemozhetbyt revised this gist
Mar 21, 2019 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,8 +9,11 @@ const puppeteer = require('puppeteer'); await page.goto('https://www.kbb.com/mini/countryman/2013/cooper-s-hatchback-4d/?intent=buy-used&pricetype=private-party&mileage=34000'); await page.waitForSelector('.zipcode-input'); await page.type('.zipcode-input', '12345'); await page.waitForSelector('.save-zipcode'); await page.click('.save-zipcode'); await page.waitFor(1000); await page.reload(); await page.waitForSelector('#PriceAdvisorFrame'); @@ -21,7 +24,7 @@ const puppeteer = require('puppeteer'); console.log(data); await browser.close(); } catch (err) { console.error(err); } -
vsemozhetbyt revised this gist
Mar 20, 2019 . 1 changed file with 10 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,13 +9,19 @@ const puppeteer = require('puppeteer'); await page.goto('https://www.kbb.com/mini/countryman/2013/cooper-s-hatchback-4d/?intent=buy-used&pricetype=private-party&mileage=34000'); await page.type('.zipcode-input', '12345'); await page.click('.save-zipcode'); await page.reload(); await page.waitForSelector('#PriceAdvisorFrame'); const data = await page.evaluate(() => [ ...document.querySelector('#PriceAdvisorFrame') .contentDocument.querySelectorAll('g#RangeBox text') ].map(elem => elem.textContent)); console.log(data); // await browser.close(); } catch (err) { console.error(err); } -
vsemozhetbyt created this gist
Mar 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ 'use strict'; const puppeteer = require('puppeteer'); (async function main() { try { const browser = await puppeteer.launch({ headless: false }); const [page] = await browser.pages(); await page.goto('https://www.kbb.com/mini/countryman/2013/cooper-s-hatchback-4d/?intent=buy-used&pricetype=private-party&mileage=34000'); const data = await page.evaluate(() => [...document.querySelectorAll('div.price')].map(elem => elem.innerText) ); console.log(data); await browser.close(); } catch (err) { console.error(err); } })();