I want to set download behaviour of browser for testing needs
I had tried solution from this topic: puppeteer - how to set download location
var browser = await StartNewChromeAsync(); //starting new chrome without extensions
var pages = await browser.PagesAsync();
var firstPage = pages[0];
var cdp = await firstPage.Target.CreateCDPSessionAsync();
await cdp.SendAsync("Page.setDownloadBehavior", new
{
behavior = "allow",
downloadPath = Path.GetAbsolutePath("./testing_downloads")
});
await cdp.DetachAsync();
I expecting, that files will be downloaded in ./testing_downloads
, but it downloadings in default path.
What am i doing wrong?
I found no way to do this in modern versions of Chrome because Page.setDownloadBehavior is removed from CDP v1.3 https://chromedevtools.github.io/devtools-protocol/1-3.
UPD: this work https://gist.github.com/vabka/88a9b054ee756a53a44691366b16b474