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: