func (p *Page) GetCookies() ([]*http.Cookie, error) {
	apiCookies, err := p.session.GetCookies()
	if err != nil {
		return nil, fmt.Errorf("failed to get cookies: %s", err)
	}
	cookies := []*http.Cookie{}
	for _, apiCookie := range apiCookies {
		expSeconds := int64(apiCookie.Expiry)
		expNano := int64(apiCookie.Expiry-float64(expSeconds)) * 1000000000
		cookie := &http.Cookie{
			Name:     apiCookie.Name,
			Value:    apiCookie.Value,
			Path:     apiCookie.Path,
			Domain:   apiCookie.Domain,
			Secure:   apiCookie.Secure,
			HttpOnly: apiCookie.HTTPOnly,
			Expires:  time.Unix(expSeconds, expNano),
		}
		cookies = append(cookies, cookie)
	}
	return cookies, nil
}
GetCookies returns all cookies on the page.
package agouti
import (
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"path/filepath"
	"regexp"
	"sort"
	"strings"
	"time"
	"github.com/sclevine/agouti/api"
)
type Page struct {
	selectable
	logs map[string][]Log
}
type Log struct {
	Message string
	Location string
	Level string
	Time time.Time
}
func NewPage(url string, options ...Option) (*Page, error) {
	pageOptions := config{}.Merge(options)
	session, err := api.OpenWithClient(url, pageOptions.Capabilities(), pageOptions.HTTPClient)
	if err != nil {
		return nil, fmt.Errorf("failed to connect to WebDriver: %s", err)
	}
	return newPage(session), nil
}
func JoinPage(url string) *Page {
	session := api.New(url)
	return newPage(session)
}
func newPage(session *api.Session) *Page {
	return &Page{selectable{session, nil}, nil}
}
func (p *Page) String() string {
	return "page"
}
func (p *Page) Session() *api.Session {
	return p.session.(*api.Session)
}
func (p *Page) Destroy() error {
	if err := p.session.Delete(); err != nil {
		return fmt.Errorf("failed to destroy session: %s", err)
	}
	return nil
}
func (p *Page) Reset() error {
	p.ConfirmPopup()
	url, err := p.URL()
	if err != nil {
		return err
	}
	if url == "about:blank" {
		return nil
	}
	if err := p.ClearCookies(); err != nil {
		return err
	}
	if err := p.session.DeleteLocalStorage(); err != nil {
		if err := p.RunScript("localStorage.clear();", nil, nil); err != nil {
			return err
		}
	}
	if err := p.session.DeleteSessionStorage(); err != nil {
		if err := p.RunScript("sessionStorage.clear();", nil, nil); err != nil {
			return err
		}
	}
	return p.Navigate("about:blank")
}
func (p *Page) Navigate(url string) error {
	if err := p.session.SetURL(url); err != nil {
		return fmt.Errorf("failed to navigate: %s", err)
	}
	return nil
}