Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

addCookie method throws 'addCookie called with non-cookie parameter'

I am struggling with this error message which has no direct forum discussion anywhere. From some of the things I saw around the web I tried:

  • Changing localhost to 127.0.0.1
  • Played around with browser.driver.manage() v/s browser.manage()
  • Cleaning out/updating my node modules

The same code runs on other machines with same configuration (Win 10, chromedriver 2 etc.)

The code essetially gets the cookie value through API calls before

and uses it as such: browser.get(URL); browser.manage().addCookie('cookie_name', value);

Any help would be appreciated!

like image 764
g0rd Avatar asked Jan 23 '17 22:01

g0rd


1 Answers

Assumption that you are on Protractor 5.0.0. Adding cookies have been changed in selenium webdriver 3 and was noted as a breaking change in the Protractor changelog:

Before:

browser.manage().addCookie('testcookie', 'Jane-1234');

After:

browser.manage().addCookie({name:'testcookie', value: 'Jane-1234'});
like image 99
cnishina Avatar answered Oct 08 '22 23:10

cnishina