scout: add scout_click_coords tool, document Sourcepoint limitation
- Add scout_click_coords for manual coordinate-based clicks (useful when CSS selectors can't reach cross-origin iframes) - Document in _dismiss_cookie_banner why Sourcepoint is not auto-dismissed: HAR captures traffic regardless of banner visibility; coordinate clicks are too brittle across screen sizes - Add missing asyncio import to server.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -214,6 +214,11 @@ async def _dismiss_cookie_banner(tab) -> bool:
|
|||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Note: cross-origin full-page iframe banners (Sourcepoint on German publishers)
|
||||||
|
# are not dismissed here — coordinate clicks are too brittle across screen sizes.
|
||||||
|
# HAR recording captures network traffic regardless of banner visibility,
|
||||||
|
# so dismissal is only needed when we must click navigation elements.
|
||||||
|
# For those cases, use scout_click_coords manually.
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Usage (via .mcp.json):
|
|||||||
uv run --package scout scout-server
|
uv run --package scout scout-server
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -160,6 +161,22 @@ async def scout_analyze(har_path: str) -> str:
|
|||||||
return analyze.format_summary(summary)
|
return analyze.format_summary(summary)
|
||||||
|
|
||||||
|
|
||||||
|
@mcp.tool()
|
||||||
|
async def scout_click_coords(x: int, y: int) -> str:
|
||||||
|
"""Click at specific viewport coordinates. Useful for cross-origin iframes
|
||||||
|
where CSS selectors can't reach (e.g. Sourcepoint cookie banners on German sites).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
x: Horizontal pixel position from left edge.
|
||||||
|
y: Vertical pixel position from top edge.
|
||||||
|
"""
|
||||||
|
assert browser._state["tab"] is not None, "No browser open — call scout_visit first"
|
||||||
|
await browser._state["tab"].mouse.click(x, y)
|
||||||
|
await asyncio.sleep(1.0)
|
||||||
|
title = await browser._state["tab"].title
|
||||||
|
return f"Clicked at ({x}, {y})\nCurrent title: {title}"
|
||||||
|
|
||||||
|
|
||||||
@mcp.tool()
|
@mcp.tool()
|
||||||
async def scout_js(script: str) -> str:
|
async def scout_js(script: str) -> str:
|
||||||
"""Execute JavaScript on the current page and return the result.
|
"""Execute JavaScript on the current page and return the result.
|
||||||
|
|||||||
Reference in New Issue
Block a user