from playwright.sync_api import sync_playwright import time def run(): with sync_playwright() as p: browser = p.chromium.launch(headless=True) context = browser.new_context(viewport={'width': 414, 'height': 896}) # iPhone 11 Pro dimensions page = context.new_page() # Go to a board page.goto('http://127.0.0.1:5000/g/') # Click on the first thread to go to thread view print("Navigating to thread...") # Try finding the link by href or text # The 'Voir le fil' button link = page.locator("a", has_text="Voir le fil").first if link.count() > 0: link.click() page.wait_for_load_state('networkidle') # Add a reply if not present (optional, but good for visualization) if page.locator("#comments-list > div").count() == 0: print("Adding a reply...") page.fill('textarea[name="content"]', "This is a test reply to check the UI.") page.click('button[type="submit"]') page.wait_for_load_state('networkidle') # Take a screenshot of the thread view print("Taking screenshot...") page.screenshot(path='verification/before_changes.png', full_page=True) else: print("Could not find a thread link. Dumping page content.") print(page.content()) browser.close() if __name__ == "__main__": run()