feat: rag
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
|
||||
def test_website():
|
||||
with sync_playwright() as p:
|
||||
# 启动浏览器
|
||||
browser = p.chromium.launch(headless=True) # headless=False 显示浏览器窗口
|
||||
page = browser.new_page()
|
||||
|
||||
# 访问网页
|
||||
page.goto("https://www.baidu.com")
|
||||
|
||||
# 截图
|
||||
page.screenshot(path="example.png")
|
||||
|
||||
# 获取页面标题
|
||||
title = page.title()
|
||||
print(f"页面标题: {title}")
|
||||
|
||||
# 关闭浏览器
|
||||
browser.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_website()
|
||||
Reference in New Issue
Block a user