Add browser automation resource commands - #16706
Draft
David Fowler (davidfowl) wants to merge 1 commit into
Draft
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16706Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16706" |
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
from
May 3, 2026 16:45
8db7f6f to
2a0481b
Compare
David Fowler (davidfowl)
changed the base branch from
main
to
davidfowl/resource-command-features
May 3, 2026 16:45
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
2 times, most recently
from
May 3, 2026 17:19
e90667e to
2e0e8e2
Compare
Contributor
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
from
May 3, 2026 20:32
2e0e8e2 to
8a8577c
Compare
David Fowler (davidfowl)
force-pushed
the
davidfowl/resource-command-features
branch
from
May 8, 2026 04:42
8d54b4b to
a79e590
Compare
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
from
May 9, 2026 02:00
8a8577c to
40e5301
Compare
David Fowler (davidfowl)
changed the base branch from
davidfowl/resource-command-features
to
main
May 9, 2026 02:01
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
7 times, most recently
from
May 9, 2026 03:54
1b8feda to
f94de82
Compare
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
3 times, most recently
from
May 9, 2026 06:45
183cf29 to
f200479
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
David Fowler (davidfowl)
force-pushed
the
davidfowl/browser-improvements
branch
from
May 17, 2026 07:16
f200479 to
10588c1
Compare
David Fowler (davidfowl)
marked this pull request as ready for review
May 17, 2026 07:21
David Fowler (davidfowl)
marked this pull request as draft
May 17, 2026 07:21
Contributor
|
❓ CLI E2E Tests unknown — 85 passed, 0 failed, 1 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #25984420370 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This builds on the browser diagnostics work and turns the browser child resource into a browser automation resource that can be driven from the dashboard/resource-command API. The goal is to make local web apps inspectable and operable by agents and humans without leaving the Aspire app model: open a tracked browser, inspect the current page, run common interactions, wait for UI readiness, capture screenshots, and stream browser diagnostics back into resource logs.
The user-visible behavior is:
WithBrowserAutomation()adds a browser child resource for an HTTP/HTTPS resource.Aspire:Hosting:Browserconfiguration, or the dashboard configure command.Implementation details:
Aspire:Hosting:BrowserAutomationsettings.Runtime.evaluate.User-facing usage
C# AppHost:
Optional explicit browser configuration:
Configuration can also set global or resource-specific defaults:
{ "Aspire": { "Hosting": { "Browser": { "Browser": "msedge", "UserDataMode": "Shared", "Profile": "Default", "frontend": { "Browser": "chrome" } } } } }Examples of resource-command payloads exposed by the browser child resource:
{ "command": "inspect-browser", "arguments": { "maxElements": 80, "maxTextLength": 8000 } }{ "command": "click-browser", "arguments": { "selector": "#submit", "snapshotAfter": true } }{ "command": "wait", "arguments": { "urlContains": "/dashboard", "timeoutMilliseconds": 3000 } }{ "command": "capture-screenshot", "arguments": { "format": "jpeg", "quality": 80, "fullPage": true } }Security considerations
This change needs security review because it introduces browser automation capabilities that spawn local Chromium-based browser processes, create persistent Aspire-managed browser user data directories, evaluate generated JavaScript in the tracked page through CDP, accept command input used for selectors/URLs/CDP parameters/file paths, and expose upload/download/screenshot commands.
Important boundaries and mitigations in this PR:
Validation:
./dotnet.sh build src/Aspire.Hosting.Browsers/Aspire.Hosting.Browsers.csproj --no-restore /p:SkipNativeBuild=true --nologo -v:minimal./dotnet.sh test --project tests/Aspire.Hosting.Browsers.Tests/Aspire.Hosting.Browsers.Tests.csproj --no-launch-profile -- --filter-method "*.WithBrowserAutomation_BrowserCommandsForwardArgumentsAndReturnJson" --filter-method "*.WithBrowserAutomation_BrowserCommandValidationRejectsInvalidArgumentsBeforeExecution" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"./dotnet.sh test --project tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-method "*.Scanner_BrowsersAssembly_WithBrowserAutomationCapability" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"git diff --checkFixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?