YusukeIwaki / puppeteer-ruby

A Ruby port of Puppeteer
Apache License 2.0
284 stars 41 forks source link

Protocol error (Network.getResponseBody): No resource with given identifier found (Puppeteer::Connection::ProtocolError) #309

Closed n1xn closed 1 year ago

n1xn commented 1 year ago

Step To Reproduce / Observed behavior

This code is working in ruby and js! The only problem is that I am getting this error message in ruby, which triggers my tests to fail.

WARN -- : Protocol error (Network.getResponseBody): No resource with given identifier found (Puppeteer::Connection::ProtocolError)

ruby

        page.goto("#{@base_url}/#{path}")
        res = await page.async_wait_for_response(predicate: lambda { |res|
          return await res.json if res.url.include?('user?')
        })
        items = await res.json
        puts items

js

  await page.goto(`${base_url}/${path}`)
  const res = await page.waitForResponse(async res => {
    if(res.url().includes('user')){
      return await res.json()
    }
  })
  const data = await res.json()
  console.log(data)

Expected behavior

Should not log error.

Send me a mail if you need the domain of this example.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.