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

remote allocator support option #1177

Closed
wants to merge 3 commits into from

Conversation

GanymedeNil
Copy link

Changes

  • Added RemoteAllocatorOption parameter to NewRemoteAllocator.
  • Param is a generic option to pass a flag to remote url. If the value is a string and isFlag is true, it will be passed as --name=value. If it's a boolean, it will be passed as --name if value is true. If isFlag is false, it will be passed as name=value. If it's a boolean, it will be passed as name if value is true.

Demo

	devtoolsWsURL := "wss://chrome.browserless.io"
	opts := []chromedp.RemoteAllocatorOption{
		chromedp.Param("token", "YOUR_API_KEY", false),
		chromedp.Param("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36", true),
	}
	allocatorContext, cancel := chromedp.NewRemoteAllocator(context.Background(), devtoolsWsURL, opts...)

@ZekeLu
Copy link
Member

ZekeLu commented Oct 15, 2022

@GanymedeNil Thank you!

Please note that URI components can not be constructed like this: fmt.Sprintf("%s=%s", name, value). They should be escaped.

Besides that, it seems that what the PR does is to construct a special URL for browserless, which I think don't have to be a part of chromedp. We are aware of that the current chromedp does not work with browserless. #990 attempts to address this issue. I want to address the issue in another way. I hope that I can prepare a PR in the next few days, and I hope that you can give it a try when it's ready.

Thank you again!

@ZekeLu
Copy link
Member

ZekeLu commented Oct 31, 2022

@GanymedeNil Sorry that I forgot to @ you from #1184. Now that #1184 was merged, I'm going to close this one. Please let me know if you think this one should not be closed.

@ZekeLu ZekeLu closed this Oct 31, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants