gpt4 book ai didi

python - 警告 : tile memory limits exceeded, 使用 ChromeDriver Selenium 呈现长页面时,某些内容可能无法绘制并且无法捕获屏幕截图

转载 作者:行者123 更新时间:2023-12-04 17:31:53 26 4
gpt4 key购买 nike

使用带有 Python 的 Selenium Web 驱动程序,我从一个很长的页面捕获屏幕截图。出现以下错误。通常,我可以毫无问题地获取任何页面的屏幕截图。

[1112/102333.244:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102333.296:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102333.305:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102337.235:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102337.237:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102337.241:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102337.243:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102357.562:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102357.572:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102357.585:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102357.587:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102358.050:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102358.053:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102358.058:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102358.060:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102429.223:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102429.225:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102430.153:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102430.156:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102430.158:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102430.169:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102430.170:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102503.275:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[1112/102503.278:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

Traceback (most recent call last): in get_screenshot_as_file
File "page-screen-shooter.py", line 101, in <module>
driver.save_screenshot(screen_shot_save_location + "{0}.png".format(i+1)) , in get_screenshot_as_png
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1055, in save_screenshot
return self.get_screenshot_as_file(filename)
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1032, in get_screenshot_as_file
png = self.get_screenshot_as_png()
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1064, in get_screenshot_as_png
return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1074, in get_screenshot_as_base64
return self.execute(Command.SCREENSHOT)['value']
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 1.789
(Session info: headless chrome=78.0.3904.97)

在我的代码中,我有以下选项:

chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--log-level=3")

我删除了以下选项。

chrome_options.add_argument("--start-maximized")

但是我得到了另一个错误:

selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Unable to capture screenshot"}
(Session info: headless chrome=78.0.3904.97)

最佳答案

这个错误信息...

[1112/102333.244:ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
.
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 1.789
(Session info: headless chrome=78.0.3904.97)

...表示 ChromeDriver 无法捕获 WebBrowser 的屏幕截图,即 chrome=78.0.3904.97。。 p>


根据错误跟踪日志,虽然很明显您使用的是 chrome=78.0.3904.97,但我们不确定 ChromeDriver 版本。

现在根据讨论Issue 1893: java.lang.AssertionError: unknown error: unhandled inspector error错误:

unknown error: unhandled inspector error: {"code":-32000,"message":"Unable to capture screenshot"}

是在 Windows 上捕获屏幕截图的已知问题,在 Issue 1844: Chrome 59 remote desktop chromedriver.exe saves white/blank screenshots 中进行了讨论。并通过 Chrome v60.0.3112.40 解决。


解决方案

最简单的解决方案是确保:


结尾

Issue 792: Android Emulator - Unable to capture screenshot

关于python - 警告 : tile memory limits exceeded, 使用 ChromeDriver Selenium 呈现长页面时,某些内容可能无法绘制并且无法捕获屏幕截图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58815213/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com