Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rod stuck after invoking Page method #1167

Open
devsheke opened this issue Jan 15, 2025 · 2 comments
Open

Rod stuck after invoking Page method #1167

devsheke opened this issue Jan 15, 2025 · 2 comments

Comments

@devsheke
Copy link

devsheke commented Jan 15, 2025

Rod Version: v0.116.2

OS: Ubuntu 24.04
Chromium version: 131.0.6778.264-r0
Go version: 1.23.3

Rod does not create a new page nor does it report an error. My whole program gets stuck after calling the *rod.Browser.Page method.

Function creating the browser:

// browserWrapper is an abstraction over the rod launcher and browser types.
type browserWrapper struct {
	browser  *rod.Browser
	launcher *launcher.Launcher
}

// newBrowserWrapper creates an instance of *browserWrapper and launches a new browser.
// The environment is checked for a 'BROWSER' variable with a path to a supported browser. If not found, rod
// downloads a browser and takes over.
func newBrowserWrapper(headless bool) (*browserWrapper, error) {
	wrapper := new(browserWrapper)
	if browserPath, ok := os.LookupEnv("BROWSER"); ok {
		wrapper.launcher = launcher.New().Bin(browserPath)
	} else {
		wrapper.launcher = launcher.New()
	}

	wrapper.launcher = wrapper.launcher.Headless(headless)

	controlURL, err := wrapper.launcher.Launch()
	if err != nil {
		return nil, err
	}
	wrapper.browser = rod.New().ControlURL(controlURL)
	err = wrapper.browser.Connect()

	return wrapper, err
}

This is how a new page is provisioned:

func LoginFunc(wrapper *browserWrapper) error {
	// program gets stuck at this function call.
	page, err := wrapper.browser.Page(proto.TargetCreateTarget{})
	if err != nil {
		return err
	}
	return nil
}
@Alireza-Kiani
Copy link

Alireza-Kiani commented Jan 16, 2025

Same here

Probable fix: #1114

@devsheke
Copy link
Author

Same here

Probable fix: #1114

Using a downgraded version of Alpine, namely v3.19, fixes the issue. But any reason why it seems to be broken on newer versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants