Avoid browser permission bubbles (outside the DOM and invisible to snapshots) by setting a policy at startup, and applying explicit permission changes mid-run when supported.
This guide covers:
Treat permissions as part of verification.
Permission prompts are not actionable UI. Prefer a startup policy and explicit mid-run tools so your trace shows what you granted, when, and why.
PermissionPolicyOn Chrome (and Chromium-based browsers), site permission prompts (geolocation, notifications, etc.) are often native browser UI. They are:
If your agent “hangs” at a permission prompt, it’s usually because it can’t see or reason about it. The fix is to treat permissions as context configuration.
PermissionPolicyPermissionPolicy is applied when the browser context is created — before any navigation.
| Field | Meaning |
|---|---|
default | Default behavior on context creation: |
autoGrant / auto_grant | Permissions to grant up front (e.g., ["geolocation"]). |
geolocation | Optional geolocation to set on the browser context. |
origin | Optional origin scope for permission grants (when supported). |
When you’re using the Tool Registry, you can change permissions explicitly as part of a step.
| Tool | What it does |
|---|---|
grant_permissions | Grant one or more permissions for the current context. |
clear_permissions | Clear permissions for the current context. |
set_geolocation | Set geolocation on the current context (lat/lng, optional accuracy). |
from predicate import PredicateBrowser, PermissionPolicy
policy = PermissionPolicy(
default="clear",
auto_grant=["geolocation", "notifications"],
geolocation={"latitude": 37.7749, "longitude": -122.4194},
)
browser = PredicateBrowser(permission_policy=policy)
browser.start()from predicate.tools import ToolRegistry, ToolContext, register_default_tools
registry = ToolRegistry()
register_default_tools(registry, runtime)
ctx = ToolContext(runtime)
await registry.execute("grant_permissions", {"permissions": ["geolocation"]}, ctx=ctx)
await registry.execute("set_geolocation", {"latitude": 37.77, "longitude": -122.41}, ctx=ctx)PermissionPolicy before navigation (context creation time).