Debian Codegraph @

lib/examples/compare-chromedp/text/main.go

raw
1 // Package main ...
2 package main
3
4 import (
5 "log"
6 "strings"
7
8 "github.com/go-rod/rod"
9 )
10
11 // This example demonstrates how to extract text from a specific element.
12 func main() {
13 page := rod.New().MustConnect().MustPage("https://pkg.go.dev/time")
14
15 res := page.MustElement("#pkg-overview").MustParent().MustText()
16 log.Println(strings.TrimSpace(res))
17 }