-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dojo #2 - adding less price product to chart
- Loading branch information
1 parent
5a7fe0e
commit 9c93deb
Showing
3 changed files
with
4,232 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Próximo Mestre | ||
|
||
|
||
|
||
Positivos | ||
-------------------- | ||
- | ||
|
||
|
||
|
||
|
||
|
||
Negativos | ||
--------------- | ||
- |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const puppeteer = require('puppeteer'); | ||
|
||
let contents = null; | ||
let url = "https://www.mobly.com.br" | ||
|
||
const cookie = { | ||
name: 'showNewsLetterThisSession', | ||
value: 'false', | ||
url: url | ||
}; | ||
|
||
console.log('Starting...'); | ||
|
||
(async () => { | ||
// const browser = await puppeteer.launch(); | ||
const browser = await puppeteer.launch({headless: false, args: ['--no-sandbox', '--disable-setuid-sandbox']}); | ||
const page = await browser.newPage(); | ||
await page.setCookie(cookie); | ||
await page.goto(url); | ||
|
||
await page.waitForSelector('#searchInput'); | ||
|
||
await page.focus('#searchInput'); | ||
await page.type('#searchInput', 'sofa'); | ||
await page.click('#search-button'); | ||
|
||
await page.waitFor(2000); | ||
await page.waitForSelector('.sel-catalog-product-list-item') | ||
|
||
let productClass = await page.$('.sel-catalog-product-list-item') | ||
let a = await productClass.$$eval('div .itm-link', nodes => nodes.map(n => n.href)); | ||
let price = await productClass.$$eval('div .itm-price-current', nodes => nodes.map(n => n.innerText)); | ||
|
||
|
||
await page.goto(a[0]); | ||
await page.waitForFunction('!document.querySelector(".sel-cart-add-button").disabled') | ||
|
||
await page.click('.bt-buy'); | ||
await page.waitForSelector('a.close-keep-buying'); | ||
await page.waitFor(3000); | ||
await page.click('a.close-keep-buying'); | ||
await page.focus('#searchInput'); | ||
await page.type('#searchInput', 'cadeira'); | ||
await page.click('#search-button'); | ||
|
||
await page.waitFor(2000); | ||
await page.waitForSelector('.sel-catalog-product-list-item') | ||
|
||
productClass = await page.$('.sel-catalog-product-list-item') | ||
a = await productClass.$$eval('div .itm-link', nodes => nodes.map(n => n.href)); | ||
price = await productClass.$$eval('div .itm-price-current', nodes => nodes.map(n => n.innerText)); | ||
|
||
|
||
await page.goto(a[0]); | ||
await page.waitForFunction('!document.querySelector(".sel-cart-add-button").disabled') | ||
|
||
await page.click('.bt-buy'); | ||
|
||
})(); | ||
|
||
|
||
// await page.click("#radioTypeCompany"); | ||
// await page.click("#RegistrationForm_state_tax_number_free"); | ||
|
||
// await page.type("#RegistrationForm_legal_name", 'Legal name'); | ||
// await page.type("#RegistrationForm_fantasy_name", 'Legal name'); | ||
// await page.type(".company-email", '[email protected]'); | ||
// await page.type("#RegistrationForm_password", '123456'); | ||
// await page.type("#RegistrationForm_password2", '123456'); | ||
// | ||
// await page.type("#RegistrationForm_company_tax_identification","00000000000191"); | ||
// await page.select("#RegistrationForm_fk_customer_address_region", '41'); | ||
// await page.select("#RegistrationForm_fk_customer_segment", '13'); |
Oops, something went wrong.