Spaces:
Sleeping
Sleeping
update
Browse files- app/server.py +4 -2
app/server.py
CHANGED
@@ -4,7 +4,7 @@ from fastapi import FastAPI, Request, Form
|
|
4 |
from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
5 |
from fastapi.staticfiles import StaticFiles
|
6 |
from fastapi.templating import Jinja2Templates
|
7 |
-
from helium import start_chrome, kill_browser,
|
8 |
import uuid
|
9 |
import logging
|
10 |
import pathlib
|
@@ -73,7 +73,9 @@ async def take_screenshot(url: str = Form(...)):
|
|
73 |
|
74 |
try:
|
75 |
logger.info(f"Taking screenshot at {filepath}")
|
76 |
-
|
|
|
|
|
77 |
logger.info(f"Screenshot saved to {filepath}")
|
78 |
finally:
|
79 |
# Always kill the browser to free resources
|
|
|
4 |
from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
5 |
from fastapi.staticfiles import StaticFiles
|
6 |
from fastapi.templating import Jinja2Templates
|
7 |
+
from helium import start_chrome, kill_browser, get_driver
|
8 |
import uuid
|
9 |
import logging
|
10 |
import pathlib
|
|
|
73 |
|
74 |
try:
|
75 |
logger.info(f"Taking screenshot at {filepath}")
|
76 |
+
# Utiliser get_driver et save_screenshot pour prendre la capture d'écran
|
77 |
+
selenium_driver = get_driver()
|
78 |
+
selenium_driver.save_screenshot(filepath)
|
79 |
logger.info(f"Screenshot saved to {filepath}")
|
80 |
finally:
|
81 |
# Always kill the browser to free resources
|