| 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}) |
| page = context.new_page() |
|
|
| |
| page.goto('http://127.0.0.1:5000/g/') |
|
|
| |
| print("Navigating to thread...") |
| |
| |
| link = page.locator("a", has_text="Voir le fil").first |
| if link.count() > 0: |
| link.click() |
| page.wait_for_load_state('networkidle') |
|
|
| |
| 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') |
|
|
| |
| 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() |
|
|