Skip to content
New issue

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

puppeteer-firefox: ERROR: failed to call method 'Browser.deleteCookies' #4470

Closed
brandon-bethke-timu opened this issue May 24, 2019 · 8 comments

Comments

@brandon-bethke-timu
Copy link

I receive the following error when I try to run the following example using puppeteer-firefox version 0.5.0:

const pptrFirefox = require('puppeteer-firefox');
(async () => {
  const browser = await pptrFirefox.launch({headless: false});
  const page = await browser.newPage();
  await page.goto('https://www.google.com');
  await page.setCookie({name: 'mycookie', value: 'myvalue'});
})();

$ node sample.js 
(node:92226) UnhandledPromiseRejectionWarning: Error: Protocol error (Browser.deleteCookies): ERROR: failed to call method 'Browser.deleteCookies' with parameters {
  "browserContextId": null,
  "cookies": [
    {
      "url": "https://www.google.com/",
      "name": "mycookie"
    }
  ]
}
Expected "<root>.browserContextId" to be |string|; found |object| `null` instead. _dispatch@chrome://juggler/content/protocol/Dispatcher.js:100:15

    at node_modules/puppeteer-firefox/lib/Connection.js:74:56
    at new Promise (<anonymous>)
    at Connection.send (node_modules/puppeteer-firefox/lib/Connection.js:73:12)
    at Page.deleteCookie (node_modules/puppeteer-firefox/lib/Page.js:115:22)
    at Page.<anonymous> (node_modules/puppeteer-firefox/lib/helper.js:32:23)
    at Page.setCookie (node_modules/puppeteer-firefox/lib/Page.js:135:16)
    at Page.<anonymous> (node_modules/puppeteer-firefox/lib/helper.js:32:23)
    at sample.js:6:14

@aslushnikov
Copy link
Contributor

@brandon-bethke-neudesic thank you for taking time to file this!

@mikeecb
Copy link

mikeecb commented Jun 4, 2019

I'm seeing the exact same issue for Browser.getCookies for puppeteer-firefox version 0.5.0.

const pptrFirefox = require('puppeteer-firefox');
(async () => {
  const browser = await pptrFirefox.launch({headless: false});
  const page = await browser.newPage();
  await page.goto('https://www.google.com');
  const cookies = await page.cookies(page.url());
})();
node:36006) UnhandledPromiseRejectionWarning: Error: Protocol error (Browser.getCookies): ERROR: failed to call method 'Browser.getCookies' with parameters {
  "browserContextId": null,
  "urls": [
    "https://www.google.com/"
  ]
}
Expected "<root>.browserContextId" to be |string|; found |object| `null` instead. _dispatch@chrome://juggler/content/protocol/Dispatcher.js:100:15

    at Promise (/Users/mcypher/plaid/pdaas/node_modules/puppeteer-firefox/lib/Connection.js:74:56)
    at new Promise (<anonymous>)
    at Connection.send (/Users/mcypher/plaid/pdaas/node_modules/puppeteer-firefox/lib/Connection.js:73:12)
    at Page.cookies (/Users/mcypher/plaid/pdaas/node_modules/puppeteer-firefox/lib/Page.js:90:30)
    at Page.<anonymous> (/Users/mcypher/plaid/pdaas/node_modules/puppeteer-firefox/lib/helper.js:32:23)
    at /Users/mcypher/plaid/pdaas/sample.js:6:30

@aslushnikov
Copy link
Contributor

@mikeecb thanks! We're working on the fix.

The workaround would be to use incognito browsing contexts for now - cookies should work just fine for these.

@james-berry
Copy link

still getting ERROR: failed to call method 'Browser.getCookies' using:

const browser = await puppeteer.launch({
    headless: false,
    args: ['--start-fullscreen', '--incognito'],
    devtools: true,
  });

@nayanamana
Copy link

Have anyone found workarounds for this issue?

aslushnikov added a commit to aslushnikov/puppeteer that referenced this issue Aug 15, 2019
This patch adds tests and fixes the nodejs part of the problem.
The issue will be fixed once we roll a new version of Firefox.

References puppeteer#4470
aslushnikov added a commit that referenced this issue Aug 15, 2019
This patch adds tests and fixes the nodejs part of the problem.
The issue will be fixed once we roll a new version of Firefox.

References #4470
rfojtik pushed a commit to rfojtik/puppeteer that referenced this issue Dec 21, 2019
This patch adds tests and fixes the nodejs part of the problem.
The issue will be fixed once we roll a new version of Firefox.

References puppeteer#4470
@whimboo
Copy link
Collaborator

whimboo commented Jan 10, 2020

@mathiasbynens I assume we can close this issue given that it is about Juggler?

@mjzffr
Copy link
Contributor

mjzffr commented Jan 13, 2020

I'm closing this issue since the experimental puppeteer-firefox package is no longer maintained. A replacement will be available
later this year. You can learn more about Mozilla's work on this at https://wiki.mozilla.org/Remote

See also #5137

@mjzffr mjzffr closed this as completed Jan 13, 2020
@limonte
Copy link

limonte commented Jan 13, 2020

FWIW, this issue has been fixed in #4850 and released in puppeteer-firefox@0.5.1 which was published 4 days ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants