Do not try to get a screenshot if status is 4xx, 5xx

The screenshot is an additional thing we do when the capture is
successful. Why get a screenshot of 4xx/5xx responses? Its just extra
system load.
We already got the capture for archiving reasons.
This commit is contained in:
Vangelis Banos 2023-07-07 11:47:16 +00:00
parent b138b1e89b
commit dc0f2a7455

View File

@ -518,7 +518,8 @@ class Browser:
behaviors_dir=behaviors_dir)
self.run_behavior(behavior_script, timeout=behavior_timeout)
final_page_url = self.url()
if on_screenshot:
if on_screenshot and self.websock_thread.page_status and \
self.websock_thread.page_status < 400:
self._try_screenshot(on_screenshot, screenshot_full_page)
if not run_behaviors or skip_extract_outlinks:
outlinks = []