Actualizar robot.js
This commit is contained in:
19
robot.js
19
robot.js
@@ -303,10 +303,25 @@ async function runHomeserve(ownerId, user, pass, gremiosDB) {
|
||||
console.log("🔑 [HomeServe] Formulario detectado. Rellenando datos...");
|
||||
await page.fill('input[name="CODIGO"]', user);
|
||||
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);
|
||||
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 {
|
||||
console.log("⚠️ [HomeServe] NO se detectó el formulario de login.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user