From ad28199c1c4046028953104520044586970e60cf Mon Sep 17 00:00:00 2001 From: doubleface Date: Fri, 4 Oct 2024 16:36:27 +0200 Subject: [PATCH] wip --- src/index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index fc0f98c..ed24b82 100644 --- a/src/index.js +++ b/src/index.js @@ -23,16 +23,43 @@ class AmeliContentScript extends SuperContentScript { async gotoLoginForm() { this.launcher.log('info', '🤖 gotoLoginForm starts') await this.page.goto(baseUrl) + this.launcher.log('info', '🤖 gotoLoginForm after goto') await this.page .getByCss( - '.deconnexionButton, #connexioncompte_2nir_as, #id_r_cnx_btn_code' + '.deconnexionButton, #connexioncompte_2nir_as, a#id_r_cnx_btn_code.r_btlien.connexion' ) .waitFor() - const firstConnectLocator = this.page.getByCss('#id_r_cnx_btn_code') - if (await firstConnectLocator.isPresent()) { + this.launcher.log('info', '🤖 gotoLoginForm after first waitfor') + const deconnexionButtonPresent = await this.page + .getByCss('.deconnexionButton') + .isPresent() + this.launcher.log( + 'info', + '🐛🐛🐛 deconnexionButtonPresent ' + deconnexionButtonPresent + ) + const connexioncomptePresent = await this.page + .getByCss('#connexioncompte_2nir_as') + .isPresent() + this.launcher.log( + 'info', + '🐛🐛🐛 connexioncomptePresent ' + connexioncomptePresent + ) + const codePresent = await this.page + .getByCss('a#id_r_cnx_btn_code.r_btlien.connexion') + .isPresent() + this.launcher.log('info', '🐛🐛🐛 codePresent ' + codePresent) + const firstConnectLocator = this.page.getByCss( + 'a#id_r_cnx_btn_code.r_btlien.connexion' + ) + this.launcher.log('info', '🤖 gotoLoginForm after locator') + const isPresent = await firstConnectLocator.isPresent() + this.launcher.log('info', 'isPresent ' + isPresent) + if (isPresent) { this.launcher.log('info', 'Found firstConnectLocator') await firstConnectLocator.click() + this.launcher.log('info', 'after click') } + this.launcher.log('info', 'last waitfor') await this.page .getByCss('.deconnexionButton, #connexioncompte_2nir_as') .waitFor()