// Package main ... package main import ( "fmt" "log" "net" "net/http" "github.com/go-rod/rod" ) func main() { page := rod.New().MustConnect().MustPage(testServer()) page.MustEval(makeVisibleScript) log.Printf("waiting 3s for box to become visible") page.MustElement("#box1").MustWaitVisible() log.Printf(">>>>>>>>>>>>>>>>>>>> BOX1 IS VISIBLE") page.MustElement("#box2").MustWaitVisible() log.Printf(">>>>>>>>>>>>>>>>>>>> BOX2 IS VISIBLE") } const ( makeVisibleScript = `() => setTimeout(function() { document.querySelector('#box1').style.display = ''; }, 3000)` ) // testServer is a simple HTTP server that serves a static html page. func testServer() string { l, _ := net.Listen("tcp4", "127.0.0.1:0") go func() { _ = http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = fmt.Fprint(w, indexHTML) })) }() return "http://" + l.Addr().String() } const indexHTML = ` example

box3

box4 text



`