diff --git a/Dockers/puppeteer-api/app/services/browser.py b/Dockers/puppeteer-api/app/services/browser.py index 9d58fba..b8ce478 100644 --- a/Dockers/puppeteer-api/app/services/browser.py +++ b/Dockers/puppeteer-api/app/services/browser.py @@ -712,11 +712,14 @@ async def safe_browser_operation(url, operation_func): ), timeout=30.0) # Create context and page with timeout - context = await asyncio.wait_for(browser.new_context( - user_agent=CUSTOM_USER_AGENT, - viewport={'width': 1920, 'height': 1080}, - ignore_https_errors=True, - ), timeout=10.0) + context = await asyncio.wait_for( + browser.new_context( + user_agent=CUSTOM_USER_AGENT, + viewport={"width": 1280, "height": 720}, + ignore_https_errors=True, + ), + timeout=10.0, + ) page = await asyncio.wait_for(context.new_page(), timeout=10.0) page.set_default_timeout(30000) # 30 second timeout diff --git a/Dockers/puppeteer-api/app/utils/browser_utils.py b/Dockers/puppeteer-api/app/utils/browser_utils.py index 8c3faab..a1c4a6b 100644 --- a/Dockers/puppeteer-api/app/utils/browser_utils.py +++ b/Dockers/puppeteer-api/app/utils/browser_utils.py @@ -28,11 +28,16 @@ async def safe_browser_operation(url, operation_func): ), timeout=30.0) # Create context and page with timeout - context = await asyncio.wait_for(browser.new_context( - user_agent=CUSTOM_USER_AGENT, - viewport={'width': 1920, 'height': 1080}, - ignore_https_errors=True, - ), timeout=10.0) + context = await asyncio.wait_for( + browser.new_context( + user_agent=CUSTOM_USER_AGENT, + # Default viewport used across endpoints unless overridden per-page. + # Keeping this stable ensures coordinate-based interactions match screenshots. + viewport={"width": 1280, "height": 720}, + ignore_https_errors=True, + ), + timeout=10.0, + ) page = await asyncio.wait_for(context.new_page(), timeout=10.0) page.set_default_timeout(30000) # 30 second timeout