Allocators seperated for transparency. Updated chrome library.

This commit is contained in:
Musab Gültekin
2020-09-05 16:14:41 +03:00
parent cfb16fe1ee
commit 7a76a9b95e
3 changed files with 19 additions and 6 deletions

View File

@ -170,11 +170,14 @@ func (c *Client) doRequestChrome(req *Request) (*Response, error) {
var res *network.Response
// Set remote allocator or use local chrome instance
ctx := context.Background()
var ctx context.Context
var cancel context.CancelFunc
if c.opt.RemoteAllocatorURL != "" {
ctx, _ = chromedp.NewRemoteAllocator(ctx, c.opt.RemoteAllocatorURL)
ctx, cancel = chromedp.NewRemoteAllocator(ctx, c.opt.RemoteAllocatorURL)
} else {
ctx, cancel = chromedp.NewExecAllocator(context.Background())
}
ctx, cancel := chromedp.NewContext(ctx)
ctx, cancel = chromedp.NewContext(ctx)
defer cancel()
if err := chromedp.Run(ctx,