Actualizar robot.js

This commit is contained in:
2026-04-06 19:02:36 +00:00
parent 4681fd7db6
commit 063271f755

View File

@@ -303,10 +303,25 @@ async function runHomeserve(ownerId, user, pass, gremiosDB) {
console.log("🔑 [HomeServe] Formulario detectado. Rellenando datos..."); console.log("🔑 [HomeServe] Formulario detectado. Rellenando datos...");
await page.fill('input[name="CODIGO"]', user); await page.fill('input[name="CODIGO"]', user);
await page.fill('input[type="password"]', pass); await page.fill('input[type="password"]', pass);
await page.keyboard.press('Enter');
console.log("⌨️ [HomeServe] Pulsando Enter..."); // BUSCAMOS EL BOTÓN Y HACEMOS CLIC EN VEZ DE PULSAR ENTER
const botonEntrar = await page.$('input[type="submit"], input[type="button"], button');
if (botonEntrar) {
console.log("🖱️ [HomeServe] Haciendo clic en el botón de Entrar...");
await botonEntrar.click();
} else {
console.log("⌨️ [HomeServe] No vi el botón, pulsando Enter...");
await page.keyboard.press('Enter');
}
await page.waitForTimeout(5000); await page.waitForTimeout(5000);
console.log(`👀 [HomeServe] URL tras intentar login: ${page.url()}`); console.log(`👀 [HomeServe] URL tras intentar login: ${page.url()}`);
// FOTO ESPÍA: Si la URL sigue siendo la del login, hacemos una captura
if (page.url().includes('PROF_PASS')) {
console.log("📸 [HomeServe] El login falló. Guardando captura de pantalla como 'error_homeserve.png'...");
await page.screenshot({ path: 'error_homeserve.png' });
}
} else { } else {
console.log("⚠️ [HomeServe] NO se detectó el formulario de login."); console.log("⚠️ [HomeServe] NO se detectó el formulario de login.");
} }