go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.35k stars 352 forks source link

Error on network set cache disabled (-32601 'Network.setCacheDisabled' wasn't found) #403

Closed BenjaminB64 closed 3 years ago

BenjaminB64 commented 3 years ago

Rod Version: v0.97.11

Code

package main

import (
    "github.com/go-rod/rod"
    "github.com/go-rod/rod/lib/proto"
    "github.com/labstack/gommon/log"
)
func main() {
    browser := rod.New().MustConnect()
    err := proto.NetworkSetCacheDisabled{
        CacheDisabled: true,
    }.Call(browser)
    log.Error(err)
}

Error

{-32601 'Network.setCacheDisabled' wasn't found }

Tried

I tried to connect to an chromium on my local env, and on go-rod docker container (last version), my Chomium version is 90.0.4 This call worked with same chromium instance and chromedp library, can you help me ?

ysmood commented 3 years ago

Browser doesn't have this method, only Page supports it.

package main

import (
    "github.com/go-rod/rod"
    "github.com/go-rod/rod/lib/proto"
    "github.com/go-rod/rod/lib/utils"
)

func main() {
    browser := rod.New().MustConnect()
    page := browser.MustPage()
    err := proto.NetworkSetCacheDisabled{
        CacheDisabled: true,
    }.Call(page)
    utils.E(err)
}