headzoo / surf

Stateful programmatic web browsing in Go.
MIT License
1.49k stars 160 forks source link

browser.Title() incorrect behaviour #98

Open nsmith5 opened 6 years ago

nsmith5 commented 6 years ago

browser.Title() matches all title tags, but should only match one in the head section.

Example

package main

import (
    "gopkg.in/headzoo/surf.v1"
    "fmt"
)

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

    // Outputs: "The Go Programming Language"
    fmt.Println(bow.Title())
}

Expected behaviour: prints 'The Go Programming Language' Actual behaviour: prints 'The Go Programming Languagesubmit search'.