0
我的硒碼下面的序列,Node.js的書面:餅乾添加硒的webdriver
it('tests cookies', t => {
driver.manage().getCookies().then(function (cookies) {
console.log('all cookies => ', cookies);
});
driver.manage().addCookie({name:'foo', value: 'bar'});
driver.manage().getCookies().then(function (cookies) {
console.log('all cookies => ', cookies);
});
driver.manage().deleteCookie('foo');
return driver.manage().getCookies().then(function (cookies) {
console.log('all cookies => ', cookies);
});
});
,我得到這樣的輸出:
all cookies => []
all cookies => []
all cookies => []
有人知道爲什麼的addCookie功能止跌不工作?我不知道我明白爲什麼這不會在餅乾罐中產生一些餅乾。
感謝,我期待在這裏:https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium -webdriver/lib/webdriver_exports_Options.html –
由於某種原因本調用:driver.manage()。addCookie({name:'cec_user_id',value:val,secure:true,httpOnly:true});產率: –
所有Cookie => [{路徑: '/', 域: 'CDT-服務器', 名: 'cec_user_id', 僅Http:假, 安全:假, hCode:-810793967, 值: 'alexamil', class:'org.openqa.selenium.Cookie'}] –