func newDefaultTestBrowser() *Browser { bow := &Browser{} bow.SetUserAgent(agent.Create()) bow.SetState(&jar.State{}) bow.SetCookieJar(jar.NewMemoryCookies()) bow.SetBookmarksJar(jar.NewMemoryBookmarks()) bow.SetHistoryJar(jar.NewMemoryHistory()) bow.SetHeadersJar(jar.NewMemoryHeaders()) bow.SetAttributes(AttributeMap{ SendReferer: true, MetaRefreshHandling: true, FollowRedirects: true, }) return bow }
// NewBrowser creates and returns a *browser.Browser type. func NewBrowser() *browser.Browser { bow := &browser.Browser{} bow.SetUserAgent(DefaultUserAgent) bow.SetState(&jar.State{}) bow.SetCookieJar(jar.NewMemoryCookies()) bow.SetBookmarksJar(jar.NewMemoryBookmarks()) bow.SetHistoryJar(jar.NewMemoryHistory()) bow.SetHeadersJar(jar.NewMemoryHeaders()) bow.SetAttributes(browser.AttributeMap{ browser.SendReferer: DefaultSendReferer, browser.MetaRefreshHandling: DefaultMetaRefreshHandling, browser.FollowRedirects: DefaultFollowRedirects, }) return bow }