Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions cmd/browsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,16 @@
}

// Prepare table data
headers := []string{"Browser ID", "Created At", "Persistent ID", "Profile", "CDP WS URL", "Live View URL"}
headers := []string{"Browser ID", "Created At", "Persistent ID", "Profile", "Pool", "CDP WS URL", "Live View URL"}
if in.IncludeDeleted {
headers = append(headers, "Deleted At")
}
tableData := pterm.TableData{headers}

for _, browser := range browsers {
// log the browser
pterm.Info.Println(browser)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logging accidentally left in production code

Debug logging statement pterm.Info.Println(browser) was accidentally left in the code. This will print the raw browser object to the terminal for every browser in the list, cluttering the output and confusing users. The comment "log the browser" confirms this was temporary debugging code that should have been removed before committing.

Fix in Cursor Fix in Web


persistentID := "-"
if browser.Persistence.ID != "" {
persistentID = browser.Persistence.ID
Expand All @@ -262,11 +265,18 @@
profile = browser.Profile.ID
}

// Check for pool_id in ExtraFields (until SDK is updated with PoolID field)
poolID := "-"
if browser.PoolID != "" {

Check failure on line 270 in cmd/browsers.go

View workflow job for this annotation

GitHub Actions / test

browser.PoolID undefined (type kernel.BrowserListResponse has no field or method PoolID)
poolID = browser.PoolID

Check failure on line 271 in cmd/browsers.go

View workflow job for this annotation

GitHub Actions / test

browser.PoolID undefined (type kernel.BrowserListResponse has no field or method PoolID)
}

row := []string{
browser.SessionID,
util.FormatLocal(browser.CreatedAt),
persistentID,
profile,
poolID,
truncateURL(browser.CdpWsURL, 50),
truncateURL(browser.BrowserLiveViewURL, 50),
}
Expand Down Expand Up @@ -363,17 +373,17 @@
return util.CleanedUpSdkError{Err: err}
}

printBrowserSessionResult(browser.SessionID, browser.CdpWsURL, browser.BrowserLiveViewURL, browser.Persistence, browser.Profile)
printBrowserSessionResult(browser.SessionID, browser.CdpWsURL, browser.BrowserLiveViewURL, browser.PoolID, browser.Persistence, browser.Profile)

Check failure on line 376 in cmd/browsers.go

View workflow job for this annotation

GitHub Actions / test

browser.PoolID undefined (type *kernel.BrowserNewResponse has no field or method PoolID)
return nil
}

func printBrowserSessionResult(sessionID, cdpURL, liveViewURL string, persistence kernel.BrowserPersistence, profile kernel.Profile) {
tableData := buildBrowserTableData(sessionID, cdpURL, liveViewURL, persistence, profile)
func printBrowserSessionResult(sessionID, cdpURL, liveViewURL, poolID string, persistence kernel.BrowserPersistence, profile kernel.Profile) {
tableData := buildBrowserTableData(sessionID, cdpURL, liveViewURL, poolID, persistence, profile)
PrintTableNoPad(tableData, true)
}

// buildBrowserTableData creates a base table with common browser session fields.
func buildBrowserTableData(sessionID, cdpURL, liveViewURL string, persistence kernel.BrowserPersistence, profile kernel.Profile) pterm.TableData {
func buildBrowserTableData(sessionID, cdpURL, liveViewURL, poolID string, persistence kernel.BrowserPersistence, profile kernel.Profile) pterm.TableData {
tableData := pterm.TableData{
{"Property", "Value"},
{"Session ID", sessionID},
Expand All @@ -392,6 +402,9 @@
}
tableData = append(tableData, []string{"Profile", profVal})
}
if poolID != "" {
tableData = append(tableData, []string{"Pool ID", poolID})
}
return tableData
}

Expand Down Expand Up @@ -497,6 +510,7 @@
browser.SessionID,
browser.CdpWsURL,
browser.BrowserLiveViewURL,
browser.PoolID,

Check failure on line 513 in cmd/browsers.go

View workflow job for this annotation

GitHub Actions / test

browser.PoolID undefined (type *kernel.BrowserGetResponse has no field or method PoolID)
browser.Persistence,
browser.Profile,
)
Expand Down Expand Up @@ -2075,7 +2089,7 @@
pterm.Error.Println("Acquire request timed out (no browser available). Retry to continue waiting.")
return nil
}
printBrowserSessionResult(resp.SessionID, resp.CdpWsURL, resp.BrowserLiveViewURL, resp.Persistence, resp.Profile)
printBrowserSessionResult(resp.SessionID, resp.CdpWsURL, resp.BrowserLiveViewURL, resp.PoolID, resp.Persistence, resp.Profile)

Check failure on line 2092 in cmd/browsers.go

View workflow job for this annotation

GitHub Actions / test

resp.PoolID undefined (type *kernel.BrowserPoolAcquireResponse has no field or method PoolID)
return nil
}

Expand Down
Loading