Spaces:
Running on Zero
Running on Zero
File size: 2,263 Bytes
e01a936 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | """Captures d'écran de l'interface web (service lancé) + texte exact des résultats affichés.
Lancer, service démarré sur le port 7860 :
python -m scripts.captures resultats/<date> [http://127.0.0.1:7860]
Produit : 5_interface_candidat.png, 6_interface_recruteur.png et les textes .md associés.
"""
import sys
from pathlib import Path
from playwright.sync_api import sync_playwright
DOSSIER = Path(sys.argv[1])
URL = sys.argv[2] if len(sys.argv) > 2 else "http://127.0.0.1:7860"
AVP_RECRUTEUR = "3134-26-1419/SR" # Auditeur : le vivier des 23 CV fictifs est classé pour lui
DELAI_MS = 10 * 60 * 1000 # le classement de 23 CV peut prendre ~1-2 min sur GPU
def sauver_texte(page, nom):
texte = page.locator(".prose").last.inner_text()
(DOSSIER / nom).write_text(texte, encoding="utf-8")
print(f" -> {DOSSIER / nom}")
with sync_playwright() as p:
nav = p.chromium.launch()
page = nav.new_page(viewport={"width": 1280, "height": 900}, device_scale_factor=1.5)
page.goto(URL, wait_until="networkidle")
# Onglet candidat : CV fictif par défaut (auditeur), AVP clos inclus
case = page.get_by_label("Inclure les AVP clos")
if not case.is_checked():
case.check()
page.get_by_role("button", name="Trouver mes AVP").click()
page.get_by_text("AVP analysés").wait_for(timeout=DELAI_MS)
page.screenshot(path=DOSSIER / "5_interface_candidat.png", full_page=True)
print(f" -> {DOSSIER / '5_interface_candidat.png'}")
sauver_texte(page, "5_interface_candidat.md")
# Onglet recruteur : AVP Auditeur, vivier des 23 CV fictifs
page.get_by_role("tab", name="Je recrute").click()
liste = page.get_by_label("AVP à pourvoir")
liste.click()
liste.fill(AVP_RECRUTEUR.split("/")[0])
page.get_by_role("option").filter(has_text=AVP_RECRUTEUR).first.click()
page.get_by_role("button", name="Classer les candidats").click()
page.get_by_text("Attendus les plus discriminants").wait_for(timeout=DELAI_MS)
page.screenshot(path=DOSSIER / "6_interface_recruteur.png", full_page=True)
print(f" -> {DOSSIER / '6_interface_recruteur.png'}")
sauver_texte(page, "6_interface_recruteur.md")
nav.close()
|