我试图弄清楚为什么当我 ghost.capture() 一个网页时,每次捕获都会出现 6 个错误。我正在使用 Ghost.py 和 PySide 来捕获全屏浏览器。
以下错误
QT: QPainter::begin: Paint device returned engine == 0, type: 3
QT: QPainter::setRenderHint: Painter must be active to set rendering hints
QT: QPainter::setBrush: Painter not active
QT: QPainter::pen: Painter not active
QT: QPainter::setPen: Painter not active
QT: QPainter::end: Painter not active, aborted
代码:
from ghost import Ghost
url = "someurl"
dir = "somedir"
self.ghost = Ghost()
self.ghost.set_viewport_size(1920, 0)
self.ghost.open(url)
self.ghost.capture_to(dir)
我在网上搜索并找不到任何简单的python解决方案。这个问题似乎不是 100% 出现的,但我似乎无法确切地确定为什么它在某些方面会失败,但在其他方面则不会。它可能与沉重的页面动画有关?不管怎样,这不应该只是截屏吗?