Open xellDart opened 6 years ago
Try this
wd := agouti.ChromeDriver(
agouti.Browser("chrome"),
agouti.ChromeOptions("args", []string{
"--ignore-certificate-errors",
"--test-type",
"--allow-running-insecure-content",
}),
agouti.ChromeOptions("prefs", map[string]interface{}{
"download.default_directory": "/Users/subsky/Downloads",
}),
)
ChromeDriver 2.40 -> Supports Chrome v66-68
- If you have installed chrome locally, please check you chrome version
Than download matching chromedriver
- Demo code
package main
import ( "fmt" "github.com/sclevine/agouti" "log" )
func main() {
url := "https://www.google.com"
driver := agouti.ChromeDriver(
agouti.ChromeOptions("args", []string{
"--headless",
"--disable-gpu",
"--no-sandbox",
},
),
agouti.Debug,
)
err := driver.Start()
if err != nil {
log.Printf("Failed to start driver: %v", err)
}
page, err := driver.NewPage(agouti.Browser("chrome"))
if err != nil {
log.Printf("Failed to open page: %v", err)
}
err = page.Navigate(url)
if err != nil {
log.Printf("Failed to navigate: %v", err)
}
fmt.Printf(page.Title())
fmt.Printf("\n")
html, err := page.HTML()
fmt.Printf (html)
fmt.Printf("\n")
}
Im use lasted relase of gdrive and i get: Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 16456 Only local connections are allowed.
please help me
code: driver := agouti.ChromeDriver( agouti.ChromeOptions("args", []string{ "--headless", "--disable-gpu", }), agouti.Debug, )