ldtp

package module
v0.0.0-...-b1c6fb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2015 License: GPL-3.0 Imports: 5 Imported by: 0

README

Go library to interface with LDTP Servers

GoDoc

This library allows you to pilot LDTP implementations for Windows, Mac and Linux through the same endpoints used by http://ldtp.freedesktop.org/user-doc/index.html, allowing you to click, focus on windows, type some text in editboxes, push some buttons, take screenshots and other desktop automation functionalities.

See http://ldtp.freedesktop.org/user-doc/d5/db1/a00140.html and the links to the Mac, Windows and Linux source code therein for a better understanding of what is offered.

Example usage

	client := New("localhost:4118")

	guiExists, err := client.GUIExist("*Chrome")
    if err != nil || !guiExists {
        log.Fatalln("Chrome doesn't exist")
    }

	client.CaptureScreen("/tmp/boo1.jpg")

License

GPLv3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateActive = LDTPState("active")
View Source
var StateAnimated = LDTPState("animated")
View Source
var StateArmed = LDTPState("armed")
View Source
var StateBusy = LDTPState("busy")
View Source
var StateChecked = LDTPState("checked")
View Source
var StateCollapsed = LDTPState("collapsed")
View Source
var StateDefunct = LDTPState("defunct")
View Source
var StateEditable = LDTPState("editable")
View Source
var StateEnabled = LDTPState("enabled")
View Source
var StateExpandable = LDTPState("expandable")
View Source
var StateExpanded = LDTPState("expanded")
View Source
var StateFocusable = LDTPState("focusable")
View Source
var StateFocused = LDTPState("focused")
View Source
var StateHasTooltip = LDTPState("has_tooltip")
View Source
var StateHorizontal = LDTPState("horizontal")
View Source
var StateIconified = LDTPState("iconified")
View Source
var StateIndeterminate = LDTPState("indeterminate")
View Source
var StateInvalid = LDTPState("invalid")
View Source
var StateInvalidEntry = LDTPState("invalid_entry")
View Source
var StateIsDefault = LDTPState("is_default")
View Source
var StateLastDefined = LDTPState("last_defined")
View Source
var StateManagesDescendants = LDTPState("manages_descendants")
View Source
var StateModal = LDTPState("modal")
View Source
var StateMultiLine = LDTPState("multi_line")
View Source
var StateMultiselectable = LDTPState("multiselectable")
View Source
var StateOpaque = LDTPState("opaque")
View Source
var StatePressed = LDTPState("pressed")
View Source
var StateRequired = LDTPState("required")
View Source
var StateResizable = LDTPState("resizable")
View Source
var StateSelectable = LDTPState("selectable")
View Source
var StateSelectableText = LDTPState("selectable_text")
View Source
var StateSelected = LDTPState("selected")
View Source
var StateSensitive = LDTPState("sensitive")
View Source
var StateShowing = LDTPState("showing")
View Source
var StateSingleLine = LDTPState("single_line")
View Source
var StateStale = LDTPState("stale")
View Source
var StateSupportsAutocompletion = LDTPState("supports_autocompletion")
View Source
var StateTransient = LDTPState("transient")
View Source
var StateVertical = LDTPState("vertical")
View Source
var StateVisible = LDTPState("visible")
View Source
var StateVisited = LDTPState("visited")
View Source
var Statetruncated = LDTPState("truncated")

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the interface to the LDTP server, on which you can make all future calls.

func New

func New(hostPort string) *Client

New creates a Client, provided with a "host:port" string

func (*Client) ActivateText

func (c *Client) ActivateText(windowName string, objectName string) error

ActivateText activates the text in an object.

func (*Client) ActivateWindow

func (c *Client) ActivateWindow(windowName string) error

Activate window (bring it to front)

func (*Client) CaptureScreen

func (c *Client) CaptureScreen(filename string) error

CaptureScreen takes a full screen capture (calls imagecapture).

func (*Client) CaptureSized

func (c *Client) CaptureSized(filename string, size Size) error

CaptureSized takes a full screen capture (calls imagecapture).

func (*Client) CaptureWindow

func (c *Client) CaptureWindow(filename, windowName string) error

CaptureWindow takes a screen capture of a single window (calls imagecapture).

func (*Client) Click

func (c *Client) Click(windowName, objectName string) error

Click does a click, press, select, check on buttons, combo boxes, etc..

func (*Client) EnterString

func (c *Client) EnterString(windowName, objectName string, data string) (out bool, err error)

EnterString sends a string of data in an object.

func (*Client) GUIExists

func (c *Client) GUIExists(windowName string) (out bool, err error)

GUIExists checks whether a window or component exists.

func (*Client) GUIObjectExists

func (c *Client) GUIObjectExists(windowName, objectName string) (out bool, err error)

GUIObjectExists returns whether the objectName exists. This replaces the `ldtp` `objectexist` call.

func (*Client) GUITimeout

func (c *Client) GUITimeout(guiTimeout int) (out bool, err error)

GUITimeout sets the global timeout for windows, in seconds.

func (*Client) GenerateKeyEvent

func (c *Client) GenerateKeyEvent(characters string) error

GenerateKeyEvent sends a series of characters as key events.

func (*Client) GenerateMouseEvent

func (c *Client) GenerateMouseEvent(x, y int, eventType string) error

GenerateMouseEvent does a mouse action at a given screen position.

The eventType can be: "abs" to jump to an absolute position, "rel" to move relatively to previous position, "b1p" to press left button, "b1r" to release left button, "b1c" to click left button, "b1d" to double-click left button. A similar pattern goes with "b2p", "b2r", "b2c" and "b2d" for the middle button, and b3[prcd] for the right button.

func (*Client) GetAllStates

func (c *Client) GetAllStates(windowName, objectName string) (out map[string]bool, err error)

GetAllStates retrieves the states for a given object (ex: focusable, showing, visible, selectable, enabled, sensitive, horizontal, vertical, etc...)

func (*Client) GetAppList

func (c *Client) GetAppList() (res []string, err error)

GetAppList retrieves the list of accessibility application windows open.

func (*Client) GetChild

func (c *Client) GetChild(windowName, componentName, role string) (res []string, err error)

GetChild gets the list of child objects available in the window, by matching componentName or role, or both (if non-empty string).

func (*Client) GetObjectInfo

func (c *Client) GetObjectInfo(windowName, objectName string) (res []string, err error)

GetObjectInfo retrieves infos on objects for a given Window name.

func (*Client) GetObjectList

func (c *Client) GetObjectList(windowName string) (res []string, err error)

GetObjectList retrieves the list of available objects on a window.

func (*Client) GetObjectProperties

func (c *Client) GetObjectProperties(windowName, objectName string) (map[string]interface{}, error)

GetObjectProperties is a shorthand to retrieve all the properties. If you care about speed, use GetObjectProperty instead.

func (*Client) GetObjectProperty

func (c *Client) GetObjectProperty(windowName, objectName, propertyName string) (value interface{}, err error)

GetObjectProperty retrieves a property of an object. Must be a property that exists as returned by `GetObjectInfo`.

func (*Client) GetObjectSize

func (c *Client) GetObjectSize(windowName, objectName string) (*Size, error)

GetObjectSize retrieves a Size object representing the width, height and position of a widget.

func (*Client) GetTextValue

func (c *Client) GetTextValue(windowName, objectName string, startOffset, endOffset int) (value string, err error)

GetTextValue retrieves the text displayed for an object. Specify -1 for `startOffset` and `endOffset` for default values.

func (*Client) GetWindowList

func (c *Client) GetWindowList() (res []string, err error)

GetWindowList retrieves the list of windows, frames and panels.

func (*Client) GetWindowSize

func (c *Client) GetWindowSize(windowName string) (*Size, error)

GetWindowSize retrieves the size of a window, and returns a Size.

func (*Client) KeyPress

func (c *Client) KeyPress(code string) error

KeyPress sends a keyboard press

func (*Client) LaunchApp

func (c *Client) LaunchApp(appname string, args ...string) (out bool, err error)

LaunchApp launches an app.

func (*Client) MouseLeftClick

func (c *Client) MouseLeftClick(windowName, objectName string) error

MouseLeftClick clicks the left mouse button in the middle of the specified object.

func (*Client) MouseMove

func (c *Client) MouseMove(windowName, objectName string) error

MouseMove moves the mouse in the middle of a certain object.

func (*Client) MouseRightClick

func (c *Client) MouseRightClick(windowName, objectName string) error

MouseRightClick clicks the right mouse button in the middle of the specified object.

func (*Client) ObjTimeout

func (c *Client) ObjTimeout(objTimeout int) (out bool, err error)

ObjTimeout sets the global timeout for objects, in seconds.

func (*Client) WaitUntilGUIExists

func (c *Client) WaitUntilGUIExists(windowName, objectName string, timeout int) (out bool, err error)

WaitUntilGUIExists calls `waittillguiexist` and fixes its weird syntax !

func (*Client) WaitUntilGUIInState

func (c *Client) WaitUntilGUIInState(windowName, objectName string, timeout int, state LDTPState) (out bool, err error)

type LDTPState

type LDTPState string

type Size

type Size struct {
	X, Y, Width, Height int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL