actions

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Children

func Children(frame *cdp.Frame, nodeID dom.NodeID, timeout time.Duration) error

Children of the first element node that matches the find parameter. If the frame.DOM object already has the data, this call will do nothing. Otherwise, it should trigger DOM.setChildNodes events. NOTE: It appears that before this action will be completed (before the reply is received), if the server has not yet sent any/some of the child nodes of the given nodeID, then it will send those to the client

as DOM.setChildNodes events.  We do not need to pick those up here since there is a method in the websocket loop of github.com/4ydx/chrome-protocol that watches for such events and updates the DOM object.
In fact, I don't know how many of those events might be fired and an action's event slice isn't designed to handle multiples of the same event type.

func Clear

func Clear(frame *cdp.Frame, find string, timeout time.Duration) error

Clear clears out the value attribute of the found element.

func Click

func Click(frame *cdp.Frame, find string, events []cdp.Event, timeout time.Duration) ([]cdp.Event, error)

Click on the first element matching the find parameter. Any events that need to be tracked as a result of the click must be included. This will insure that the click action waits until required events are fired.

func ClickNodeID

func ClickNodeID(frame *cdp.Frame, nodeID dom.NodeID, modifiers int, events []cdp.Event, timeout time.Duration) ([]cdp.Event, error)

ClickNodeID clicks on the element identified by the given dom.NodeID value.

func ClickWithModifiers

func ClickWithModifiers(frame *cdp.Frame, find string, modifiers int, events []cdp.Event, timeout time.Duration) ([]cdp.Event, error)

ClickWithModifiers clicks on a found element using the specified key modifier values.

func Cookies

func Cookies(frame *cdp.Frame, timeout time.Duration) ([]network.Cookie, error)

Cookies gets the browser's current cookies.

func EnableAll

func EnableAll(frame *cdp.Frame, timeout time.Duration) error

EnableAll tells the server to send all event values across the websocket.

func EnableCSS

func EnableCSS(frame *cdp.Frame, timeout time.Duration) error

EnableCSS tells the server to send the css event values across the websocket.

func EnableDom

func EnableDom(frame *cdp.Frame, timeout time.Duration) error

EnableDom tells the server to send the dom event values across the websocket.

func EnableIndexedDB

func EnableIndexedDB(frame *cdp.Frame, timeout time.Duration) error

EnableIndexedDB tells the server to send the indexeddb event values across the websocket.

func EnableLog added in v1.0.3

func EnableLog(frame *cdp.Frame, timeout time.Duration) error

EnableLog tells the server to send the log event values across the websocket.

func EnableNetwork

func EnableNetwork(frame *cdp.Frame, timeout time.Duration) error

EnableNetwork tells the server to send the network event values across the websocket.

func EnablePage

func EnablePage(frame *cdp.Frame, timeout time.Duration) error

EnablePage tells the server to send the page event values across the websocket.

func EnableRuntime

func EnableRuntime(frame *cdp.Frame, timeout time.Duration) error

EnableRuntime tells the server to send the runtime event values across the websocket.

func Evaluate

func Evaluate(frame *cdp.Frame, expression string, timeout time.Duration) (*runtime.EvaluateReply, error)

Evaluate runs the javascript expression in the current frame's context.

func Fill

func Fill(frame *cdp.Frame, find, fill string, timeout time.Duration) error

Fill on the first element node that matches the find parameter. dom.Focus can be called in order to focus an element in order to fill it.

func FindAll

func FindAll(frame *cdp.Frame, find string, timeout time.Duration) ([]dom.Node, error)

FindAll finds all nodes using XPath, CSS selector, or text.

func FindFirstElementNodeID

func FindFirstElementNodeID(frame *cdp.Frame, find string, timeout time.Duration) (dom.NodeID, error)

FindFirstElementNodeID gets the first element's nodeId using XPath, Css selector, or text matches with the find parameter.

func Focus

func Focus(frame *cdp.Frame, find string, timeout time.Duration) error

Focus on the first element node that matches the find parameter.

func GetComputedStyleForNode

func GetComputedStyleForNode(frame *cdp.Frame, nodeID dom.NodeID, timeout time.Duration) (*css.GetComputedStyleForNodeReply, error)

GetComputedStyleForNode get the computed style for a node.

func GetEntireDocument

func GetEntireDocument(frame *cdp.Frame, timeout time.Duration) (*dom.GetFlattenedDocumentReply, error)

GetEntireDocument retrieves the root document and all children for the entire page.

func GetFrameNavigatedURL

func GetFrameNavigatedURL(events []cdp.Event) string

GetFrameNavigatedURL returns the url of the FrameNavigatedReply object in the array of events. When using GetNavigationEvents in conjunction with the Click action, the resulting events will have one FrameNavigatedReply. Using this method allows quick access of the FrameNavigatedReply URL, which is usually the navigated to URL for simple webpages.

func GetNavigationEvents

func GetNavigationEvents() []cdp.Event

GetNavigationEvents returns all events that are expected to occur after a page navigation api request is made.

func GetProperties

func GetProperties(frame *cdp.Frame, objectID shared.RemoteObjectID, ownProperties, accessorPropertiesOnly bool, timeout time.Duration) (*runtime.GetPropertiesReply, error)

GetProperties runs the properties of a given object.

func GetWindowsVirtualKeyCode

func GetWindowsVirtualKeyCode(modifiers int) int

GetWindowsVirtualKeyCode returns the known javascript value for a given modifier key. The meta/command modifier is not currently supported as it appear to vary across implementations.

func KeyDown

func KeyDown(frame *cdp.Frame, modifiers int, timeout time.Duration) error

KeyDown sends a keydown request to the server.

func MouseScroll

func MouseScroll(frame *cdp.Frame, deltaX, deltaY float64, timeout time.Duration) error

MouseScroll scrolls the mouse the given amount.

func Navigate(frame *cdp.Frame, url string, timeout time.Duration) ([]cdp.Event, error)

Navigate sends the browser to the given URL

func RequestData

func RequestData(frame *cdp.Frame, securityOrigin, databaseName, objectStoreName, indexName string, skipCount, pageSize int, keyRange *indexeddb.KeyRange, timeout time.Duration) (*indexeddb.RequestDataReply, error)

RequestData returns the requested data.

func RequestDatabase

func RequestDatabase(frame *cdp.Frame, securityOrigin, databaseName string, timeout time.Duration) (*indexeddb.RequestDatabaseReply, error)

RequestDatabase returns the database with object stores.

func RequestDatabaseNames

func RequestDatabaseNames(frame *cdp.Frame, securityOrigin string, timeout time.Duration) (*indexeddb.RequestDatabaseNamesReply, error)

RequestDatabaseNames returns a list of the databases controlled by the given security origin.

func Screenshot

func Screenshot(frame *cdp.Frame, destination, format string, quality int, clip *page.Viewport, timeout time.Duration) (err error)

Screenshot captures a screenshot and saves it to the given destination.

func SetAttributeValue

func SetAttributeValue(frame *cdp.Frame, nodeID dom.NodeID, name, value string, timeout time.Duration) error

SetAttributeValue sets the value of the given attribute of the given nodeID to the given value.

func SetCookie

func SetCookie(frame *cdp.Frame, url string, cookie *http.Cookie, timeout time.Duration) (bool, error)

SetCookie sets one cookie in the browser.

func SetDeviceMetricsOverride

func SetDeviceMetricsOverride(frame *cdp.Frame, width, height int, mobile bool, timeout time.Duration) error

func WaitForComputedStyle

func WaitForComputedStyle(frame *cdp.Frame, find, cssPropery, cssValue string, timeout time.Duration) error

WaitForComputedStyle finds the first element on a page by id, css, or xpath and waits until the given css propery is set to the given css value. For instance, wait until the cssPropery "display" is set to cssValue "none". That is, until the found html element disappears from view.

Types

This section is empty.

Jump to

Keyboard shortcuts

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