Documentation ¶
Index ¶
- Variables
- type Browser
- func (b *Browser) Click(xpath string) error
- func (b *Browser) ClickByXY(xpath string) error
- func (b *Browser) Close() error
- func (b *Browser) ElementScreenshot(urlStr string, selectionElem string, by ...func(s *chromedp.Selector)) ([]byte, error)
- func (b *Browser) FindElement(xpath string) error
- func (b *Browser) GetAttributes(xpath string) (map[string]string, error)
- func (b *Browser) GetNodes(xpath string) ([]*cdp.Node, error)
- func (b *Browser) GetSource() (string, error)
- func (b *Browser) GetTopLeft(xpath string) (float64, float64, error)
- func (b *Browser) Location(otherActions ...chromedp.Action) (string, error)
- func (b *Browser) MustClick(xpath string)
- func (b *Browser) MustNavigate(url string, otherActions ...chromedp.Action)
- func (b *Browser) MustSendKeys(xpath, value string)
- func (b *Browser) Navigate(url string, otherActions ...chromedp.Action) error
- func (b *Browser) RunAction(action chromedp.Action) error
- func (b *Browser) RunTaskWithOther(action chromedp.Action, otherActions ...chromedp.Action) error
- func (b *Browser) RunTasks(actions ...chromedp.Action) error
- func (b *Browser) Screenshot(urlStr string, quality int64) ([]byte, error)
- func (b *Browser) SendKeys(xpath, value string) error
- func (b *Browser) SetTimeout(d time.Duration)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("element not found")
ErrNotFound is returned when an XPATH is provided for a DOM element, but it can not be located.
Functions ¶
This section is empty.
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser represents a Chrome browser controlled by chromedp.
func (*Browser) Close ¶
Close cleans up the *Browser; this should be called on every *Browser once its work is complete.
func (*Browser) ElementScreenshot ¶
func (*Browser) FindElement ¶
FindElement attempts to locate a DOM element.
func (*Browser) GetAttributes ¶
GetAttributes returns the HTML attributes of a DOM element.
func (*Browser) GetTopLeft ¶
GetTopLeft returns the x, y coordinates of a DOM element.
func (*Browser) MustNavigate ¶
MustNavigate calls Navigate and ends execution on error.
func (*Browser) MustSendKeys ¶
MustSendKeys sends keystrokes to a DOM element or halts execution.
func (*Browser) RunTaskWithOther ¶
RunTaskWithOther run mutiple action
func (*Browser) Screenshot ¶
func (*Browser) SetTimeout ¶
SetTimeout accepts a time.Duration. This duration will be used as the maximum timeout when waiting for a node to exist.