-2
HTML code:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>AutoPublic</title>
<script>
function getText()
{
document.getElementById('muda').innerHTML = 'Iniciado';
document.getElementById('muda').id = 'mudado';
}
</script>
</head>
<body>
<input type="file" id="fileimg" class="fileimg">
<br>
<br>
<input type="text" class="textpublic" id="textpublic">
<input type="button" value="Pronto" class="bsubmit" id="bsubmit" onclick="getText()">
<p id="muda">Aperte Pronto para iniciar a automação</p>
</body>
</html>
Puppeteer Code:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('file:///C:/Users/bryan.machado/Desktop/Coisas/Projetos/AutoPublic/home.html');
await page.waitForSelector('#mudado');
const publicText = await page.evaluate(() => {
return document.querySelector('input.textpublic').value;
});
await page.goto('https://www.instagram.com/');
await page.waitForSelector('input[aria-label="Telefone, nome de usuário ou email"]');
await page.type('input[aria-label="Telefone, nome de usuário ou email"]', login);
await page.type('input[aria-label="Senha"]', password);
await page.keyboard.press('Enter');
await page.waitForSelector('div.QBdPU');
await page.click('div.QBdPU');
await page.waitForSelector('div.Igw0E.IwRSH.eGOV_._4EzTm.zQLcH.XTCZH');
await page.click('div.Igw0E.IwRSH.eGOV_._4EzTm.zQLcH.XTCZH');
})();
I’m trying to get the customer to put the image in the home.html and do the automatic post for Instagram, someone can help ?