21 lines
655 B
Python
Executable file
21 lines
655 B
Python
Executable file
from playwright.sync_api import sync_playwright, Playwright
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
load_dotenv()
|
|
|
|
def run(playwright: Playwright):
|
|
chromium = playwright.chromium # or "firefox" or "webkit".
|
|
browser = chromium.launch()
|
|
page = browser.new_page()
|
|
response = page.goto(os.getenv("URL"))
|
|
page.fill("input#ctl00_ContentPlaceHolder1_txtLoginID", os.getenv("USERNAME"))
|
|
page.fill("input#ctl00_ContentPlaceHolder1_txtPassword", os.getenv("PASSWORD"))
|
|
page.click("input#ctl00_ContentPlaceHolder1_btnLogin")
|
|
#
|
|
print(page.content())
|
|
browser.close()
|
|
|
|
with sync_playwright() as playwright:
|
|
run(playwright) |