PuppeteerSharp:如何同时启用请求拦截和缓存?

时间:2021-03-09 03:29:50

标签: google-chrome-devtools puppeteer puppeteer-sharp

我想同时启用请求拦截和缓存。然而,在挖掘 PuppeteerSharp 源代码时,我发现似乎有故意的代码使这两个属性互斥。因此,我有两个问题:

  1. 为什么在 PuppeteerSharp 中缓存和请求拦截是互斥的?
  2. 是否可以覆盖它以便同时启用两者?怎么样?

以下是附加信息:

请参阅 https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp/NetworkManager.cs 查看下面的所有屏幕截图。

该方法表示在调用UpdateProtocolCacheDisabledAsync()时会调用Fetch.enable,即用于请求拦截的内部DevTools method

enter image description here

_protocolRequestInterceptionEnabled 设置为 true_userRequestInterceptionEnabled 也设置为 true 时,缓存实际上被禁用。

enter image description here

enter image description here

0 个答案:

没有答案
相关问题