internal FirefoxBrowserContext(string browserContextId, FirefoxConnection connection, BrowserContextOptions browserContextOptions, FirefoxBrowser browser) { _browserContextId = browserContextId; _connection = connection; _browserContextOptions = browserContextOptions; _browser = browser; }
internal FirefoxBrowser(IBrowserApp app, FirefoxConnection connection, string[] browserContextIds) { _app = app; _connection = connection; Contexts = browserContextIds.ToDictionary(id => id, id => (IBrowserContext)CreateBrowserContext(id)); DefaultContext = CreateBrowserContext(null); _connection.Disconnected += OnDisconnected; _connection.MessageReceived += OnMessageReceived; }
public FirefoxSession(FirefoxConnection connection, string targetType, string sessionId, Func <int, IFirefoxRequest <IFirefoxResponse>, Task> rawSend) { Connection = connection; _targetType = targetType; _sessionId = sessionId; _rawSend = rawSend; Connection.MessageReceived += OnMessageReceived; connection.Disconnected += OnDisconnected; }
internal static async Task <IBrowser> ConnectAsync(IBrowserApp app, ConnectOptions options) { var transport = await BrowserHelper.CreateTransportAsync(options).ConfigureAwait(false); var connection = new FirefoxConnection(transport); var response = await connection.SendAsync(new TargetGetBrowserContextsRequest()).ConfigureAwait(false); var browser = new FirefoxBrowser(app, connection, response.BrowserContextIds); await connection.SendAsync(new TargetEnableRequest()).ConfigureAwait(false); await browser.WaitForTargetAsync(t => t.Type == TargetType.Page).ConfigureAwait(false); return(browser); }
public FirefoxTarget(FirefoxConnection connection, FirefoxBrowser firefoxBrowser, IBrowserContext context, string targetId, TargetInfoType type, string url, string openerId) { _connection = connection; _browser = firefoxBrowser; _targetId = targetId; _openerId = openerId; BrowserContext = context; Type = type switch { TargetInfoType.Browser => TargetType.Browser, TargetInfoType.Page => TargetType.Page, _ => throw new ArgumentOutOfRangeException(nameof(type)) }; Url = url; }