func (s Session) DeleteCookies() error {
	_, _, err := s.wd.do(nil, "DELETE", "/session/%s/cookie", s.Id)
	return err
}
Delete all cookies visible to the current page.
package webdriver
import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"errors"
	"io/ioutil"
)
type WebDriver interface {
	Start() error
	Stop() error
	Status() (*Status, error)
	NewSession(desired, required Capabilities) (*Session, error)
	Sessions() ([]Session, error)
	do(params interface{}, method, urlFormat string, urlParams ...interface{}) (string, []byte, error)
}
type params map[string]interface{}
type Status struct {
	Build Build
	OS    OS
}
type Build struct {
	Version  string
	Revision string
	Time     string
}
type OS struct {
	Arch    string
	Name    string
	Version string
}
type Capabilities map[string]interface{}
type Session struct {
	Id           string
	Capabilities Capabilities
	wd           WebDriver
}
type WindowHandle struct {
	s  *Session
	id string
}
type Size struct {
	Width  int
	Height int
}
type Position struct {
	X int
	Y int
}
type FindElementStrategy string
const (
	ClassName = FindElementStrategy("class name")
	CSS_Selector = FindElementStrategy("css selector")
	ID = FindElementStrategy("id")
	Name = FindElementStrategy("name")
	LinkText = FindElementStrategy("link text")
	PartialLinkText = FindElementStrategy("partial link text")
	TagName = FindElementStrategy("tag name")
	XPath = FindElementStrategy("xpath")
)
type element struct {
	ELEMENT string
}
type WebElement struct {
	s  *Session
	id string
}
type Cookie struct {
	Name   string
	Value  string
	Path   string
	Domain string
	Secure bool
	Expiry int
}
type GeoLocation struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}
type LogLevel string
const (
	LogAll     = LogLevel("ALL")
	LogDebug   = LogLevel("DEBUG")
	LogInfo    = LogLevel("INFO")
	LogWarning = LogLevel("WARNING")
	LogSevere  = LogLevel("SEVERE")
	LogOff     = LogLevel("OFF")
)
type LogEntry struct {
	TimeStamp int  
	Level     string
	Message   string
}
type HTML5CacheStatus int
const (
	CacheStatusUncached    = HTML5CacheStatus(0)
	CacheStatusIdle        = HTML5CacheStatus(1)
	CacheStatusChecking    = HTML5CacheStatus(2)
	CacheStatusDownloading = HTML5CacheStatus(3)
	CacheStatusUpdateReady = HTML5CacheStatus(4)
	CacheStatusObsolete    = HTML5CacheStatus(5)
)
func (s Session) GetCapabilities() Capabilities {
	return s.Capabilities
}
func (s Session) Delete() error {
	_, _, err := s.wd.do(nil, "DELETE", "/session/%s", s.Id)
	return err
}
func (s Session) SetTimeouts(typ string, ms int) error {
	p := params{"type": typ, "ms": ms}
	_, _, err := s.wd.do(p, "POST", "/session/%s/timeouts", s.Id)
	return err
}
func (s Session) SetTimeoutsAsyncScript(ms int) error {
	p := params{"ms": ms}
	_, _, err := s.wd.do(p, "POST", "/session/%s/timeouts/async_script", s.Id)
	return err
}
func (s Session) SetTimeoutsImplicitWait(ms int) error {
	p := params{"ms": ms}
	_, _, err := s.wd.do(p, "POST", "/session/%s/timeouts/implicit_wait", s.Id)
	return err
}
func (s Session) GetCurrentWindowHandle() WindowHandle {
	return WindowHandle{&s, "current"}
}
func (s Session) WindowHandle() (WindowHandle, error) {
	_, data, err := s.wd.do(nil, "GET", "/session/%s/window_handle", s.Id)
	if err != nil {
		return WindowHandle{}, err
	}
	var handle string
	err = json.Unmarshal(data, &handle)
	return WindowHandle{&s, handle}, err
}
func (s Session) WindowHandles() ([]WindowHandle, error) {
	_, data, err := s.wd.do(nil, "GET", "/session/%s/window_handles", s.Id)
	if err != nil {
		return nil, err
	}
	var hv []string
	err = json.Unmarshal(data, &hv)
	if err != nil {
		return nil, err
	}
	var handles = make([]WindowHandle, len(hv))
	for i, h := range hv {
		handles[i] = WindowHandle{&s, h}
	}
	return handles, nil
}
func (s Session) GetUrl() (string, error) {
	_, data, err := s.wd.do(nil, "GET", "/session/%s/url", s.Id)
	if err != nil {
		return "", err
	}
	var url string
	err = json.Unmarshal(data, &url)
	return url, err
}
func (s Session) Url(url string) error {
	p := params{"url": url}
	_, _, err := s.wd.do(p, "POST", "/session/%s/url", s.Id)
	return err
}
func (s Session) Forward() error {
	_, _, err := s.wd.do(nil, "POST", "/session/%s/forward", s.Id)
	return err
}
func (s Session) Back() error {
	_, _, err := s.wd.do(nil, "POST", "/session/%s/back", s.Id)
	return err
}
func (s Session) Refresh() error {
	_, _, err := s.wd.do(nil, "POST", "/session/%s/refresh", s.Id)
	return err
}
func (s Session) ExecuteScript(script string, args []interface{}) ([]byte, error) {
	p := params{"script": script, "args": args}
	_, data, err := s.wd.do(p, "POST", "/session/%s/execute", s.Id)
	return data, err
}
func (s Session) ExecuteScriptAsync(script string, args []interface{}) ([]byte, error) {
	p := params{"script": script, "args": args}
	_, data, err := s.wd.do(p, "POST", "/session/%s/execute_async", s.Id)
	return data, err
}
func (s Session) Screenshot() ([]byte, error) {
	_, data, err := s.wd.do(nil, "GET", "/session/%s/screenshot", s.Id)
	if err != nil {
		return nil, err
	}
	reader := bytes.NewBuffer(data[1 : len(data)-1])
	decoder := base64.NewDecoder(base64.StdEncoding, reader)
	return ioutil.ReadAll(decoder)
}
func (s Session) IMEAvailableEngines() ([]string, error) {
	_, data, err := s.wd.do(nil, "GET", "session/%s/ime/available_engines", s.Id)
	if err != nil {
		return nil, err
	}
	var engines []string
	err = json.Unmarshal(data, &engines)
	return engines, err
}
func (s Session) IMEActiveEngine() (string, error) {
	_, data, err := s.wd.do(nil, "GET", "session/%s/ime/active_engine", s.Id)
	if err != nil {
		return "", err
	}
	var engine string
	err = json.Unmarshal(data, &engine)
	return engine, err
}
func (s Session) IsIMEActivated() (bool, error) {
	_, data, err := s.wd.do(nil, "GET", "session/%s/ime/activated", s.Id)
	if err != nil {
		return false, err
	}
	var activated bool
	err = json.Unmarshal(data, &activated)
	return activated, err
}
func (s Session) IMEDeactivate() error {
	_, _, err := s.wd.do(nil, "GET", "session/%s/ime/deactivate", s.Id)
	return err
}
func (s Session) IMEActivate(engine string) error {
	p := params{"engine": engine}
	_, _, err := s.wd.do(p, "POST", "/session/%s/ime/activate", s.Id)
	return err
}
func (s Session) FocusOnFrame(frameId interface{}) error {
	if frameId != nil {
		switch frameId.(type) {
		case string:
		case int:
		case WebElement:
		default:
			return errors.New("invalid frame, must be string|int|nil|WebElement")
		}
	}
	p := params{"id": frameId}
	_, _, err := s.wd.do(p, "POST", "/session/%s/frame", s.Id)
	return err
}
func (s Session) FocusParentFrame() error {
	_, _, err := s.wd.do(nil, "POST", "/session/%s/frame/parent", s.Id)
	return err
}
func (s Session) FocusOnWindow(name string) error {
	p := params{"name": name}
	_, _, err := s.wd.do(p, "POST", "/session/%s/window", s.Id)
	return err
}
func (s Session) CloseCurrentWindow() error {
	_, _, err := s.wd.do(nil, "DELETE", "/session/%s/window", s.Id)
	return err
}
func (w WindowHandle) SetSize(size Size) error {
	p := params{"width": size.Width, "height": size.Height}
	_, _, err := w.s.wd.do(p, "POST", "/session/%s/window/%s/size", w.s.Id, w.id)
	return err
}
func (w WindowHandle) GetSize() (Size, error) {
	_, data, err := w.s.wd.do(nil, "GET", "/session/%s/window/%s/size", w.s.Id, w.id)
	if err != nil {
		return Size{}, err
	}
	var outSize Size
	err = json.Unmarshal(data, &outSize)
	return outSize, err
}
func (w WindowHandle) SetPosition(position Position) error {
	p := params{"x": position.X, "y": position.Y}
	_, _, err := w.s.wd.do(p, "POST", "/session/%s/window/%s/position", w.s.Id, w.id)
	return err
}
func (w WindowHandle) GetPosition() (Position, error) {
	_, data, err := w.s.wd.do(nil, "GET", "/session/%s/window/%s/position", w.s.Id, w.id)
	if err != nil {
		return Position{}, err
	}
	var position Position
	err = json.Unmarshal(data, &position)
	return position, err
}
func (w WindowHandle) MaximizeWindow() error {
	_, _, err := w.s.wd.do(nil, "POST", "/session/%s/window/%s/maximize", w.s.Id, w.id)
	return err
}
func (s Session) GetCookies() ([]Cookie, error) {
	_, data, err := s.wd.do(nil, "GET", "/session/%s/cookie", s.Id)
	if err != nil {
		return nil, err
	}
	var cookies []Cookie
	err = json.Unmarshal(data, &cookies)
	return cookies, err
}
func (s Session) SetCookie(cookie Cookie) error {
	p := params{"cookie": cookie}
	_, _, err := s.wd.do(p, "POST", "/session/%s/cookie", s.Id)
	return err
}