chromego

package module
v0.0.0-...-278b542 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 7 Imported by: 0

README

chromego

An abstraction layer on the WebDriver API using selenium, based on the goselenium library

Download a chrome driver here

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver contains all the data and methods for a chrome driver

func CreateDriver

func CreateDriver(chromedriverpath string, port int) (Driver, error)

CreateDriver starts a driver and sets up the session

func (*Driver) Close

func (d *Driver) Close() error

Close closes the session

func (*Driver) FindByCSSSelector

func (d *Driver) FindByCSSSelector(selector string) (Element, error)

FindByCSSSelector finds an element by its css selector

func (*Driver) FindByIndex

func (d *Driver) FindByIndex(index uint) (Element, error)

FindByIndex finds an element by its index on the page's elements

func (*Driver) FindByLinkText

func (d *Driver) FindByLinkText(text string) (Element, error)

FindByLinkText finds a link by link text

func (*Driver) FindByPartialLinkText

func (d *Driver) FindByPartialLinkText(partialText string) (Element, error)

FindByPartialLinkText finds a link by part of its text

func (*Driver) FindByXPath

func (d *Driver) FindByXPath(xpath string) (Element, error)

FindByXPath finds an element by its XPath

func (*Driver) FindElemsByCSSSelector

func (d *Driver) FindElemsByCSSSelector(selector string) ([]Element, error)

FindElemsByCSSSelector finds elements by a css selector

func (*Driver) FindElemsByLinkText

func (d *Driver) FindElemsByLinkText(text string) ([]Element, error)

FindElemsByLinkText finds links by their text

func (*Driver) FindElemsByPartialLinkText

func (d *Driver) FindElemsByPartialLinkText(partialText string) ([]Element, error)

FindElemsByPartialLinkText finds a links by part of their text

func (*Driver) FindElemsByXPath

func (d *Driver) FindElemsByXPath(xpath string) ([]Element, error)

FindElemsByXPath finds elements by their XPath

func (*Driver) Navigate

func (d *Driver) Navigate(url string) error

Navigate navigates the driver to a url

func (*Driver) Refresh

func (d *Driver) Refresh() error

Refresh refreshes the driver

func (*Driver) Screenshot

func (d *Driver) Screenshot() (image.Image, error)

Screenshot gets a screenshot of the window

func (*Driver) ScreenshotBase64

func (d *Driver) ScreenshotBase64() (string, error)

ScreenshotBase64 gets a base64 screenshot of the window

func (*Driver) Size

func (d *Driver) Size() (int, int, error)

Size returns the x, y size of the window

func (*Driver) URL

func (d *Driver) URL() string

URL gets the driver's current URL

type Element

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

Element has all the element functions

func (*Element) Attr

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

Attr gets an element's attribute

func (*Element) CSSAttr

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

CSSAttr gets an element's css attribute

func (*Element) Clear

func (e *Element) Clear() error

Clear clears an element

func (*Element) Click

func (e *Element) Click() error

Click clicks an element

func (*Element) Enabled

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

Enabled gets whether an element is enabled

func (*Element) ID

func (e *Element) ID() string

ID gets an element's id

func (*Element) Rect

func (e *Element) Rect() (Rect, error)

Rect gets an element's rectangle

func (*Element) Selected

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

Selected gets whether an element is selected

func (*Element) Tag

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

Tag gets an element's tag (p, div, etc.)

func (*Element) Text

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

Text gets an element's innertext

func (*Element) Type

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

Type sends keys to an element

type Rect

type Rect struct {
	X      int
	Y      int
	Width  int
	Height int
}

Rect contains a rectangle's dimensions and position

Jump to

Keyboard shortcuts

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