Created
April 2, 2018 09:42
-
-
Save franchb/8280e8c73457aa37e435916e7501c9a1 to your computer and use it in GitHub Desktop.
Go chromeless init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* // create context | |
ctxt, cancel := context.WithCancel(context.Background()) | |
defer cancel() | |
var options chromedp.Option | |
options = chromedp.WithRunnerOptions( | |
runner.HeadlessPathPort(pathBrowser, 9222), | |
runner.UserDataDir("D:\\TEMP"), | |
runner.Flag("headless", true), | |
runner.Flag("disable-gpu", true), | |
runner.Flag("no-sandbox", true), | |
) | |
fmt.Println("Creating chrome...") | |
// create chrome instance | |
c, err := chromedp.New(ctxt, options, chromedp.WithLog(log.Printf)) | |
if err != nil { | |
log.Fatal(err)*/ | |
//} | |
//c, err := chromedp.New(ctxt, chromedp.WithRunnerOptions( | |
// runner.Proxy(`http://localhost:8000/`), | |
//)) | |
// run task list | |
// var site, res string | |
// err = c.Run(ctxt, googleSearch("site:brank.as", "Home", &site, &res)) | |
// if err != nil { | |
// log.Fatal(err) | |
// } | |
// shutdown chrome | |
// fmt.Println("Created chrome") | |
// err = c.Shutdown(ctxt) | |
// if err != nil { | |
// log.Fatal(err) | |
// } | |
// fmt.Println("Waiting for finish") | |
// // wait for chrome to finish | |
// err = c.Wait() | |
// if err != nil { | |
// log.Fatal(err) | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment