使用python ghost.py截屏时未包含图像

0 投票
2 回答
1154 浏览
提问于 2025-04-17 20:52

我正在使用ghost.py这个工具来截取网页的屏幕。但是我的脚本没有捕捉到页面上的任何图片。我已经把download_images设置为True,但似乎没有效果。

我的代码:

from ghost import Ghost

ghost = Ghost(wait_timeout=4, download_images = True) #download_images not working

ghost.open('http://sex-offender.vsp.virginia.gov/sor/policy.html')

ghost.capture_to('page.png')

这就是我得到的结果 - 没有图片

2 个回答

1

我这边没法重现你遇到的问题,运行起来一切正常。我用的是Python 3。

0

为了后代参考:

这个问题只在使用 Python 2.7 的时候出现。如果你使用 Python 3.3,就没有这个问题。

撰写回答