Tabs & Windows

Close Window

Closes a browser window based on the current active window, a specified window ID, or a URL match within the window's tabs.

Examples

GPAL Fluent: High-level fluent C# API

browser.CloseWindow()

browser.CloseWindow(string url)

browser.CloseWindow(int tabId)

MagicHelper: MagicHelper utility library

browser.MagicHelper.CloseWindow();

browser.MagicHelper.CloseWindow(string url);

browser.MagicHelper.CloseWindow(int tabId);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.CloseWindow().Execute();

browser.PuppeteerClient.CloseWindow(string url).Execute();

browser.PuppeteerClient.CloseWindow(int tabId).Execute();

Puppeteer Communicator: Low-level communicator

//Closes a whole browser context rather than a tab, which is what a window is at the CDP layer.

await browser.PuppeteerCommunicator.CloseWindow(string browserContextId, string sessionId);

REST Client: Direct REST/HTTP client

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.CloseWindow).Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.CloseWindow).WithUrl(string url).Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.CloseWindow).WithTabId(int tabId).Execute();

💬 Ask GPAL