// CreateDriver starts a driver and sets up the session
CreateDriver starts a driver and sets up the session
// CreateDriver starts a driver and sets up the session
func CreateDriver(chromedriverpath string, port int) (Driver, error) {
	prt := strconv.Itoa(port)
	cmd := exec.Command(chromedriverpath, "--port="+prt)
	if err := cmd.Start(); err != nil {
		return Driver{}, err
	}
	capabilities := goselenium.Capabilities{}
	capabilities.SetBrowser(goselenium.ChromeBrowser())
	driver, err := goselenium.NewSeleniumWebDriver("http://localhost:"+prt, capabilities)
	if err != nil {
		return Driver{}, err
	}
	_, err = driver.CreateSession()
	if err != nil {
		return Driver{}, err
	}
	drv := Driver{
		driver: driver,
		cmd:    cmd,
	}
	return drv, nil
}
func CreateDriver ( chromedriverpath string , port int ) ( Driver , error ) { prt := strconv . Itoa ( port ) cmd := exec . Command ( chromedriverpath , " " + prt ) if err := cmd . Start ( ) ; err != nil { return Driver { } , err } capabilities := goselenium . Capabilities { } capabilities . SetBrowser ( goselenium . ChromeBrowser ( ) ) driver , err := goselenium . NewSeleniumWebDriver ( " " + prt , capabilities ) if err != nil { return Driver { } , err } _ , err = driver . CreateSession ( ) if err != nil { return Driver { } , err } drv := Driver { driver : driver , cmd : cmd , } return drv , nil }
CreateDriver starts a driver and sets up the session
CreateDriver starts a driver and sets up the session
// Start driver