在剧作家中设置饼干
我在我正在测试的网站上有一个弹出窗口的窗口,我需要绕过它,我发现的最好方法是事先插入cookie,但我无法找到如何在此上完成此操作。剧作家 - 我已经搜索了一些搜索,但找不到我所追求的确切答案,从本质上讲,饼干只需要在击中URL之前就需要开火,以免出现尖叫声。
剧作家看不到框架不幸,否则我只需单击它。
I have a pop up "Do you agree to Cookies" window on a site I am testing and I need to bypass this, the best way I have found out is to insert a cookie beforehand, but I cannot find out how to do this on Playwright - I have done some searching around but can't find a definitive answer for what i am after, essentially the cookie just needs to fire before the URL is hit so the scream doesn't appear.
Playwright cannot see the frame unfortunatley, otherwise I would just click it..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 browser_conter_conter_context.add_cookies 。
我要假设要添加cookie的网站的域名 www.google.com ,cookie = value对是 hello-world 。
如果您使用异步Python:
如果您的代码是同步的
Use browser_context.add_cookies.
I am going to assume the domain of the site where you want to add cookies is www.google.com, and the cookie=value pair is hello-world.
If you are using asynchronous python:
If your code is synchronous