Files
ghostfolio-importer/playwright_t.py
2025-11-09 12:31:32 -03:00

37 lines
966 B
Python

from playwright.sync_api import sync_playwright
import time
with sync_playwright() as p:
# Launch a browser
browser = p.chromium.launch(headless=False) # Set headless=True if you don't want to see the browser
page = browser.new_page()
# Go to the login page
page.goto("https://www.investidor.b3.com.br/login")
# Fill in the username and password
page.fill('input[name="investidor"]', '01783945052')
page.click('button[type="submit"]')
time.sleep(2)
page.fill('input[type="password"]', 'malvado6696')
time.sleep(200)
page.click('input[type="checkbox"]')
page.click('button[type="submit"]')
# Wait for navigation or any element that confirms login success
page.wait_for_load_state('networkidle')
# Go to the protected page
page.goto("https://example.com/secret-page")
# Get the page content
content = page.content()
print(content)
# Close the browser
#browser.close()