browser

package
v0.0.0-...-4102953 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

A grawl browser can load pages and submit forms found on those pages.

Index

Constants

View Source
const (
	UAgent string = "Grawl v0.1"
)

Variables

This section is empty.

Functions

func FixProtocol

func FixProtocol(url string) string

prepends http:// to the start of urls which are missing a protocol

Types

type Browser

type Browser struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func NewBrowser

func NewBrowser() *Browser

Create a new Grawl Browser

func NewBrowserWithClient

func NewBrowserWithClient(client *http.Client) *Browser

Create a grawl browser using a predefined http client

func (*Browser) ClearCookies

func (b *Browser) ClearCookies()

func (*Browser) GetCookies

func (b *Browser) GetCookies() []*http.Cookie

func (*Browser) GetUserAgent

func (b *Browser) GetUserAgent() string

Return the user agent the browser is currently using in requests

func (*Browser) Load

func (b *Browser) Load(url string) *element.Page

Load a page from a url

func (*Browser) LoadFile

func (b *Browser) LoadFile(fileName string) *element.Page

Load a page from a local file

func (*Browser) RelToAbs

func (b *Browser) RelToAbs(relUrl string) string

Convert a relative url to an absolute url based on the browsers currently loaded page url

func (*Browser) SetCookie

func (b *Browser) SetCookie(cookie *http.Cookie)

func (*Browser) SetUserAgent

func (b *Browser) SetUserAgent(agent string)

Set the user agent to be used in browser requests

func (*Browser) SubmitForm

func (b *Browser) SubmitForm(form *element.Form) *element.Page

Post a form to the site this browser is connected to

Jump to

Keyboard shortcuts

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