Skip to content

Conversation

@lishimeng
Copy link

func New(url, dir string, width, height int, customArgs ...string) (UI, error) {
...
args := append(defaultChromeArgs, fmt.Sprintf("--app=%s", url))
args = append(args, fmt.Sprintf("--user-data-dir=%s", dir))
args = append(args, fmt.Sprintf("--window-size=%d,%d", width, height))
args = append(args, customArgs...)
args = append(args, "--remote-debugging-port=0")

**args = handleArgs(args) // override default args with custome args** 

chrome, err := newChromeWithArgs(ChromeExecutable(), args...)
...

}

func handleArgs(src []string) (dest []string) {
m := make(map[string]bool)
for _, s := range src {
m[s] = true
}
for s, _ := range m {
dest = append(dest, s)
}
return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant