From 6e29eba5f4a212346c4dc6b7475615b12ea160e0 Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 1 Apr 2026 11:17:38 +0200 Subject: [PATCH] click on point --- Dockers/puppeteer-api/app/services/browser.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Dockers/puppeteer-api/app/services/browser.py b/Dockers/puppeteer-api/app/services/browser.py index 977e83f..b90b66f 100644 --- a/Dockers/puppeteer-api/app/services/browser.py +++ b/Dockers/puppeteer-api/app/services/browser.py @@ -281,12 +281,30 @@ async def interactions_service( # Fallback to coordinate-based interactions when no selector is given. elif x is not None and y is not None: if action == "click": - await page.mouse.click(x, y) + # Use DOM elementFromPoint so React/SPA components receive real click events. + handle = await page.evaluate_handle( + "(cx, cy) => document.elementFromPoint(cx, cy)", + x, + y, + ) + try: + await handle.click() + finally: + await handle.dispose() elif action == "type": if text is None: raise ValueError("Type interaction must contain text") - await page.mouse.click(x, y) + # Focus the element at the given coordinates, then type. + handle = await page.evaluate_handle( + "(cx, cy) => document.elementFromPoint(cx, cy)", + x, + y, + ) + try: + await handle.click() + finally: + await handle.dispose() await page.keyboard.type(text) else: