Closed marcelloh closed 7 years ago
Hi @marcelloh,
Are you asking how to run Selenium on a custom port, or are you asking how to connect to an already running instance of Selenium?
I have no idea what agouti.Selenium(options) does. If it connects to an already running Selenium, then explain what the options can do. If it starts a selenium instance somehow, then... explain what the options can do. If both is possible, then... explain what the options can do.
Agouti is documented here and at agouti.org.
agouti.Selenium()
starts an instance of Selenium WebDriver automatically. Options are listed here, but do not include an option for changing the randomized port.
If you want to configure Agouti to start Selenium on a custom port automatically, you can use agouti.NewWebDriver
, documented in detail here. See the implementation for agouti.Selenium
as an additional example.
If you already have an instance of Selenium running, you can use agouti.NewPage()
to connect to it. Just provide a URL to the webdriver.
I found out that with the following:
var agoutiDriver *agouti.WebDriver
//agoutiDriver = agouti.PhantomJS()
//agoutiDriver = agouti.Selenium()
agoutiDriver = agouti.ChromeDriver()
if err := agoutiDriver.Start(); err != nil {
panic(err)
//t.Fatal("Failed to start Chrome:", err)
}
I could actually see what was wrong. panic: failed to start service: failed to run command: exec: "chromedriver.exe": executable file not found in %PATH% where the
t.Fatal("Failed to start Chrome:", err)
gives me: panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x7495ae] which makes the error handling a bit useless for a human :-(
This is the expected behavior of the standard library testing.T.Fatal()
method -- you can't pass it a nil
interface value. The behavior is not related to Agouti.
It appears that you're running Windows and don't have ChromeDriver installed. Is this the case?
yes, a panic(err) did tell me this :-(
Can you give an example in how this should work? I did try to figure out fro the documentation, but get lost every time :-(
I see that I can use agouti.Selenium(options) but unclear to me is how those options are, and I think a more complete example would be nice