zz3
This commit is contained in:
1 parent
54723d7f2d
commit
673257eb61
2 files changed
+16
-2
No files matched your search
Binary file not shown.
@@ -128,8 +128,22 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
|
|||||||
stderr=subprocess.DEVNULL
|
stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
|
|
||||||
# Даем браузеру время запуститься
|
# Даем браузеру время запуститься и проверяем CDP
|
||||||
await asyncio.sleep(3)
|
import time
|
||||||
|
import urllib.request
|
||||||
|
cdp_ready = False
|
||||||
|
for i in range(15): # Ждем до 15 секунд
|
||||||
|
await asyncio.sleep(1)
|
||||||
|
try:
|
||||||
|
response = urllib.request.urlopen(f"http://localhost:{REMOTE_DEBUGGING_PORT}/json/version", timeout=1)
|
||||||
|
if response.status == 200:
|
||||||
|
cdp_ready = True
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not cdp_ready:
|
||||||
|
raise RuntimeError(f"Chrome started but CDP not ready after 15s")
|
||||||
|
|
||||||
# Подключаемся через CDP
|
# Подключаемся через CDP
|
||||||
cdp_url = f"http://localhost:{REMOTE_DEBUGGING_PORT}"
|
cdp_url = f"http://localhost:{REMOTE_DEBUGGING_PORT}"
|
||||||
|
|||||||
Reference in new issue
Block a user