Called when the resource load for a navigation fails or is canceled.
(self, browser, frame, error_code, failed_url, **_)
| 196 | cef.PostDelayedTask(cef.TID_UI, 2000, save_screenshot, browser) |
| 197 | |
| 198 | def OnLoadError(self, browser, frame, error_code, failed_url, **_): |
| 199 | """Called when the resource load for a navigation fails |
| 200 | or is canceled.""" |
| 201 | if not frame.IsMain(): |
| 202 | # We are interested only in loading main url. |
| 203 | # Ignore any errors during loading of other frames. |
| 204 | return |
| 205 | print("[screenshot.py] ERROR: Failed to load url: {url}" |
| 206 | .format(url=failed_url)) |
| 207 | print("[screenshot.py] Error code: {code}" |
| 208 | .format(code=error_code)) |
| 209 | # See comments in exit_app() why PostTask must be used |
| 210 | cef.PostTask(cef.TID_UI, exit_app, browser) |
| 211 | |
| 212 | |
| 213 | class RenderHandler(object): |