Rescrie complet fluxul de descarcare tranzactii pentru noul UI BT George
Modificari principale: - Noul flux download: expand -> tranzactii -> CSV -> Genereaza -> download - Detectie inteligenta buton Tranzactii (evita butonul Delete) - Verificare daca primul cont e deja expandat inainte de click - Selectie conturi cu 6 strategii fallback + debug logging - Handler pentru cookie consent "Accept toate" si "Am inteles" - Screenshot automat la erori de selectie cont Documentatie: - README: sectiuni noi pentru inregistrare Playwright si testare manuala - CLAUDE.md: selectori actualizati pentru noul UI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
72
CLAUDE.md
72
CLAUDE.md
@@ -4,11 +4,11 @@ This file provides guidance to Claude Code when working with code in this reposi
|
||||
|
||||
## Project Overview
|
||||
|
||||
BTGO Scraper - Playwright automation for extracting account balances and transaction CSVs from Banca Transilvania George (btgo.ro).
|
||||
BTGO Scraper - Playwright automation for extracting account balances and transaction CSVs from Banca Transilvania George (go.bancatransilvania.ro).
|
||||
|
||||
**Security Context**: Authorized personal banking automation tool for educational purposes.
|
||||
|
||||
**⚠️ CRITICAL**: Docker/headless mode is **BLOCKED by WAF**. ONLY works locally with `HEADLESS=false`.
|
||||
**CRITICAL**: Docker/headless mode is **BLOCKED by WAF**. ONLY works locally with `HEADLESS=false`.
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
@@ -54,30 +54,54 @@ login() → handle_2fa_wait() → read_accounts() → download_transactions()
|
||||
- Each card: `h4` (name), `span.text-grayscale-label` (IBAN), `strong.sold` (balance)
|
||||
- Balance format: `"7,223.26 RON"` → parse to float + currency
|
||||
|
||||
#### 4. Transaction Download Modal (lines ~312-420)
|
||||
#### 4. Transaction Download (lines ~529-732)
|
||||
|
||||
**State Machine:**
|
||||
**Flow (2024+ version):**
|
||||
```
|
||||
Account 1: Expand card → Click "Tranzacții" → Download → Back → Modal
|
||||
Account 2+: Select from modal → [ALREADY on page] → Download → Back
|
||||
Account 1: Expand card -> Click tranzactii icon -> Select "CSV" -> "Genereaza" -> Download from fba-document-item
|
||||
Account 2+: Click #selectAccountBtn -> Select by heading name -> "Genereaza" -> Download
|
||||
```
|
||||
|
||||
**Critical**: After modal selection, you're ALREADY on transactions page. Don't expand/click again.
|
||||
**Key methods:**
|
||||
- `_download_first_account()`: Handles first account (expand + select CSV format)
|
||||
- `_download_subsequent_account()`: Handles accounts 2+ (dropdown selection)
|
||||
- `_wait_and_download()`: Waits for fba-document-item and downloads
|
||||
|
||||
**Modal selectors:**
|
||||
- Modal: `.modal-content`
|
||||
- Account buttons: `#accountC14RONCRT{last_10_iban_digits}`
|
||||
- Example: IBAN `...0637236701` → `#accountC14RONCRT0637236701`
|
||||
**Account selection strategies (in order):**
|
||||
1. `get_by_role("heading", name=account_name)`
|
||||
2. `locator("fba-account-details").filter(has_text=account_name)`
|
||||
3. `get_by_text(account_name, exact=True)`
|
||||
|
||||
### Key Selectors
|
||||
|
||||
- Login: `get_by_placeholder("ID de logare")`, `get_by_placeholder("Parola")`
|
||||
- Post-login: `#accountsBtn`, `goapp.bancatransilvania.ro` domain
|
||||
- Accounts: `fba-account-details-card`, `.collapse-account-btn`, `.account-transactions-btn`
|
||||
- Modal: `.modal-content`, `#accountC14RONCRT{iban_digits}`
|
||||
- CSV: `get_by_role("button", name="CSV")`
|
||||
**Cookie consent:**
|
||||
- New (2024+): `get_by_role("button", name="Accept toate")`
|
||||
- One-time consent: `get_by_text("Am inteles")`
|
||||
|
||||
**Update selectors:** `playwright codegen https://btgo.ro --target python`
|
||||
**Login page:**
|
||||
- URL: `https://go.bancatransilvania.ro/`
|
||||
- Login link: `get_by_role("link", name="Login")`
|
||||
- Username: `get_by_placeholder("ID logare")` (intelligent fallback in `_find_username_field`)
|
||||
- Password: `get_by_placeholder("Parola")` or `input[type='password']`
|
||||
- Submit: `get_by_role("button", name="Autentifica-te")` (intelligent fallback in `_find_submit_button`)
|
||||
|
||||
**Post-login:**
|
||||
- 2FA success indicator: `#accountsBtn` visible and enabled
|
||||
- Domain: `goapp.bancatransilvania.ro`
|
||||
|
||||
**Accounts:**
|
||||
- Cards: `fba-account-details-card`
|
||||
- Expand icon: `.mx-auto .mat-icon svg`, `.collapse-account-btn`
|
||||
- Transactions button: `fba-account-buttons svg`, `.account-transactions-btn`
|
||||
|
||||
**Transaction download:**
|
||||
- Account selector: `#selectAccountBtn svg`
|
||||
- Account in dropdown: `get_by_role("heading", name=account_name)`
|
||||
- CSV format: `get_by_text("CSV", exact=True)`
|
||||
- Generate button: `get_by_role("button", name="Genereaza")`
|
||||
- Download item: `fba-document-item svg`, `fba-document-item path`
|
||||
|
||||
**Update selectors:** `playwright codegen https://go.bancatransilvania.ro --target python`
|
||||
|
||||
## Docker Limitation
|
||||
|
||||
@@ -97,17 +121,19 @@ Account 2+: Select from modal → [ALREADY on page] → Download → Back
|
||||
- **Fix**: Run locally with `HEADLESS=false`
|
||||
|
||||
### Transaction Download Timeout
|
||||
- Modal not detected: Check `.modal-content` selector
|
||||
- Account ID mismatch: Verify IBAN mapping `#accountC14RONCRT{last_10_digits}`
|
||||
- For idx > 1: Already on page, don't expand/click
|
||||
- Check `fba-document-item` selector (wait for document generation)
|
||||
- Verify `#selectAccountBtn` for account dropdown
|
||||
- Account selection: verify heading name matches exactly
|
||||
|
||||
### 2FA Timeout
|
||||
- Increase `TIMEOUT_2FA_SECONDS` in `.env`
|
||||
- Verify URL redirect to `goapp.bancatransilvania.ro`
|
||||
- Check for "Am inteles" consent dialog blocking
|
||||
|
||||
### "Nu exista card la pozitia X"
|
||||
- Trying to access cards in modal context
|
||||
- First account needs expand, subsequent accounts don't
|
||||
### Account Selection Failed
|
||||
- Account name might have changed - verify exact match
|
||||
- Try running `playwright codegen` to see current UI structure
|
||||
- Check if dropdown opened (`#selectAccountBtn`)
|
||||
|
||||
## Exit Codes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user