112 lines
4 KiB
Python
112 lines
4 KiB
Python
#!/usr/bin/env python3
|
|
"""Debug script to inspect the page structure after login."""
|
|
|
|
import time
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
BASE_URL = 'https://archief.support'
|
|
LOGIN_EMAIL = 'scott@bronhouder.nl'
|
|
LOGIN_PASSWORD = 'Olivi@1985'
|
|
|
|
def debug_page():
|
|
print('🔍 Debugging page structure\n')
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=False, slow_mo=200)
|
|
context = browser.new_context()
|
|
page = context.new_page()
|
|
|
|
try:
|
|
# Navigate
|
|
print('Navigating to archief.support...')
|
|
page.goto(BASE_URL)
|
|
page.wait_for_load_state('networkidle')
|
|
|
|
# Check if login is needed
|
|
login_button = page.locator('button:has-text("Inloggen")')
|
|
if login_button.is_visible(timeout=3000):
|
|
print('Logging in...')
|
|
login_button.click()
|
|
time.sleep(1)
|
|
|
|
page.fill('input[type="email"], input[name="email"]', LOGIN_EMAIL)
|
|
page.fill('input[type="password"], input[name="password"]', LOGIN_PASSWORD)
|
|
page.click('button[type="submit"]')
|
|
page.wait_for_load_state('networkidle')
|
|
time.sleep(2)
|
|
|
|
# Print page info
|
|
print('\n📄 Page title:', page.title())
|
|
print('📍 URL:', page.url)
|
|
|
|
# Find all input elements
|
|
print('\n🔍 Looking for input fields:')
|
|
inputs = page.locator('input, textarea')
|
|
count = inputs.count()
|
|
print(f'Found {count} input/textarea elements')
|
|
|
|
for i in range(min(count, 10)):
|
|
el = inputs.nth(i)
|
|
try:
|
|
tag = el.evaluate('el => el.tagName')
|
|
type_attr = el.evaluate('el => el.type || ""')
|
|
placeholder = el.evaluate('el => el.placeholder || ""')
|
|
visible = el.is_visible()
|
|
print(f' [{i}] <{tag}> type={type_attr} placeholder="{placeholder}" visible={visible}')
|
|
except:
|
|
pass
|
|
|
|
# Find all buttons
|
|
print('\n🔍 Looking for buttons:')
|
|
buttons = page.locator('button')
|
|
count = buttons.count()
|
|
print(f'Found {count} button elements')
|
|
|
|
for i in range(min(count, 15)):
|
|
btn = buttons.nth(i)
|
|
try:
|
|
text = btn.inner_text()
|
|
visible = btn.is_visible()
|
|
print(f' [{i}] "{text[:50]}" visible={visible}')
|
|
except:
|
|
pass
|
|
|
|
# Take a screenshot
|
|
page.screenshot(path='/tmp/archief-debug.png')
|
|
print('\n📸 Screenshot saved to /tmp/archief-debug.png')
|
|
|
|
# Check for chat input specifically
|
|
print('\n🔍 Looking for chat input:')
|
|
possible_selectors = [
|
|
'textarea',
|
|
'input[type="text"]',
|
|
'[contenteditable="true"]',
|
|
'.chat-input',
|
|
'#chat-input',
|
|
'[data-testid="chat-input"]',
|
|
'[placeholder*="vraag"]',
|
|
'[placeholder*="bericht"]',
|
|
]
|
|
|
|
for sel in possible_selectors:
|
|
try:
|
|
el = page.locator(sel).first
|
|
if el.is_visible(timeout=1000):
|
|
print(f' ✅ Found visible: {sel}')
|
|
else:
|
|
print(f' ❌ Not visible: {sel}')
|
|
except:
|
|
print(f' ❌ Not found: {sel}')
|
|
|
|
print('\n📌 Browser staying open for 60 seconds...')
|
|
time.sleep(60)
|
|
|
|
except Exception as e:
|
|
print(f'Error: {e}')
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
browser.close()
|
|
|
|
if __name__ == '__main__':
|
|
debug_page()
|