Strato browser (M0/M2): client CDP con elenco dei comandi ammessi, ChromiumProcessHost e Xvfb sorvegliati, gesti umani, mappa dei bersagli, cattura delle risposte, segnali di arresto, scaricamento dal browser, vista remota, distribuzioni del ritmo; prove unitarie e d'insieme con Chromium su Xvfb; esito locale di S5 e S6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
44 files changed
+8396
No files matched your search
@@ -0,0 +1,82 @@
|
||||
namespace Febe.Browser.Gestures;
|
||||
|
||||
/// <summary>A point in CSS pixels relative to the page viewport (the coordinate space of <c>Input.*</c>).</summary>
|
||||
public readonly record struct PagePoint(double X, double Y)
|
||||
{
|
||||
public double DistanceTo(PagePoint other) => Math.Sqrt(((X - other.X) * (X - other.X)) + ((Y - other.Y) * (Y - other.Y)));
|
||||
}
|
||||
|
||||
/// <summary>A rectangle in CSS pixels relative to the page viewport.</summary>
|
||||
public readonly record struct PageRect(double X, double Y, double Width, double Height)
|
||||
{
|
||||
public PagePoint Center => new(X + (Width / 2), Y + (Height / 2));
|
||||
|
||||
public double Right => X + Width;
|
||||
|
||||
public double Bottom => Y + Height;
|
||||
|
||||
public bool Contains(PagePoint p) => p.X >= X && p.X <= Right && p.Y >= Y && p.Y <= Bottom;
|
||||
}
|
||||
|
||||
/// <summary>An interval «from a to b» with an optional median (spec §7.2), in the unit of its use.</summary>
|
||||
public readonly record struct Interval(double Min, double Max, double? Median = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gesture timings for the «naturale» pace (spec §7.7). Every wait is multiplied by the session mood and by the
|
||||
/// pace factor. Milliseconds unless stated otherwise.
|
||||
/// </summary>
|
||||
public sealed record GestureSettings
|
||||
{
|
||||
public static GestureSettings Natural { get; } = new();
|
||||
|
||||
/// <summary>Pointer travel time.</summary>
|
||||
public Interval MoveDurationMs { get; init; } = new(250, 900);
|
||||
|
||||
/// <summary>Interval between pointer events: about 60 per second.</summary>
|
||||
public double PointerEventIntervalMs { get; init; } = 1000.0 / 60.0;
|
||||
|
||||
/// <summary>Largest sideways bend of the path, as a fraction of the distance (a slightly curved path).</summary>
|
||||
public Interval PathBendFraction { get; init; } = new(0.02, 0.12);
|
||||
|
||||
/// <summary>Part of the target, around its centre, where the pointer lands (0.6 = central 60% in each direction).</summary>
|
||||
public double CentralFraction { get; init; } = 0.6;
|
||||
|
||||
/// <summary>Hover on the target before pressing.</summary>
|
||||
public Interval HoverMs { get; init; } = new(80, 300);
|
||||
|
||||
/// <summary>Time between press and release.</summary>
|
||||
public Interval PressMs { get; init; } = new(50, 140);
|
||||
|
||||
/// <summary>Wheel events in a burst.</summary>
|
||||
public (int Min, int Max) WheelEventsPerBurst { get; init; } = (3, 8);
|
||||
|
||||
/// <summary>Pixels per wheel event.</summary>
|
||||
public Interval WheelDeltaPx { get; init; } = new(80, 140);
|
||||
|
||||
/// <summary>Interval between the wheel events of a burst.</summary>
|
||||
public Interval WheelIntervalMs { get; init; } = new(12, 40);
|
||||
|
||||
/// <summary>Pause between bursts.</summary>
|
||||
public Interval BetweenBurstsMs { get; init; } = new(400, 4000, 1100);
|
||||
|
||||
/// <summary>Bursts between two reading pauses.</summary>
|
||||
public (int Min, int Max) BurstsBeforeReading { get; init; } = (6, 10);
|
||||
|
||||
/// <summary>Reading pause.</summary>
|
||||
public Interval ReadingPauseMs { get; init; } = new(3000, 20000, 6000);
|
||||
|
||||
/// <summary>Probability of a small scroll back after a burst.</summary>
|
||||
public double ScrollBackProbability { get; init; } = 0.1;
|
||||
|
||||
/// <summary>Pixels per wheel event of a scroll back.</summary>
|
||||
public Interval ScrollBackDeltaPx { get; init; } = new(40, 100);
|
||||
|
||||
/// <summary>Wait after a page load before the first gesture.</summary>
|
||||
public Interval AfterLoadMs { get; init; } = new(1000, 6000, 2200);
|
||||
|
||||
/// <summary>Probability of a distraction after an action.</summary>
|
||||
public double DistractionProbability { get; init; } = 0.08;
|
||||
|
||||
/// <summary>Length of a distraction.</summary>
|
||||
public Interval DistractionMs { get; init; } = new(15000, 90000);
|
||||
}
|
||||
Reference in new issue
Block a user