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

Installing chromium which is already installed #803

Closed
SunPodder opened this issue Feb 12, 2023 · 4 comments
Closed

Installing chromium which is already installed #803

SunPodder opened this issue Feb 12, 2023 · 4 comments
Labels
question Questions related to rod upstream Upstream issue that can't solved by Rod

Comments

@SunPodder
Copy link

SunPodder commented Feb 12, 2023

Rod Version: v0.112.5

The code to demonstrate your question

func TestRod(t *testing.T) {
	g := setup(t)
	g.cancelTimeout() // Cancel timeout protection

	// You can use the pre-launched g.browser or g.page for testing
	browser, page := g.browser, g.page

	// You can also use the g.html to serve static html content
	page.MustNavigate(g.html(doc)).MustWaitLoad()

	g.Eq(browser.MustVersion().ProtocolVersion, "1.3")
	g.Has(page.MustElement("body").MustText(), "ok")
}

It's actually the default code of rod_test.go of this repo.

What you got

[launcher.Browser]2023/02/12 10:33:12 try to find the fastest host to download the browser binary
[launcher.Browser]2023/02/12 10:33:12 check https://storage.googleapis.com/chromium-browser-snapshots//1095419/
[launcher.Browser]2023/02/12 10:33:12 check https://registry.npmmirror.com/-/binary/chromium-browser-snapshots//1095419/
[launcher.Browser]2023/02/12 10:33:12 check https://playwright.azureedge.net/builds/chromium/1095419/chromium-linux-arm64.zip
panic: Can't find a browser binary for your OS, the doc might help https://go-rod.github.io/#/compatibility?id=os

What you expected to see

Rod is trying to install chromium though I already have chromium installed and it's available in the PATH. Shouldn't it use the existing one? Why would I need to install it again?

@SunPodder SunPodder added the question Questions related to rod label Feb 12, 2023
@ysmood
Copy link
Collaborator

ysmood commented Feb 12, 2023

Rod requires static browser version, or behavior will be different between different browser version, but there's no easy way to check the browser revision (not the version, or we need a version to binary download url map).

Such as if chromium team give us a cli option like:

chromium --revision

But there's no such cli option, if you can help us to find a way then we can make a PR to add this feature.

However, you can use example code like this to use your local binary:

func Example_use_system_browser() {
if path, exists := launcher.LookPath(); exists {
u := launcher.New().Bin(path).MustLaunch()
rod.New().ControlURL(u).MustConnect()
}
}

@ysmood ysmood added the upstream Upstream issue that can't solved by Rod label Feb 12, 2023
@SunPodder
Copy link
Author

This code will do my work. However, chromium really doesn't have a way to check browser version?

It works on my system though

$ chromium --version
Chromium 109.0.5414.74

@ysmood
Copy link
Collaborator

ysmood commented Feb 12, 2023

It's revision, not version. As I said, version is useless.

@SunPodder
Copy link
Author

So you use hardcoded lookup paths instead of env path. Whatever, my issue has been resolved. #808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod upstream Upstream issue that can't solved by Rod
Projects
None yet
Development

No branches or pull requests

2 participants