Misc

Tabs and Windows - Multi-Context Browser Automation

Managing Tabs

NewTab(url) opens a URL in a new tab and keeps the workflow running. GoToTab(url) switches focus to the tab whose URL matches. CloseTab(url) closes a specific tab, or the current tab if called with no argument. NextTab and PreviousTab cycle through open tabs in order.

GPAL.Browser

.GoTo("https://site-a.com")

.NewTab("https://site-b.com")

.WithSelector(inputSel)

.FillInFrom("value")

.GoToTab("https://site-a.com")

.WithSelector(resultSel)

.GetGrid(out IGPALGrid<string> results)

.CloseTab("https://site-b.com")

.Close();

NOTE

All selector actions -- click, type, scrape -- target the currently focused tab. Always call GoToTab before interacting with any page that is not already the active tab.

Managing Windows

OpenWindow(url) opens a URL in a new browser window. GoToWindow(url) switches focus to the matching window. CloseWindow(url) closes it. NextWindow and PreviousWindow cycle through open windows. Maximize and Minimize affect the currently focused window.

GPAL.Browser

.GoTo("https://main-site.com")

.OpenWindow("https://other-site.com")

.WithSelector(inputSel)

.FillInFrom("value")

.GoToWindow("https://main-site.com")

.WithSelector(confirmBtn)

.LeftClick()

.CloseWindow("https://other-site.com")

.Close();

NOTE

Use tabs when you want to stay in the same browser instance. Use windows when a site opens a popup window (OAuth consent, print dialog, help pages) or when you need fully isolated session context per window.

💬 Ask GPAL