relay: app-shot-light uses its own Edge profile and waits for the headless browser (the first run handed off to the user's Edge and wrote nothing)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
a9c3167802
commit
d695948d2e
1 changed files with 8 additions and 2 deletions
|
|
@ -9,9 +9,15 @@ $url = (Get-Content $urlFile -Raw).Trim()
|
|||
$edge = @("$env:ProgramFiles (x86)\Microsoft\Edge\Application\msedge.exe", "$env:ProgramFiles\Microsoft\Edge\Application\msedge.exe") | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if (-not $edge) { Write-Host "ERROR: Edge not found"; exit 2 }
|
||||
$out = Join-Path $env:TEMP 'igneum-shots'; New-Item -ItemType Directory -Force -Path $out | Out-Null
|
||||
# a profile of its own, or the launcher hands the request to the user's running Edge and returns at once with no file
|
||||
# (run-20261006-222112 on PC 2: both shots missing in 0 s); -Wait holds until the headless browser exits
|
||||
$profile = Join-Path $out 'profile'; New-Item -ItemType Directory -Force -Path $profile | Out-Null
|
||||
foreach ($page in @('overview', 'cards')) {
|
||||
$png = Join-Path $out "igneum-$page-light-1440.png"
|
||||
& $edge --headless=new --disable-gpu --hide-scrollbars --window-size=1440,1000 --virtual-time-budget=6000 "--screenshot=$png" "$url?page=$page&visible=1" 2>$null | Out-Null
|
||||
if (Test-Path $png) { Write-Host "RESULT shot=$page bytes=$((Get-Item $png).Length)"; & $env:RELAY_SEND -TaskId ([long]$env:RELAY_TASK_ID) -Title "app $page light" $png } else { Write-Host "RESULT shot=$page missing" }
|
||||
if (Test-Path $png) { Remove-Item $png -Force }
|
||||
$args = @('--headless=new', '--disable-gpu', '--hide-scrollbars', '--no-first-run', '--window-size=1440,1000', '--virtual-time-budget=8000', "--user-data-dir=$profile", "--screenshot=$png", "$url?page=$page&visible=1")
|
||||
$p = Start-Process -FilePath $edge -ArgumentList $args -Wait -PassThru -WindowStyle Hidden
|
||||
$tries = 0; while (-not (Test-Path $png) -and $tries -lt 20) { Start-Sleep -Milliseconds 500; $tries++ }
|
||||
if (Test-Path $png) { Write-Host "RESULT shot=$page bytes=$((Get-Item $png).Length) edge_exit=$($p.ExitCode)"; & $env:RELAY_SEND -TaskId ([long]$env:RELAY_TASK_ID) -Title "app $page light" $png } else { Write-Host "RESULT shot=$page missing edge_exit=$($p.ExitCode)" }
|
||||
}
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue