I tried going to windows firewall and opening port 4444, however this still does not work. This is the complete error I'm getting:
Failed to open session: Post http://localhost:4444/wd/hub/session: dial tcp [::1]:4444: connectex: No connection could be made because the target machine actively refused it.
And lastly this is the package I'm using: "sourcegraph.com/sourcegraph/go-selenium". I never ran into this problem in python but I assume the whole application was allowed through the firewall, so if I could do that for go that would be great.
Edit: All my code (stolen from the github example)
package main
import (
"sourcegraph.com/sourcegraph/go-selenium"
"fmt"
)
func ExampleFindElement() {
var webDriver selenium.WebDriver
var err error
caps := selenium.Capabilities(map[string]interface{}{"browserName": "firefox"})
if webDriver, err = selenium.NewRemote(caps, "http://localhost:4444/wd/hub"); err != nil {
fmt.Printf("Failed to open session: %s
", err)
return
}
defer webDriver.Quit()
err = webDriver.Get("https://sourcegraph.com/sourcegraph/go-selenium")
if err != nil {
fmt.Printf("Failed to load page: %s
", err)
return
}
if title, err := webDriver.Title(); err == nil {
fmt.Printf("Page title: %s
", title)
} else {
fmt.Printf("Failed to get page title: %s", err)
return
}
var elem selenium.WebElement
elem, err = webDriver.FindElement(selenium.ByCSSSelector, ".repo .name")
if err != nil {
fmt.Printf("Failed to find element: %s
", err)
return
}
if text, err := elem.Text(); err == nil {
fmt.Printf("Repository: %s
", text)
} else {
fmt.Printf("Failed to get text of element: %s
", err)
return
}
// output:
// Page title: go-selenium - Sourcegraph
// Repository: go-selenium
}
func main() {
ExampleFindElement()
}