Documentation ¶
Index ¶
- Variables
- type ChromeSession
- func (cs *ChromeSession) ClickItemWithClasses(classes string, itemIndex int)
- func (cs *ChromeSession) ClickItemWithID(id string)
- func (cs *ChromeSession) ClickItemWithInnerHTML(elementType string, s string, itemIndex int)
- func (cs *ChromeSession) ClickSelector(s string)
- func (cs *ChromeSession) Exit()
- func (cs *ChromeSession) ForceClose()
- func (cs *ChromeSession) GetContentOfItemWithClasses(classes string, itemIndex int)
- func (cs *ChromeSession) GetContentOfItemWithSelector(selector string)
- func (cs *ChromeSession) GetItemWithInnerHTML(elementType string, s string, itemIndex int)
- func (cs *ChromeSession) GetValueOfItemWithClasses(classes string, itemIndex int)
- func (cs *ChromeSession) SetInputTextByClasses(classes string, itemIndex int, text string)
- func (cs *ChromeSession) SetTextByClasses(classes string, itemIndex int, text string)
- func (cs *ChromeSession) SetTextByID(id string, text string)
- func (cs *ChromeSession) Write(s string)
Constants ¶
This section is empty.
Variables ¶
var Args = []string{
"--headless",
"--disable-gpu",
"--repl",
}
Args are the args that will be used to start chrome
var BrowserStartupTime = time.Second * 20
BrowserStartupTime is how long chrome has to startup the console before we consider it a failure
var ChromePath = ChromePathMacOS
ChromePath is the command to execute chrome
var ChromePathDocker = `/opt/google/chrome-unstable/chrome`
ChromePathDocker is where chrome normally lives in the project's docker container
var ChromePathMacOS = `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`
ChromePathMacOS is where chrome normally lives on MacOS
var Debug bool
Debug enables debug output for this package to console
Functions ¶
This section is empty.
Types ¶
type ChromeSession ¶
type ChromeSession struct { Session *interactive.Session Output chan string Input chan string }
ChromeSession is an interactive console Session with a Chrome instance.
func NewBrowser ¶
func NewBrowser(url string) (*ChromeSession, error)
NewBrowser starts a new chrome headless Session.
func NewBrowserWithTimeout ¶
func NewBrowserWithTimeout(url string, timeout time.Duration) (*ChromeSession, error)
NewBrowserWithTimeout starts a new chrome headless session but limits how long it can run before its killed forcefully. A time limit of 0 means there is not a time limit
func (*ChromeSession) ClickItemWithClasses ¶
func (cs *ChromeSession) ClickItemWithClasses(classes string, itemIndex int)
ClickItemWithClasses clicks on the first item it finds with the provided classes. Multiple classes are separated by spaces
func (*ChromeSession) ClickItemWithID ¶
func (cs *ChromeSession) ClickItemWithID(id string)
ClickItemWithID clicks an item with the specified id
func (*ChromeSession) ClickItemWithInnerHTML ¶
func (cs *ChromeSession) ClickItemWithInnerHTML(elementType string, s string, itemIndex int)
ClickItemWithInnerHTML clicks an item that has the matching inner html
func (*ChromeSession) ClickSelector ¶
func (cs *ChromeSession) ClickSelector(s string)
ClickSelector calls a click() on the supplied selector
func (*ChromeSession) Exit ¶
func (cs *ChromeSession) Exit()
Exit exits the running command out by ossuing a 'quit' to the chrome console
func (*ChromeSession) ForceClose ¶
func (cs *ChromeSession) ForceClose()
ForceClose issues a force kill to the command
func (*ChromeSession) GetContentOfItemWithClasses ¶
func (cs *ChromeSession) GetContentOfItemWithClasses(classes string, itemIndex int)
GetContentOfItemWithClasses fetches the content of the element with the specified classes
func (*ChromeSession) GetContentOfItemWithSelector ¶
func (cs *ChromeSession) GetContentOfItemWithSelector(selector string)
GetContentOfItemWithSelector gets the content of an element with the specified selector
func (*ChromeSession) GetItemWithInnerHTML ¶
func (cs *ChromeSession) GetItemWithInnerHTML(elementType string, s string, itemIndex int)
GetItemWithInnerHTML fetches the item with the specified innerHTML content
func (*ChromeSession) GetValueOfItemWithClasses ¶
func (cs *ChromeSession) GetValueOfItemWithClasses(classes string, itemIndex int)
GetValueOfItemWithClasses returns the form value of the specified item
func (*ChromeSession) SetInputTextByClasses ¶
func (cs *ChromeSession) SetInputTextByClasses(classes string, itemIndex int, text string)
SetInputTextByClasses sets the input text for an input field
func (*ChromeSession) SetTextByClasses ¶
func (cs *ChromeSession) SetTextByClasses(classes string, itemIndex int, text string)
SetTextByClasses sets the text on the div with the specified id
func (*ChromeSession) SetTextByID ¶
func (cs *ChromeSession) SetTextByID(id string, text string)
SetTextByID sets the text on the div with the specified id