Allocator options added

This commit is contained in:
Musab Gültekin
2021-01-28 20:49:01 +03:00
parent 29c29235ae
commit 9b266b6cce
2 changed files with 2 additions and 11 deletions

View File

@ -36,6 +36,7 @@ type Options struct {
RetryTimes int
RetryHTTPCodes []int
RemoteAllocatorURL string
AllocatorOptions []chromedp.ExecAllocatorOption
}
// Default values for client
@ -172,7 +173,7 @@ func (c *Client) doRequestChrome(req *Request) (*Response, error) {
if c.opt.RemoteAllocatorURL != "" {
ctx, cancel = chromedp.NewRemoteAllocator(ctx, c.opt.RemoteAllocatorURL)
} else {
ctx, cancel = chromedp.NewExecAllocator(context.Background())
ctx, cancel = chromedp.NewExecAllocator(context.Background(), c.opt.AllocatorOptions...)
}
ctx, cancel = chromedp.NewContext(ctx)
defer cancel()