common

package
v0.0.0-...-e79c2b1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using examples from: https://github.com/chromedp/chromedp/issues/835

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClickOnAnchorAndOpenNewTab

func ClickOnAnchorAndOpenNewTab(ctx context.Context, node *cdp.Node) (newTabCtx context.Context, cancelFunc func(), err error)

func ConcatenateErrors

func ConcatenateErrors(errors ...error) error

func Get1stGroupMatch

func Get1stGroupMatch(str string, re *regexp.Regexp) string

func Get2ndGroupMatch

func Get2ndGroupMatch(str string, re *regexp.Regexp) string

func Get3rdGroupMatch

func Get3rdGroupMatch(str string, re *regexp.Regexp) string

func GetAllAnchorNodes

func GetAllAnchorNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetAllButtonNodes

func GetAllButtonNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetAllDivNodes

func GetAllDivNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetAllImgNodes

func GetAllImgNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetAllInputNodes

func GetAllInputNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetAllSvgNodes

func GetAllSvgNodes(ctx context.Context) (nodes []*cdp.Node, err error)

func GetFirstDescendantOfSlibingNodes

func GetFirstDescendantOfSlibingNodes(node *cdp.Node, descendantNodeLocalName string) *cdp.Node

func GetHref

func GetHref(node *cdp.Node) string

func GetNodeWithText

func GetNodeWithText(ctx context.Context, textToMatch string, nodes []*cdp.Node) (nodeWithText *cdp.Node, err error)

func GetNodesAttrsMap

func GetNodesAttrsMap(nodes []*cdp.Node) map[*cdp.Node]map[string]string

func LogPageLoaded

func LogPageLoaded(ctx context.Context)

func PrintNodesAltAndSrc

func PrintNodesAltAndSrc(nodes []*cdp.Node)

func RequestSubtree

func RequestSubtree(ctx context.Context, node *cdp.Node) (err error)

func SaveScreenshotsOfThumbnailNodes

func SaveScreenshotsOfThumbnailNodes(ctx context.Context, imgNodes []*cdp.Node) (err error)

func ScrollToButtomOfPage

func ScrollToButtomOfPage(ctx context.Context) (err error)

func StartSavingResponseToFile

func StartSavingResponseToFile(ctx context.Context, requestID network.RequestID, filepath string) (err error)

func TargetNode

func TargetNode(node *cdp.Node) chromedp.QueryOption

TargetNode is used to target a specific node which chromedp does QueryAction on. it helps the convoluting usage of "chromedp.FromNode(node.Parent)"

Types

type Errors

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

func (*Errors) Add

func (c *Errors) Add(err error)

Add adds a new error

func (*Errors) Clean

func (c *Errors) Clean()

Clean cleans list of errors

func (*Errors) Get

func (c *Errors) Get() error

Get gets all error in the struct

func (*Errors) Size

func (c *Errors) Size() int

Get gets all error in the struct

type UrlMap

type UrlMap map[string]struct{}

func NewUrlMap

func NewUrlMap() UrlMap

func (UrlMap) AddUrlsFromAnchorNodes

func (um UrlMap) AddUrlsFromAnchorNodes(nodes []*cdp.Node)

func (UrlMap) AddUrlsFromImgNodes

func (um UrlMap) AddUrlsFromImgNodes(nodes []*cdp.Node)

func (UrlMap) AddUrlsFromNodes

func (um UrlMap) AddUrlsFromNodes(nodes []*cdp.Node, attrName string)

func (UrlMap) Aggregate

func (um UrlMap) Aggregate(um2 UrlMap)

Jump to

Keyboard shortcuts

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