Documentation
¶
Index ¶
- Constants
- Variables
- func ElementIsNotPresent(by By, value string) func(f Finder) (bool, *WebElement, error)
- func ElementIsPresent(by By, value string) func(f Finder) (bool, *WebElement, error)
- type By
- type Capabilities
- type Client
- func (c *Client) AcceptDialog() error
- func (c *Client) ActiveFrame() (*WebElement, error)
- func (c *Client) Back() error
- func (c *Client) Capabilities() (*Capabilities, error)
- func (c *Client) CloseWindow() (*Response, error)
- func (c *Client) Connect(host string, port int) error
- func (c *Client) Context() (*Response, error)
- func (c *Client) Cookie(name string) (*Response, error)
- func (c *Client) Cookies() (*Response, error)
- func (c *Client) CurrentChromeWindowHandle() (*Response, error)
- func (c *Client) CurrentUrl() (string, error)
- func (c *Client) CurrentWindowHandle() (string, error)
- func (c *Client) DeleteSession() error
- func (c *Client) DismissDialog() error
- func (c *Client) ExecuteScript(script string, args []interface{}, timeout uint, newSandbox bool) (*Response, error)
- func (c *Client) FindElement(by By, value string) (*WebElement, error)
- func (c *Client) FindElements(by By, value string) ([]*WebElement, error)
- func (c *Client) Forward() error
- func (c *Client) Get(url string) (*Response, error)
- func (c *Client) GetWindowRect() (rect *WindowRect, err error)
- func (c *Client) Log(message string, level string) (*Response, error)
- func (c *Client) Logs() (*Response, error)
- func (c *Client) MaximizeWindow() error
- func (c *Client) Navigate(url string) (*Response, error)
- func (c *Client) NewSession(sessionId string, cap *Capabilities) (*Response, error)
- func (c *Client) PageSource() (*Response, error)
- func (c *Client) Quit() (*Response, error)
- func (c *Client) QuitApplication() (*Response, error)
- func (c *Client) Refresh() error
- func (c *Client) Screenshot() (string, error)
- func (c *Client) SendKeysToDialog(keys string) error
- func (c *Client) SessionID() string
- func (c *Client) SetContext(value Context) (*Response, error)
- func (c *Client) SetPageTimeout(milliseconds int) (*Response, error)
- func (c *Client) SetScriptTimeout(milliseconds int) (*Response, error)
- func (c *Client) SetSearchTimeout(milliseconds int) (*Response, error)
- func (c *Client) SetWindowRect(rect WindowRect) error
- func (c *Client) SetWindowSize(s *Size) (rv *Size, err error)
- func (c *Client) SwitchToFrame(by By, value string) error
- func (c *Client) SwitchToParentFrame() error
- func (c *Client) SwitchToWindow(name string) error
- func (c *Client) TextFromDialog() (string, error)
- func (c *Client) Title() (string, error)
- func (c *Client) Transport(t Transporter)
- func (c *Client) Url() (string, error)
- func (c *Client) WindowHandles() ([]string, error)
- func (c *Client) WindowSize() (rv *Size, err error)
- type Context
- type Cookie
- type Decoder
- type DecoderEncoder
- type DriverError
- type ElementRect
- type Encoder
- type Finder
- type MarionetteTransport
- func (t *MarionetteTransport) Close() error
- func (t *MarionetteTransport) Connect(host string, port int) error
- func (t *MarionetteTransport) MessageID() int
- func (t *MarionetteTransport) Receive() ([]byte, error)
- func (t *MarionetteTransport) Send(command string, values interface{}) (*Response, error)
- type Navigator
- type Point
- type ProtoV3DecoderEncoder
- type Response
- type Size
- type Transporter
- type Waiter
- type WebElement
- func (e *WebElement) Attribute(name string) string
- func (e *WebElement) Clear()
- func (e *WebElement) Click()
- func (e *WebElement) CssValue(property string) string
- func (e *WebElement) Displayed() bool
- func (e *WebElement) Enabled() bool
- func (e *WebElement) FindElement(by By, value string) (*WebElement, error)
- func (e *WebElement) FindElements(by By, value string) ([]*WebElement, error)
- func (e *WebElement) Id() string
- func (e *WebElement) Location() (*Point, error)
- func (e *WebElement) Rect() (*ElementRect, error)
- func (e *WebElement) Screenshot() (string, error)
- func (e *WebElement) Selected() bool
- func (e *WebElement) SendKeys(keys string) error
- func (e *WebElement) Size() (*Size, error)
- func (e *WebElement) TagName() string
- func (e *WebElement) Text() string
- func (e *WebElement) UnmarshalJSON(data []byte) error
- type WindowRect
Constants ¶
const ( MARIONETTE_PROTOCOL_V2 = 2 MARIONETTE_PROTOCOL_V3 = 3 WEBDRIVER_ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf" )
Variables ¶
var RunningInDebugMode bool = false
Functions ¶
func ElementIsNotPresent ¶
func ElementIsPresent ¶
Types ¶
type By ¶
type By int
strategy type to find elements in the DOM
const ( ID By = 1 + iota NAME CLASS_NAME TAG_NAME CSS_SELECTOR LINK_TEXT PARTIAL_LINK_TEXT XPATH ANON ANON_ATTRIBUTE )
:param method: The method to use to locate the element; one of:
"id", "name", "class name", "tag name", "css selector", "link text", "partial link text", "xpath", "anon" and "anon attribute". Note that the "name", "link text" and "partial link test" methods are not supported in the chrome DOM.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would be an element id.
:param id: If specified, search for elements only inside the element
with the specified id.
"""
type Capabilities ¶
type Capabilities struct {
BrowserName string
BrowserVersion string
PlatformName string
PlatformVersion string
SpecificationLevel uint
RaisesAccessibilityExceptions bool
Rotatable bool
AcceptSslCerts bool
TakesElementScreenshot bool
TakesScreenshot bool
Proxy interface{}
Platform string
XULappId string
AppBuildId string
Device string
Version string
Command_id uint32
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AcceptDialog ¶
AcceptDialog accepts the dialog - like clicking Ok/Yes
func (*Client) ActiveFrame ¶
func (c *Client) ActiveFrame() (*WebElement, error)
ActiveFrame get active frame
func (*Client) Capabilities ¶
func (c *Client) Capabilities() (*Capabilities, error)
Capabilities Send the current session's capabilities to the client. Capabilities informs the client of which WebDriver features are supported by Firefox and Marionette. They are immutable for the length of the session. The return value is an immutable map of string keys ("capabilities") to values, which may be of types boolean, numerical or string.
func (*Client) CloseWindow ¶
CloseWindow closes current window.
func (*Client) CurrentChromeWindowHandle ¶
CurrentChromeWindowHandle returns the current chrome window ID "getChromeWindowHandle": GeckoDriver.prototype.getChromeWindowHandle, "getCurrentChromeWindowHandle": GeckoDriver.prototype.getChromeWindowHandle,
func (*Client) CurrentUrl ¶
CurrentUrl deprecated, use Url() instead Deprecated
func (*Client) CurrentWindowHandle ¶
CurrentWindowHandle returns the current window ID
func (*Client) DeleteSession ¶
DeleteSession Marionette currently only accepts a session id, so if we call delete session can also close the TCP Connection
func (*Client) DismissDialog ¶
DismissDialog dismisses the dialog - like clicking No/Cancel
func (*Client) ExecuteScript ¶
func (c *Client) ExecuteScript(script string, args []interface{}, timeout uint, newSandbox bool) (*Response, error)
ExecuteScript Execute JS Script
func (*Client) FindElement ¶
func (c *Client) FindElement(by By, value string) (*WebElement, error)
FindElement Find an element using the indicated search strategy.
func (*Client) FindElements ¶
func (c *Client) FindElements(by By, value string) ([]*WebElement, error)
FindElements Find elements using the indicated search strategy.
func (*Client) GetWindowRect ¶
func (c *Client) GetWindowRect() (rect *WindowRect, err error)
GetWindowRect gets window position and size
func (*Client) MaximizeWindow ¶
MaximizeWindow maximizes window.
func (*Client) NewSession ¶
func (c *Client) NewSession(sessionId string, cap *Capabilities) (*Response, error)
NewSession create new session
func (*Client) PageSource ¶
PageSource get page source
func (*Client) QuitApplication ¶
QuitApplication deprecated use Quit().
func (*Client) Screenshot ¶
Screenshot takes a screenshot of the page.
func (*Client) SendKeysToDialog ¶
SendKeysToDialog sends text to a dialog
func (*Client) SetContext ¶
SetContext Sets the context of the subsequent commands to be either "chrome" or "content". Must be one of "chrome" or "content" only.
func (*Client) SetPageTimeout ¶
SetPageTimeout Set timeout for page loading. Deprecated
func (*Client) SetScriptTimeout ¶
SetScriptTimeout Set the timeout for asynchronous script execution. Deprecated
func (*Client) SetSearchTimeout ¶
SetSearchTimeout Set timeout for searching for elements. Deprecated
func (*Client) SetWindowRect ¶
func (c *Client) SetWindowRect(rect WindowRect) error
SetWindowRect sets window position and size
func (*Client) SetWindowSize ¶
SetWindowSize sets window size Deprecated: Use SetWindowRect instead.
func (*Client) SwitchToFrame ¶
SwitchToFrame switch to frame - strategies: By(ID), By(NAME) or name only.
func (*Client) SwitchToParentFrame ¶
SwitchToParentFrame switch to parent frame
func (*Client) SwitchToWindow ¶
SwitchToWindow switch to specific window.
func (*Client) TextFromDialog ¶
TextFromDialog gets text from the dialog
func (*Client) Transport ¶
func (c *Client) Transport(t Transporter)
func (*Client) WindowHandles ¶
WindowHandles return array of window ID currently opened
func (*Client) WindowSize ¶
WindowSize returns the window size Deprecated: Use GetWindowRect instead
type DecoderEncoder ¶
func NewDecoderEncoder ¶
func NewDecoderEncoder(protoVersion int32) (DecoderEncoder, error)
type DriverError ¶
func (DriverError) Error ¶
func (e DriverError) Error() string
func (DriverError) String ¶
func (e DriverError) String() string
type ElementRect ¶
type Encoder ¶
type Encoder interface {
Encode(t Transporter, command string, values interface{}) ([]byte, error)
}
type Finder ¶
type Finder interface {
FindElement(by By, value string) (*WebElement, error)
FindElements(by By, value string) ([]*WebElement, error)
}
type MarionetteTransport ¶
type MarionetteTransport struct {
ApplicationType string
MarionetteProtocol int32
// contains filtered or unexported fields
}
func (*MarionetteTransport) Close ¶
func (t *MarionetteTransport) Close() error
func (*MarionetteTransport) Connect ¶
func (t *MarionetteTransport) Connect(host string, port int) error
func (*MarionetteTransport) MessageID ¶
func (t *MarionetteTransport) MessageID() int
func (*MarionetteTransport) Receive ¶
func (t *MarionetteTransport) Receive() ([]byte, error)
type ProtoV3DecoderEncoder ¶
type ProtoV3DecoderEncoder struct{}
func (ProtoV3DecoderEncoder) Decode ¶
func (e ProtoV3DecoderEncoder) Decode(buf []byte, r *Response) error
func (ProtoV3DecoderEncoder) Encode ¶
func (e ProtoV3DecoderEncoder) Encode(t Transporter, command string, values interface{}) ([]byte, error)
type Response ¶
type Response struct {
MessageID int32
Size int32
Value string
DriverError *DriverError
}
type Transporter ¶
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
func (*Waiter) Until ¶
func (w *Waiter) Until(f func(c Finder) (bool, *WebElement, error)) (bool, *WebElement, error)
type WebElement ¶
type WebElement struct {
// contains filtered or unexported fields
}
func (*WebElement) Attribute ¶
func (e *WebElement) Attribute(name string) string
func (*WebElement) Clear ¶
func (e *WebElement) Clear()
func (*WebElement) Click ¶
func (e *WebElement) Click()
func (*WebElement) CssValue ¶
func (e *WebElement) CssValue(property string) string
func (*WebElement) Displayed ¶
func (e *WebElement) Displayed() bool
func (*WebElement) Enabled ¶
func (e *WebElement) Enabled() bool
func (*WebElement) FindElement ¶
func (e *WebElement) FindElement(by By, value string) (*WebElement, error)
func (*WebElement) FindElements ¶
func (e *WebElement) FindElements(by By, value string) ([]*WebElement, error)
func (*WebElement) Id ¶
func (e *WebElement) Id() string
func (*WebElement) Location ¶
func (e *WebElement) Location() (*Point, error)
func (*WebElement) Rect ¶
func (e *WebElement) Rect() (*ElementRect, error)
func (*WebElement) Screenshot ¶
func (e *WebElement) Screenshot() (string, error)
func (*WebElement) Selected ¶
func (e *WebElement) Selected() bool
func (*WebElement) SendKeys ¶
func (e *WebElement) SendKeys(keys string) error
func (*WebElement) Size ¶
func (e *WebElement) Size() (*Size, error)
func (*WebElement) TagName ¶
func (e *WebElement) TagName() string
func (*WebElement) Text ¶
func (e *WebElement) Text() string
func (*WebElement) UnmarshalJSON ¶
func (e *WebElement) UnmarshalJSON(data []byte) error