We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
something like this:
chromedp.Run(ctx, page.SetDownloadBehavior(page.SetDownloadBehaviorBehaviorAllow).WithDownloadPath(local_path), chromedp.Navigate(url_to_picture))
The text was updated successfully, but these errors were encountered:
Something like this:
func (downloader *Downloader) Download(url string) ([]byte, error) { tab := NewTabForChrome(downloader.Context) done := make(chan bool) var requestId network.RequestID chromedp.ListenTarget(tab.TabContext, func(ev interface{}) { switch ev := ev.(type) { case *network.EventRequestWillBeSent: req := ev.Request if req.URL == url { requestId = ev.RequestID } case *network.EventLoadingFinished: if ev.RequestID == requestId { close(done) } } }) err := chromedp.Run(tab.TabContext, chromedp.Tasks{ page.SetDownloadBehavior(page.SetDownloadBehaviorBehaviorAllow).WithDownloadPath(os.TempDir()), chromedp.Navigate(url), }) if err != nil { return nil, err } <-done var bytes []byte err = chromedp.Run(tab.TabContext, chromedp.ActionFunc(func(cxt context.Context) error { bytes, err = network.GetResponseBody(requestId).Do(cxt) return err })) err = tab.Close() if err != nil { return nil, err } return bytes, nil }
Sorry, something went wrong.
@Hecatoncheir thanks for the example. Closing this out.
No branches or pull requests
something like this:
The text was updated successfully, but these errors were encountered: