@@ -56,6 +56,18 @@ func (b *browserContextImpl) NewPage(options ...BrowserNewPageOptions) (Page, er
56
56
return fromChannel (channel ).(* pageImpl ), nil
57
57
}
58
58
59
+ // NetworkCookie is the return structure of BrowserContext.Cookies()
60
+ type NetworkCookie struct {
61
+ Name string `json:"name"`
62
+ Value string `json:"value"`
63
+ Domain string `json:"domain"`
64
+ Path string `json:"path"`
65
+ Expires int `json:"expires"`
66
+ HttpOnly bool `json:"httpOnly"`
67
+ Secure bool `json:"secure"`
68
+ SameSite string `json:"sameSite"`
69
+ }
70
+
59
71
func (b * browserContextImpl ) Cookies (urls ... string ) ([]* NetworkCookie , error ) {
60
72
result , err := b .channel .Send ("cookies" , map [string ]interface {}{
61
73
"urls" : urls ,
@@ -71,6 +83,19 @@ func (b *browserContextImpl) Cookies(urls ...string) ([]*NetworkCookie, error) {
71
83
return cookies , nil
72
84
}
73
85
86
+ // SetNetworkCookieParam is used to filter cookies in BrowserContext.AddCookies()
87
+ type SetNetworkCookieParam struct {
88
+ Name string `json:"name"`
89
+ Value string `json:"value"`
90
+ URL * string `json:"url"`
91
+ Domain * string `json:"domain"`
92
+ Path * string `json:"path"`
93
+ Expires * int `json:"expires"`
94
+ HttpOnly * bool `json:"httpOnly"`
95
+ Secure * bool `json:"secure"`
96
+ SameSite * string `json:"sameSite"`
97
+ }
98
+
74
99
func (b * browserContextImpl ) AddCookies (cookies ... SetNetworkCookieParam ) error {
75
100
_ , err := b .channel .Send ("addCookies" , map [string ]interface {}{
76
101
"cookies" : cookies ,
@@ -95,6 +120,7 @@ func (b *browserContextImpl) ClearPermissions() error {
95
120
return err
96
121
}
97
122
123
+ // SetGeolocationOptions represents the options for BrowserContext.SetGeolocation()
98
124
type SetGeolocationOptions struct {
99
125
Longitude int `json:"longitude"`
100
126
Latitude int `json:"latitude"`
@@ -127,6 +153,7 @@ func (b *browserContextImpl) SetOffline(offline bool) error {
127
153
return err
128
154
}
129
155
156
+ // BrowserContextAddInitScriptOptions represents the options for BrowserContext.AddInitScript()
130
157
type BrowserContextAddInitScriptOptions struct {
131
158
Path * string
132
159
Script * string
0 commit comments