puppet

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

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 20 Imported by: 0

README

puppet

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Puppet

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

Puppet DevTools Protocol browser manager, handling the

func NewPuppet

func NewPuppet(url string) (*Puppet, error)

NewPuppet creates and starts a new CDP instance

func (*Puppet) AttributeValue

func (c *Puppet) AttributeValue(sel string, name string) (value string, ok bool, err error)

AttributeValue retrieves the element attribute value for the first node matching the selector.

func (*Puppet) Attributes

func (c *Puppet) Attributes(sel string) (value map[string]string, err error)

Attributes retrieves the element attributes for the first node matching the selector.

func (*Puppet) AttributesAll

func (c *Puppet) AttributesAll(sel string) (value []map[string]string, err error)

AttributesAll retrieves the element attributes for all nodes matching the selector.

func (*Puppet) Clear

func (c *Puppet) Clear(sel string) (err error)

Clear clears the values of any input/textarea nodes matching the selector.

func (*Puppet) ClearCache

func (c *Puppet) ClearCache() (err error)

ClearCache clears browser cache.

func (*Puppet) ClearCookies

func (c *Puppet) ClearCookies() (err error)

ClearCookies clears browser cookies.

func (*Puppet) Click

func (c *Puppet) Click(sel string) (err error)

Click sends a mouse click event to the first node matching the selector.

func (*Puppet) Close

func (c *Puppet) Close() error

Close closes all Puppet page handlers.

func (*Puppet) CloseTarget

func (c *Puppet) CloseTarget(id string) (err error)

CloseTarget closes the Chrome target with the specified id.

func (*Puppet) Cookies

func (c *Puppet) Cookies() (cookies []*http.Cookie, err error)

Cookies returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field.

func (*Puppet) DelAttribute

func (c *Puppet) DelAttribute(sel string, name string) (err error)

DelAttribute removes the element attribute with name from the first node matching the selector.

func (*Puppet) DelCookies

func (c *Puppet) DelCookies(name string) (err error)

DelCookies deletes browser cookies with matching name and url or domain/path pair.

func (*Puppet) DoubleClick

func (c *Puppet) DoubleClick(sel string) (err error)

DoubleClick sends a mouse double click event to the first node matching the selector.

func (*Puppet) Evaluate

func (c *Puppet) Evaluate(expression string, res interface{}) (err error)

Evaluate is an action to evaluate the Javascript expression, unmarshaling the result of the script evaluation to res.

func (*Puppet) Focus

func (c *Puppet) Focus(sel string) (err error)

Focus focuses the first node matching the selector.

func (*Puppet) InnerHTML

func (c *Puppet) InnerHTML() (res []byte, err error)

InnerHTML retrieves the inner html of the first node matching the selector.

func (*Puppet) KeyAction

func (c *Puppet) KeyAction(key string) (err error)

KeyAction will synthesize a keyDown, char, and keyUp event for each rune contained in keys along with any supplied key options.

func (*Puppet) Location

func (c *Puppet) Location() (url string, err error)

Location retrieves the document location.

func (*Puppet) Navigate

func (c *Puppet) Navigate(url string) error

Navigate navigates the current frame.

func (*Puppet) NavigateBack

func (c *Puppet) NavigateBack() error

NavigateBack navigates the current frame backwards in its history.

func (*Puppet) NavigateForward

func (c *Puppet) NavigateForward() error

NavigateForward navigates the current frame forwards in its history.

func (*Puppet) NewTarget

func (c *Puppet) NewTarget(url string) (id string, err error)

NewTarget an action that creates a new Chrome target, and sets it as the active target.

func (*Puppet) OuterHTML

func (c *Puppet) OuterHTML() (res []byte, err error)

OuterHTML retrieves the outer html of the first node matching the selector.

func (*Puppet) PDF

func (c *Puppet) PDF() (res []byte, err error)

PDF print page as PDF.

func (*Puppet) Reload

func (c *Puppet) Reload() error

Reload reloads the current page.

func (*Puppet) Reset

func (c *Puppet) Reset(sel string) (err error)

Reset is an action that resets the form of the first node matching the selector belongs to.

func (*Puppet) Screenshot

func (c *Puppet) Screenshot() (res []byte, err error)

Screenshot capture page screenshot.

func (*Puppet) ScrollIntoView

func (c *Puppet) ScrollIntoView(sel string) (err error)

ScrollIntoView scrolls the window to the first node matching the selector.

func (*Puppet) SendKeys

func (c *Puppet) SendKeys(sel string, v string) (err error)

SendKeys synthesizes the key up, char, and down events as needed for the runes in v, sending them to the first node matching the selector.

func (*Puppet) SetAttributeValue

func (c *Puppet) SetAttributeValue(sel string, name, value string) (err error)

SetAttributeValue sets the element attribute with name to value for the first node matching the selector.

func (*Puppet) SetAttributes

func (c *Puppet) SetAttributes(sel string, value map[string]string) (err error)

SetAttributes sets the element attributes for the first node matching the selector.

func (*Puppet) SetCookies

func (c *Puppet) SetCookies(cookies []*http.Cookie) (err error)

SetCookies sets given cookies.

func (*Puppet) SetHeaders

func (c *Puppet) SetHeaders(headers map[string]interface{}) (err error)

SetHeaders specifies whether to always send extra HTTP headers with the requests from this page.

func (*Puppet) SetTarget

func (c *Puppet) SetTarget(id string) (err error)

SetTarget is an action that sets the active Chrome handler to the handler associated with the specified id.

func (*Puppet) SetUploadFiles

func (c *Puppet) SetUploadFiles(sel string, files []string) (err error)

SetUploadFiles sets the files to upload (ie, for a input[type="file"] node) for the first node matching the selector.

func (*Puppet) SetValue

func (c *Puppet) SetValue(sel string, value string) (err error)

SetValue sets the value of an element.

func (*Puppet) Snapshot

func (c *Puppet) Snapshot() (res []byte, err error)

Snapshot returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.

func (*Puppet) Stop

func (c *Puppet) Stop() error

Stop stops all navigation and pending resource retrieval.

func (*Puppet) Submit

func (c *Puppet) Submit(sel string) (err error)

Submit is an action that submits the form of the first node matching the selector belongs to.

func (*Puppet) Targets

func (c *Puppet) Targets() (tabs []string, err error)

Targets returns the target IDs of the managed targets.

func (*Puppet) Text

func (c *Puppet) Text(sel string) (value string, err error)

Text retrieves the visible text of the first node matching the selector.

func (*Puppet) Title

func (c *Puppet) Title() (title string, err error)

Title retrieves the document title.

func (*Puppet) Value

func (c *Puppet) Value(sel string) (value string, err error)

Value retrieves the value of the first node matching the selector.

func (*Puppet) WaitEnabled

func (c *Puppet) WaitEnabled(sel string) (err error)

WaitEnabled waits until the selected element is enabled (does not have attribute 'disabled').

func (*Puppet) WaitNotPresent

func (c *Puppet) WaitNotPresent(sel string) (err error)

WaitNotPresent waits until no elements match the specified selector.

func (*Puppet) WaitNotVisible

func (c *Puppet) WaitNotVisible(sel string) (err error)

WaitNotVisible waits until the selected element is not visible.

func (*Puppet) WaitReady

func (c *Puppet) WaitReady(sel string) (err error)

WaitReady waits until the element is ready (ie, loaded by chromedp).

func (*Puppet) WaitSelected

func (c *Puppet) WaitSelected(sel string) (err error)

WaitSelected waits until the element is selected (has attribute 'selected').

func (*Puppet) WaitVisible

func (c *Puppet) WaitVisible(sel string) (err error)

WaitVisible waits until the selected element is visible.

Jump to

Keyboard shortcuts

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