8163c37e83
- 删除 bilibili_extractor.py 及相关文档和配置 - 删除 bilibili_venv 虚拟环境 - 删除测试脚本和生成的B站笔记 - 以后使用 skills/obsidian-kb 提供的B站提取功能
46 lines
891 B
Python
46 lines
891 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试 Playwright 基本功能
|
|
"""
|
|
|
|
import asyncio
|
|
from playwright.async_api import async_playwright
|
|
|
|
|
|
async def test_playwright():
|
|
"""测试 Playwright"""
|
|
print("开始测试 Playwright...")
|
|
|
|
playwright = await async_playwright().start()
|
|
|
|
print("Playwright 启动成功")
|
|
|
|
browser = await playwright.chromium.launch(
|
|
headless=True,
|
|
args=['--no-sandbox', '--disable-setuid-sandbox']
|
|
)
|
|
|
|
print("浏览器启动成功")
|
|
|
|
page = await browser.new_page()
|
|
|
|
print("页面创建成功")
|
|
|
|
await page.goto('https://www.baidu.com', timeout=30000)
|
|
|
|
print("页面加载成功")
|
|
|
|
title = await page.title()
|
|
|
|
print(f"页面标题: {title}")
|
|
|
|
await browser.close()
|
|
await playwright.stop()
|
|
|
|
print("测试完成")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(test_playwright())
|