CV-Matching / scripts /captures.py
Myz0's picture
Prérequis vérifiés par règles, conditions du poste, sommaire de la fiche, colonnes qui défilent, logos
e01a936 verified
Raw History Blame Contribute Delete
2.26 kB
"""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()