Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[todo] Support Tabs/Processes #23

Open
headzoo opened this issue Apr 29, 2015 · 1 comment
Open

[todo] Support Tabs/Processes #23

headzoo opened this issue Apr 29, 2015 · 1 comment
Assignees

Comments

@headzoo
Copy link
Owner

headzoo commented Apr 29, 2015

I like that Surf is stateful. Actionable methods like Open() and Post() modify the state of the browser rather than returning some object representing the request. However I've run into some minor problems with this stateful approach. I would like to add support for tabs/processes so developers can configure the browser once, and then create any number of tabs/processes that do the actual work.

How a page is opened now:

bow := surf.NewBrowser()
err := bow.Open("http://golang.org")
if err != nil {
    panic(err)
}

How it would be opened with "tab" support.

// Create and configure a new browser.
bow := surf.NewBrowser()
bow.AddRequestHeader("User-Agent", "Surfbot 1.0")
bow.SetTransport(&http.Transport{})

// Create a new tab. The tab is essentially an instance
// of Browsable, and inherits it's configuration from
// the parent browser.
tab := bow.NewTab()
err := tab.Open("http://golang.org")
if err != nil {
    panic(err)
}

Still debating using the term "tab", which may be taking the browser terminology too far, but on the upside the concept behind a tab -- and how it works -- should be easily understood by developers.

The feature may be treading into "over engineered" territory. Will have to give it some thought.

@headzoo headzoo self-assigned this Apr 29, 2015
@lexesv
Copy link

lexesv commented Oct 9, 2016

It would be great if each tab, can be add your own transport (a proxy, for example). And the function of closing (cleaned) tab.

shavit added a commit to shavit/surf that referenced this issue Aug 30, 2017
headzoo added a commit that referenced this issue Sep 1, 2017
backwardn pushed a commit to backwardn/surf that referenced this issue Aug 21, 2019
* init querystring

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* finalize query url

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* encode body as form

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* add form body support

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants