admin管理员组文章数量:1419624
I'm trying to set a cookie in Protractor and its not allowing me.
Here is the error:
WebDriverError: unable to set cookie
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)
at WebDriverError (e:\node_modules\selenium-webdriver\lib\error.js:27:5)
at Object.checkLegacyResponse (e:\node_modules\selenium-webdriver\lib\error.js:505:15)
at parseHttpResponse (e:\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (e:\node_modules\selenium-webdriver\lib\http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:109:7)
Here is the test code that responsible for setting the cookies
beforeEach(function() {
//Enable Angular synchonization
protractor_1.browser.waitForAngularEnabled(true);
//Disable animations
protractor_1.browser.manage().addCookie({ name: 'disableAnimations', value: 'true' }, '/', '127.0.0.1');
});
Why is my test code not able to set the cookie?
I'm trying to set a cookie in Protractor and its not allowing me.
Here is the error:
WebDriverError: unable to set cookie
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)
at WebDriverError (e:\node_modules\selenium-webdriver\lib\error.js:27:5)
at Object.checkLegacyResponse (e:\node_modules\selenium-webdriver\lib\error.js:505:15)
at parseHttpResponse (e:\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (e:\node_modules\selenium-webdriver\lib\http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:109:7)
Here is the test code that responsible for setting the cookies
beforeEach(function() {
//Enable Angular synchonization
protractor_1.browser.waitForAngularEnabled(true);
//Disable animations
protractor_1.browser.manage().addCookie({ name: 'disableAnimations', value: 'true' }, '/', '127.0.0.1');
});
Why is my test code not able to set the cookie?
Share Improve this question edited Feb 3, 2018 at 12:22 grizzthedj 7,51517 gold badges46 silver badges65 bronze badges asked Feb 1, 2018 at 11:59 Tamer HussienTamer Hussien 8371 gold badge10 silver badges21 bronze badges1 Answer
Reset to default 7If thats the full code - i can only suggest that you must first open the page for which domain you want to add cookies, like:
beforeEach(function () {
protractor_1.browser.waitForAngularEnabled(true);
browser.get('http://127.0.0.1:8080') // set your url here
//Disable animations
protractor_1.browser.manage().addCookie({
name: 'disableAnimations',
value: 'true'
}, '/', '127.0.0.1');
});
Selenium can only set cookies for already opened domain page
本文标签: WebDriverError unable to set cookie javascriptStack Overflow
版权声明:本文标题:WebDriverError: unable to set cookie javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745316638a2653184.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论