page.go
func (p *Page) SetCookie(cookie *http.Cookie) error {
	if cookie == nil {
		return errors.New("nil cookie is invalid")
	}

	var expiry int64
	if !cookie.Expires.IsZero() {
		expiry = cookie.Expires.Unix()
	}

	apiCookie := &api.Cookie{
		Name:     cookie.Name,
		Value:    cookie.Value,
		Path:     cookie.Path,
		Domain:   cookie.Domain,
		Secure:   cookie.Secure,
		HTTPOnly: cookie.HttpOnly,
		Expiry:   float64(expiry),
	}

	if err := p.session.SetCookie(apiCookie); err != nil {
		return fmt.Errorf("failed to set cookie: %s", err)
	}
	return nil
}
func (p *Page) SetCookie(cookie *http.Cookie) error {
	if cookie == nil {
		return errors.New("nil cookie is invalid")
	}

	var expiry int64
	if !cookie.Expires.IsZero() {
		expiry = cookie.Expires.Unix()
	}

	apiCookie := &api.Cookie{
		Name:     cookie.Name,
		Value:    cookie.Value,
		Path:     cookie.Path,
		Domain:   cookie.Domain,
		Secure:   cookie.Secure,
		HTTPOnly: cookie.HttpOnly,
		Expiry:   float64(expiry),
	}

	if err := p.session.SetCookie(apiCookie); err != nil {
		return fmt.Errorf("failed to set cookie: %s", err)
	}
	return nil
}
// SetCookie sets a cookie on the page.