From fd67548052121660f5be0ec852819eb5e8cf38c7 Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Sun, 9 Aug 2026 23:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=A0=E8=BD=BD=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E9=99=8D=E7=BA=A7=EF=BC=9Anetworkidle=20=E8=B6=85?= =?UTF-8?q?=E6=97=B6(=E5=A4=96=E9=83=A8CDN=E6=8C=82=E8=B5=B7)=E6=97=B6?= =?UTF-8?q?=E9=99=8D=E7=BA=A7=E4=B8=BA=E7=AD=89=E5=BE=85=20load=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8C=E9=81=BF=E5=85=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=A4=96=E7=BD=91CDN=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AF=AF=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent.py b/agent.py index 0d08947..b90bbd0 100644 --- a/agent.py +++ b/agent.py @@ -139,7 +139,14 @@ class TaskRunner(threading.Thread): self._set_current(phase='打开页面', detail=self.url) self._log(f'打开页面: {self.url}') browser.open(self.url, timeout=60) - browser.wait('--load', 'networkidle', timeout=45) + # 等待页面加载:优先 networkidle;若页面依赖的外部 CDN 挂起导致 + # networkidle 永不满足,降级为等待 load 事件 + 短暂缓冲,不阻断测试 + try: + browser.wait('--load', 'networkidle', timeout=20) + except BrowserError: + self._log('networkidle 超时(可能外部 CDN 慢),降级等待 load 事件') + browser.wait('--load', 'load', timeout=30) + time.sleep(2) self._log('页面已打开') self._set_current(phase='页面已打开')