Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Mac OS-specific way to start Selenium server #34

Closed
abourget opened this issue Jan 14, 2015 · 8 comments
Closed

Mac OS-specific way to start Selenium server #34

abourget opened this issue Jan 14, 2015 · 8 comments

Comments

@abourget
Copy link
Contributor

The "selenium-server" script that must be in the path seems to be installed by the brew recipe.. however I didn't find the equivalent on Linux. I was thinking of adding SeleniumJar() that would launch the .jar file through java -jar whatever.jar.is.in.the.current.directory.jar.

What do you think ?

@sclevine
Copy link
Owner

This is definitely an issue. How about extending Selenium() to detect which version is present in path, and also providing something like Run(command string, url string) that would run a command that expects to host a WebDriver service on the provided URL?

@abourget
Copy link
Contributor Author

Yeah.. I'd extend the current Selenium call to do more autodetection.. even
looking for a .jar in the current directory.. what do you think ?

@sclevine
Copy link
Owner

A JAR in the current directory may not be the most ideal solution. Many people run their tests (using Ginkgo, or go test) from the directory they are working in. Agouti is a library, and so we probably shouldn't rely on the current directory that its consumer happens to be running in.

I think providing a custom core.Driver(command string, url string) where, in your case:

  • command is something like "java -jar your-selenium.jar -port {{port}}"
  • url is something like "http://{{address}}:{{port}}/wd/hub"

would provide everyone with free-address generation and the generic process management features of the service package that are missing from `core.Connect().

It seems like the packaged binary is called selenium-server on both OS X and Linux, so I actually feel like that function should stay as-is.

@abourget
Copy link
Contributor Author

I'm not sure how to proceed anymore.. there are several projects that kind of wrap running the selenium-server .jar with one command, for each platforms, in node, etc.. I was thinking maybe I'd write a simple "selenium-server" package .. that we could install separately, and that would be in the $GOPATH/bin.. so we could require that to be installed alongside agouti, the same for all platforms.. and all the platform specific kinks sorted out in there.

What do you think ?

Doing some detection in the Selenium() function, and platform-specific stuff, didn't seem like the right place to do so.. and it could be useful outside of it.

@sclevine
Copy link
Owner

I added what I described above in 9b538c3.
Instead of core.Selenium(), use:

  command := []string{"java", "-jar", "selenium-server.jar", "-port", "{{.Port}}"}
  core.CustomWebDriver("http://{{.Address}}/wd/hub", command)

Does this work for you? You can modify it to run a Selenium JAR located anywhere you want.

@abourget
Copy link
Contributor Author

This would work for the simple case, thanks for putting it in..

Since my test suite needs to run on a many people's machine, on 3 platforms.. having a simple executable that downloads the .jar, and runs it as needed, all with a single name would be useful anyawy. And in this case, I'd simply use the Selenium() call. (I assume they already have the Go env as they are developing tests for Agouti).

@sclevine
Copy link
Owner

So does the current combination of core.Selenium() and core.CustomWebDriver() cover your use case? Can I close this issue?

@abourget
Copy link
Contributor Author

yes thanks :)

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

No branches or pull requests

2 participants