Last active
August 31, 2020 14:57
-
-
Save fenriz07/a816c29b6f02ee61a75bad2c116afe8b to your computer and use it in GitHub Desktop.
Puppeteer Transbank - OneClick
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 characters
const puppeteer = require('puppeteer'); | |
var browser = (async () => { | |
const browser = await puppeteer.launch({ | |
//headless: false, | |
slowMo: 10, | |
ignoreHTTPSErrors: true | |
}); | |
//OneClick | |
const inscription = 'app-inscription'; | |
await page.waitForSelector(inscription); | |
const typesPayment = await page.$$('a.method'); | |
await typesPayment[0].click(); | |
const inputCardNumber = '#visa-card-show'; | |
const inputCodeCard = '#password-invalid'; | |
await page.waitForSelector(inputCardNumber); | |
await page.waitForSelector(inputCodeCard); | |
await page.type(inputCardNumber,'4051885600446623'); | |
await page.type(inputCodeCard,'123') | |
const continuePay = 'button.button.new-marg.next-padd'; | |
await page.waitForSelector(continuePay); | |
await page.click(continuePay) | |
//Pagina del banco | |
await page.waitForSelector('frame'); | |
const myframe = await page.frames()[2]; | |
let inputRutClient = 'input[name="rutClient"]'; | |
let inputPasswordClient = 'input[name="passwordClient"]'; | |
let inputSendDataToBank = 'input[type="submit"]'; | |
await myframe.waitForSelector(inputRutClient,{ | |
visible : true | |
}); | |
await myframe.type(inputRutClient, "11.111.111-1"); | |
await myframe.waitForSelector(inputPasswordClient,{ | |
visible : true | |
}); | |
await myframe.type(inputPasswordClient, "123"); | |
await myframe.waitForSelector(inputSendDataToBank); | |
await myframe.click(inputSendDataToBank); | |
let inputContinute = 'input[type="submit"][value="Continuar"]'; | |
await myframe.waitForSelector(inputContinute); | |
await myframe.click(inputContinute); | |
await browser.close(); | |
}); | |
browser() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment