46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: false });
|
|
const context = await browser.newContext({
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
console.log('Realizando login...');
|
|
await page.goto('https://viventerisportalcredenciado.topsaudehub.com.br/', { waitUntil: 'networkidle' });
|
|
await page.fill('#usuario', '0005010');
|
|
await page.fill('#senha', 'Cclinic#03');
|
|
await page.click('#login-submit');
|
|
|
|
await page.waitForURL('**/AreaLogada**');
|
|
console.log('Login OK. Varrendo todos os links e data-href...');
|
|
|
|
await page.waitForTimeout(2000);
|
|
|
|
const links = await page.evaluate(() => {
|
|
return Array.from(document.querySelectorAll('a')).map(a => ({
|
|
text: a.innerText.trim(),
|
|
href: a.getAttribute('href'),
|
|
dataHref: a.getAttribute('data-href'),
|
|
id: a.id
|
|
}));
|
|
});
|
|
|
|
console.log('LISTA COMPLETA DE LINKS:');
|
|
links.forEach(l => {
|
|
if (l.text || l.dataHref) {
|
|
console.log(`- TEXTO: "${l.text}" | HREF: "${l.href}" | DATA-HREF: "${l.dataHref}" | ID: "${l.id}"`);
|
|
}
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('Erro:', error);
|
|
} finally {
|
|
console.log('Fim da exploração.');
|
|
await browser.close();
|
|
}
|
|
})();
|