fix: 修复截图只截取可见区域的问题
改为对iframe内容进行截图而不是主页面,这样full_page=True才能正确截取iframe内的完整内容。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1361,12 +1361,18 @@ class PlaywrightAutomation:
|
||||
# 先保存到临时文件
|
||||
temp_filepath = filepath + '.tmp'
|
||||
|
||||
# 使用最高质量设置截图
|
||||
# type='jpeg' 指定JPEG格式(支持quality参数)
|
||||
# quality=100 表示100%的JPEG质量(范围0-100,最高质量)
|
||||
# full_page=True 表示截取整个页面
|
||||
# 视口分辨率 2560x1440 确保高清晰度
|
||||
# 这样可以生成更清晰的截图,大小约500KB-1MB左右
|
||||
# 获取iframe并截取完整内容
|
||||
iframe = self.get_iframe_safe()
|
||||
if iframe:
|
||||
# 对iframe内容进行全页截图
|
||||
iframe.screenshot(
|
||||
path=temp_filepath,
|
||||
type='jpeg',
|
||||
full_page=True,
|
||||
quality=100
|
||||
)
|
||||
else:
|
||||
# 如果无法获取iframe,回退到主页面截图
|
||||
self.main_page.screenshot(
|
||||
path=temp_filepath,
|
||||
type='jpeg',
|
||||
|
||||
Reference in New Issue
Block a user