'Selenium add_cookie assert cookie_dict['sameSite'] in ['Strict', 'Lax', 'None'] AssertionError

Im trying to send some cookies with selenium that i have exported,my code is this:

import json
from selenium import webdriver
import time
driver = webdriver.Chrome()

file = open('facebook_cookies.json')
data = json.load(file)
driver = webdriver.Chrome()


driver.get("https://facebook.com")
for i in data:
    driver.add_cookie(i)


time.sleep(3)
driver.get("https://facebook.com")

print('finished')

the cookies are in .json file in this format

    {
    "domain": ".facebook.com",
    "expirationDate": 1682523155190.607145,
    "hostOnly": false,
    "httpOnly": false,
    "name": "c_user",
    "path": "/",
    "sameSite": "no_restriction",
    "secure": true,
    "session": false,
    "storeId": null,
    "value": "100002233731203176"
},
{
    "domain": ".facebook.com",
    "hostOnly": false,
    "httpOnly": false,
    "name": "presence",
    "path": "/",
    "sameSite": null,
    "secure": true,
    "session": true,
    "storeId": null,
    "value": "C%7B%22t3asdh%22%3A%5B%5Dhsda5%2C%22utc3%22%3A1651020210543%2C%22v%22%3A1%7D"
},

When i run i get the "AssertionError", however if i make the dictionary in this format:

    {

    "name": "c_user",
    "value": "1000032233731203176"
},
{

    "name": "presence",
    "value":"C%7B%2222%3%5B%5Dhsda5%2C%22utc3%22%3A1651020210543%2C%22v%22%3A1%7D"
},
{

    "name": "oo",
    "value": "v1"
}

Everything works, now i need a method of sending them in the initial format or a method where i can return only the 'name':'my_name' and 'value':'my_value' of all the cookies 'ps:typeof says its a list'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source