自动化

import time

from playwright.sync_api import Playwright, sync_playwright


def get_run(playwright, url):
    browser = playwright.chromium.launch(
        channel="msedge",
        headless=True
    )
    page = browser.new_page()

    page.goto(url)
    time.sleep(10)

    # Get the final page content
    content = page.content()

    browser.close()
    return content

if __name__ == '__main__':
    with sync_playwright() as playwright:
        url='https://www.dzwww.com/xinwen/guoneixinwen/202507/t20250725_16258929.htm'
        content = get_run(playwright, url)
        print(content)

 

posted @ 2025-07-25 15:32  布都御魂  阅读(6)  评论(0)    收藏  举报