Documentation

Overview

    Package api provides a generic, low-level WebDriver API client for Go. All methods map directly to endpoints of the WebDriver Wire Protocol: https://code.google.com/p/selenium/wiki/JsonWireProtocol

    This package was previously internal to the agouti package. It currently does not have a fixed API, but this will change in the near future (with the addition of adequate documentation).

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Bus

    type Bus interface {
    	Send(method, endpoint string, body, result interface{}) error
    }

    type Button

    type Button int
    const (
    	LeftButton Button = iota
    	MiddleButton
    	RightButton
    )
    type Cookie struct {
    	// Name is the name of the cookie (required)
    	Name string `json:"name"`
    
    	// Value is the value of the cookie (required)
    	Value string `json:"value"`
    
    	// Path is the path of the cookie (default: "/")
    	Path string `json:"path,omitempty"`
    
    	// Domain is the domain of the cookie (default: current page domain)
    	Domain string `json:"domain,omitempty"`
    
    	// Secure is set to true for secure cookies (default: false)
    	Secure bool `json:"secure,omitempty"`
    
    	// HTTPOnly is set to true for HTTP-Only cookies (default: false)
    	HTTPOnly bool `json:"httpOnly,omitempty"`
    
    	// Expiry is the time when the cookie expires
    	Expiry float64 `json:"expiry,omitempty"`
    }

      A Cookie defines a web cookie

      type Element

      type Element struct {
      	ID      string
      	Session *Session
      }

      func (*Element) Clear

      func (e *Element) Clear() error

      func (*Element) Click

      func (e *Element) Click() error

      func (*Element) GetAttribute

      func (e *Element) GetAttribute(attribute string) (string, error)

      func (*Element) GetCSS

      func (e *Element) GetCSS(property string) (string, error)

      func (*Element) GetElement

      func (e *Element) GetElement(selector Selector) (*Element, error)

      func (*Element) GetElements

      func (e *Element) GetElements(selector Selector) ([]*Element, error)

      func (*Element) GetID

      func (e *Element) GetID() string

      func (*Element) GetLocation

      func (e *Element) GetLocation() (x, y int, err error)

      func (*Element) GetName

      func (e *Element) GetName() (string, error)

      func (*Element) GetSize

      func (e *Element) GetSize() (width, height int, err error)

      func (*Element) GetText

      func (e *Element) GetText() (string, error)

      func (*Element) IsDisplayed

      func (e *Element) IsDisplayed() (bool, error)

      func (*Element) IsEnabled

      func (e *Element) IsEnabled() (bool, error)

      func (*Element) IsEqualTo

      func (e *Element) IsEqualTo(other *Element) (bool, error)

      func (*Element) IsSelected

      func (e *Element) IsSelected() (bool, error)

      func (*Element) Send

      func (e *Element) Send(method, endpoint string, body, result interface{}) error

      func (*Element) Submit

      func (e *Element) Submit() error

      func (*Element) Value

      func (e *Element) Value(text string) error

      type Log

      type Log struct {
      	Message   string
      	Level     string
      	Timestamp int64
      }

      type Offset

      type Offset interface {
      	// contains filtered or unexported methods
      }

      type ScalarSpeed

      type ScalarSpeed uint

      type Selector

      type Selector struct {
      	Using string `json:"using"`
      	Value string `json:"value"`
      }

      type Session

      type Session struct {
      	Bus
      }

      func New

      func New(sessionURL string) *Session

      func Open

      func Open(url string, capabilities map[string]interface{}) (*Session, error)

      func OpenWithClient

      func OpenWithClient(url string, capabilities map[string]interface{}, client *http.Client) (*Session, error)

      func (*Session) AcceptAlert

      func (s *Session) AcceptAlert() error

      func (*Session) Back

      func (s *Session) Back() error

      func (*Session) ButtonDown

      func (s *Session) ButtonDown(button Button) error

      func (*Session) ButtonUp

      func (s *Session) ButtonUp(button Button) error

      func (*Session) Click

      func (s *Session) Click(button Button) error

      func (*Session) Delete

      func (s *Session) Delete() error

      func (*Session) DeleteCookie

      func (s *Session) DeleteCookie(cookieName string) error

      func (*Session) DeleteCookies

      func (s *Session) DeleteCookies() error

      func (*Session) DeleteLocalStorage

      func (s *Session) DeleteLocalStorage() error

      func (*Session) DeleteSessionStorage

      func (s *Session) DeleteSessionStorage() error

      func (*Session) DeleteWindow

      func (s *Session) DeleteWindow() error

      func (*Session) DismissAlert

      func (s *Session) DismissAlert() error

      func (*Session) DoubleClick

      func (s *Session) DoubleClick() error

      func (*Session) Execute

      func (s *Session) Execute(body string, arguments []interface{}, result interface{}) error

      func (*Session) Forward

      func (s *Session) Forward() error

      func (*Session) Frame

      func (s *Session) Frame(frame *Element) error

      func (*Session) FrameParent

      func (s *Session) FrameParent() error

      func (*Session) GetActiveElement

      func (s *Session) GetActiveElement() (*Element, error)

      func (*Session) GetAlertText

      func (s *Session) GetAlertText() (string, error)

      func (*Session) GetCookies

      func (s *Session) GetCookies() ([]*Cookie, error)

      func (*Session) GetElement

      func (s *Session) GetElement(selector Selector) (*Element, error)

      func (*Session) GetElements

      func (s *Session) GetElements(selector Selector) ([]*Element, error)

      func (*Session) GetLogTypes

      func (s *Session) GetLogTypes() ([]string, error)

      func (*Session) GetScreenshot

      func (s *Session) GetScreenshot() ([]byte, error)

      func (*Session) GetSource

      func (s *Session) GetSource() (string, error)

      func (*Session) GetTitle

      func (s *Session) GetTitle() (string, error)

      func (*Session) GetURL

      func (s *Session) GetURL() (string, error)

      func (*Session) GetWindow

      func (s *Session) GetWindow() (*Window, error)

      func (*Session) GetWindows

      func (s *Session) GetWindows() ([]*Window, error)

      func (*Session) Keys

      func (s *Session) Keys(text string) error

      func (*Session) MoveTo

      func (s *Session) MoveTo(region *Element, offset Offset) error

      func (*Session) NewLogs

      func (s *Session) NewLogs(logType string) ([]Log, error)

      func (*Session) Refresh

      func (s *Session) Refresh() error

      func (*Session) SetAlertText

      func (s *Session) SetAlertText(text string) error

      func (*Session) SetCookie

      func (s *Session) SetCookie(cookie *Cookie) error

      func (*Session) SetImplicitWait

      func (s *Session) SetImplicitWait(timeout int) error

      func (*Session) SetPageLoad

      func (s *Session) SetPageLoad(timeout int) error

      func (*Session) SetScriptTimeout

      func (s *Session) SetScriptTimeout(timeout int) error

      func (*Session) SetURL

      func (s *Session) SetURL(url string) error

      func (*Session) SetWindow

      func (s *Session) SetWindow(window *Window) error

      func (*Session) SetWindowByName

      func (s *Session) SetWindowByName(name string) error

      func (*Session) TouchClick

      func (s *Session) TouchClick(element *Element) error

      func (*Session) TouchDoubleClick

      func (s *Session) TouchDoubleClick(element *Element) error

      func (*Session) TouchDown

      func (s *Session) TouchDown(x, y int) error

      func (*Session) TouchFlick

      func (s *Session) TouchFlick(element *Element, offset Offset, speed Speed) error

      func (*Session) TouchLongClick

      func (s *Session) TouchLongClick(element *Element) error

      func (*Session) TouchMove

      func (s *Session) TouchMove(x, y int) error

      func (*Session) TouchScroll

      func (s *Session) TouchScroll(element *Element, offset Offset) error

      func (*Session) TouchUp

      func (s *Session) TouchUp(x, y int) error

      type Speed

      type Speed interface {
      	// contains filtered or unexported methods
      }

      type VectorSpeed

      type VectorSpeed struct {
      	X int
      	Y int
      }

      type WebDriver

      type WebDriver struct {
      	Timeout    time.Duration
      	Debug      bool
      	HTTPClient *http.Client
      	// contains filtered or unexported fields
      }

      func NewWebDriver

      func NewWebDriver(url string, command []string) *WebDriver

      func (*WebDriver) Open

      func (w *WebDriver) Open(desiredCapabilites map[string]interface{}) (*Session, error)

      func (*WebDriver) Start

      func (w *WebDriver) Start() error

      func (*WebDriver) Stop

      func (w *WebDriver) Stop() error

      func (*WebDriver) URL

      func (w *WebDriver) URL() string

      type Window

      type Window struct {
      	ID      string
      	Session *Session
      }

      func (*Window) Send

      func (w *Window) Send(method, endpoint string, body, result interface{}) error

      func (*Window) SetSize

      func (w *Window) SetSize(width, height int) error

      type XOffset

      type XOffset int

      type XYOffset

      type XYOffset struct {
      	X int
      	Y int
      }

      type YOffset

      type YOffset int

      Directories

      Path Synopsis
      internal
      bus