ELEMENTS爱乐小超 2020-05-07
package main
import (
"fmt"
"time"
"github.com/ysmood/rod"
"github.com/ysmood/rod/lib/input"
"github.com/ysmood/rod/lib/launcher"
)
func Example_reuse_sessions() {
url := launcher.NewUserMode().Launch()
browser := rod.New().ControlURL(url).Connect()
page := browser.Timeout(time.Second * 15).Page("https://www.baidu.com")
page.Window(0, 0, 1920, 1080)
// use css selector to get the search input element and input "git"
page.Element("#kw").Input("测试").Press(input.Enter)
// wait until css selector get the element then get the text content of it
text := page.Element(`#\31 > div.c-abstract`).Text() //这里的选择器selector是从chrome控制台中copy的。
fmt.Println(text)
fmt.Println("done")
// Skip
// Output: done
}
func main() {
Example_reuse_sessions()
for {
}
}比较简洁、直观。
根据不同的地区人的喜好,我们可以更好的做出营销,那么不同地区的人进行的搜索词汇也是不一样的,那么如何查看不同地区的人热搜的是什么呢,下面让我介绍一下查看方法。在搜索分类栏有一项为“更多”,点击打开更多