6.9.45.1.12.4.8n/aWindows 7I've recently upgraded to Protractor 5.1.1 and am facing some issues when setting cookies via browser.manage().addCookie()
The API has changed between versions 2 and 3 of Selenium-webdriver to expect an object rather than the previous 2..6 arguments. When I make the changes to my code to use the object, the typescript compiler complains saying that it expects 2..6 arguments.
old api:
browser.manage().addCookie('cookieName', 'cookieVal');
new api:
browser.manage().addCookie({name:'cookieName', value: 'cookieVal'});
I think this is because the @types/selenium-webdriver in the package.json of protractor v5.1.1 is pointing at version 2.53.39. The version of the actual selenium-webdriver the same package.json is referencing is 3.0.1.
I think they should both be version 3.*
Thanks for raising this! This is something that we will need to take care of internally.
The current workaround in Craig's SO answer:
(browser.manage() as any).addCookie({name:'cookieName', value: 'cookieVal'});
I can pick this up later in the week unless someone has time to work on it before then.
This should be updated. @NickTomlin do a search for // TODO's. We have a few places that we hacked in the as any to get Protractor's lib to transpile.
@cnishina it looks like webdriver-extender is the underlying issue here since the types point to selenium 2.x. I'm still seeing the error in this issue when consuming a version of Protractor with the types at 3.x
I was able to resolve some todos in #4158 but there's still a mismatch for addCookie. I'll do some digging in web driver extender to try and update there as well but the code is pretty opaque to me at the moment 馃槃 Any tips would be very much appreciated
any update on this, as i still see a problem with adding the cookie and get cookie
November 27th, problem persists with "protractor": "5.2.0"
This is still a problem in 2018 - there was some work done by @NickTomlin here but there has been no response to the PR.
Most helpful comment
any update on this, as i still see a problem with adding the cookie and get cookie