Documentation
¶
Overview ¶
Package find provides enhanced element finding capabilities including CSS selectors, XPath support, wait functions, and element state checks.
Key features:
- CSS selectors: Find elements by tag, ID, class, name, attributes
- XPath support: Use XPath expressions for complex element selection
- Wait functions: Wait for elements to appear, become visible, or contain text
- Element state: Check if elements are visible, enabled, clickable
Example usage:
finder := find.New(page)
// Find element by CSS
element, err := finder.Find(find.Selector{
TagName: "button",
Class: "submit",
})
// Wait for element
err := finder.WaitForElement(find.Selector{
ID: "dynamic-content",
})
// Check element state
state := find.NewElementState(element)
visible, _ := state.IsVisible()
Index ¶
- func NormalizeXPath(selector string) string
- type ElementState
- type Finder
- func (f *Finder) Find(sel Selector) (*rod.Element, error)
- func (f *Finder) FindAll(sel Selector) ([]*rod.Element, error)
- func (f *Finder) WaitForElement(sel Selector) error
- func (f *Finder) WaitForText(sel Selector) error
- func (f *Finder) WaitUntilVisible(el *rod.Element, timeout time.Duration) error
- type Selector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeXPath ¶
NormalizeXPath converts synthetic xpath back to regular xpath
Types ¶
type ElementState ¶
type ElementState struct {
// contains filtered or unexported fields
}
ElementState provides element state checks
func NewElementState ¶
func NewElementState(el *rod.Element) *ElementState
NewElementState creates a new element state checker
func (*ElementState) IsClickable ¶
func (s *ElementState) IsClickable() (bool, error)
IsClickable checks if element is clickable
func (*ElementState) IsEnabled ¶
func (s *ElementState) IsEnabled() (bool, error)
IsEnabled checks if element is enabled
func (*ElementState) IsVisible ¶
func (s *ElementState) IsVisible() (bool, error)
IsVisible checks if element is visible
type Finder ¶
type Finder struct {
// contains filtered or unexported fields
}
Finder provides enhanced element finding capabilities
func (*Finder) WaitForElement ¶
WaitForElement waits for an element to appear in the DOM
func (*Finder) WaitForText ¶
WaitForText waits for specific text to appear
Click to show internal directories.
Click to hide internal directories.