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

[FEATURE REQUEST] Add ability to specify CDP websocket for a remote chrome instance #210

Open
deoxykev opened this issue Jan 4, 2024 · 0 comments

Comments

@deoxykev
Copy link

deoxykev commented Jan 4, 2024

Is your feature request related to a problem? Please describe.

  • I would like to use a remote chrome browser. My endpoint exposes the devtools via websocket, as standard practice for headless chrome. This makes it possible to use many 3rd party tools such as browserless.io.

Describe the solution you'd like

  • Via environment variable and CLI flag, you should be able to specify the websocket URL.

Describe alternatives you've considered

  • Proxy the entire machine (bad opsec)

Additional context


I think something like this could work in chrome/chrome.go, but i'm not entirely familiar with the codebase. Can you doublecheck?

	var actx chromedp.Context
	var acancel context.CancelFunc
	var devtoolsWsURL *string

	// Check if REMOTE_DEVTOOLS_WS_URL environment variable is set
	if wsURL := os.Getenv("REMOTE_DEVTOOLS_WS_URL"); wsURL != "" {
		devtoolsWsURL = &wsURL
		actx, acancel = chromedp.NewRemoteAllocator(context.Background(), *devtoolsWsURL)
	} else {
		actx, acancel = chromedp.NewExecAllocator(context.Background(), chromedp.DefaultExecAllocatorOptions...)
	}

	// Use actx and acancel here
	defer acancel()
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

1 participant