How Set cookie from array of objects using loop

a 夏天 提交于 2020-04-17 20:38:34

问题


I want to set cookies from data in my cookie.json file. Right now I have 2 objects in my cookies collection. I want to get each object by incrementing the value of [i], so I can set each cookie at a time.

var cookie = JSON.parse(fs.readFileSync('cookies.json', 'utf8')); 

for(var i = 0; i < cookie.length; i++)
{
    await page.setCookie(...cookie[i]) //this line is not working, cookies is not writting

来源:https://stackoverflow.com/questions/60845736/how-set-cookie-from-array-of-objects-using-loop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!