INNER CODE UNIT · Go
openBrowser
int128/kubelogin · system_test/login/chromelogin/main.go:53
func openBrowser(ctx context.Context, url string) error {
for {
var location string
err := chromedp.Run(ctx,
chromedp.Navigate(url),
chromedp.Location(&location),
)
if err != nil {
return err
}
log.Printf("Location: %s", location)
if strings.HasPrefix(location, `http://`) || strings.HasPrefix(location, `https://`) {
return nil
}
time.Sleep(1 * time.Second)
}
}