Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: context.add_cookies set just one cookie instead of all cookies #2894

Open
@yixinBC

Description

@yixinBC

Version

1.52.0

Steps to reproduce

I just use playwright's python bindings, and here's my test code.

fromplaywright.sync_apiimportsync_playwrighttrue=Truefalse=Falsecookies= [    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"a","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"b","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"c","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"d","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".xxx.example.com","hostOnly":false,"httpOnly":false,"name":"e","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".xxx.example.com","hostOnly":false,"httpOnly":false,"name":"f","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":"h5.xxx.example.com","hostOnly":true,"httpOnly":false,"name":"g","path":"/","sameSite":"None","secure":true,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"h","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"i","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"j","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"",    },    {"domain":"h5.xxx.example.com","hostOnly":true,"httpOnly":false,"name":"k","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"l","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"m","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"n","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":true,"name":"o","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"p","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":true,"name":"q","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":true,"name":"r","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"s","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"t","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"u","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },    {"domain":".example.com","hostOnly":false,"httpOnly":false,"name":"v","path":"/","sameSite":"None","secure":false,"session":false,"storeId":"0","value":"filtered",    },]deftest_cookie():withsync_playwright()asp:browser=p.chromium.launch(headless=False)context=browser.new_context()print(f"===Cookies before adding:{context.cookies()}===")context.add_cookies(cookies)print(f"===Cookies after adding:{context.cookies()}===")assertcontext.cookies()==cookiescontext.close()browser.close()if__name__=="__main__":test_cookie()print("===Test completed successfully.===")

Expected behavior

Cookies after adding will be the same as cookies variable, and pass the assert.

Actual behavior

Cookies after adding is [{'name': 'g', 'value': 'filtered', 'domain': 'h5.xxx.example.com', 'path': '/', 'expires': -1, 'httpOnly': False, 'secure': True, 'sameSite': 'None'}] . So there's an AssertionError.

Additional context

No response

Environment

- Operating System: [MacOS X 15.1]- CPU: [x86_64]- Browser: [Chromium]- Python Version: [3.12]- Other info:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp