Skip to content

Commit

Permalink
update shop.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fllesser committed Jan 9, 2025
1 parent d98dc20 commit b172bc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nonebot_plugin_fortnite/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ async def screenshot_shop_img() -> Path:
async with async_playwright() as p:
try:
browser = await p.chromium.launch(headless=True) # 启动无头模式的 Chromium 浏览器
page = await browser.new_page()
# page = await browser.new_page()
context = await browser.new_context(
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
)
page = await context.new_page()
await page.goto(url, timeout=60000) # 增加超时时间
await page.mouse.move(100, 100)
await page.mouse.click(100, 100)
await page.wait_for_load_state('networkidle') # 等待页面加载完成
await page.screenshot(path=shop_file, full_page=True) # 截取整个页面
except Exception as e:
Expand Down

0 comments on commit b172bc3

Please sign in to comment.