Use your code to replace the content of function TestRod in file rod_test.go.
Test your code with: go test -run TestRod, make sure it fails as expected.
Replace ALL THE CONTENT under "The code to demonstrate your question" with your TestRod function, like below:
func TestRod(t *testing.T) {
fmt.Println("Starting process...")
startTime := time.Now()
path, _ := launcher.LookPath()
u := launcher.New().Bin(path).MustLaunch()
browser := rod.New().ControlURL(u).MustConnect()
// Even you forget to close, rod will close it after main process ends.
defer browser.MustClose()
// Create a new page
fmt.Println("link: ", "https://www.google.com/maps/search/Vincom+Center+B%C3%A0+Tri%E1%BB%87u?authuser=0&entry=ttu&hl=en")
page := browser.MustPage("https://www.google.com/maps/search/Vincom+Center+B%C3%A0+Tri%E1%BB%87u?authuser=0&entry=ttu&hl=en").MustWaitStable()
fmt.Println("page: ", page)
endTime := time.Now()
fmt.Println("Process completed.")
fmt.Printf("Start time: %s\n", startTime.Format(time.RFC3339))
fmt.Printf("End time: %s\n", endTime.Format(time.RFC3339))
fmt.Printf("Duration: %s\n", endTime.Sub(startTime))
}
What you got
Code does not continue running after calling browser.MustPage
panic: test timed out after 5m0s
What you expect to see
I need the program to keep running for processing page
html, err := page.HTML()
What have you tried to solve the question
I use: apk add chromium
I tried downgrading to a lower version of chromium but it didn't work
Before chromium version: Chromium 125.0.6422.112 Alpine Linux
Rod Version: v0.116.1
The code to demonstrate your question
Clone Rod to your local and cd to the repository:
Use your code to replace the content of function
TestRod
in filerod_test.go
.Test your code with:
go test -run TestRod
, make sure it fails as expected.Replace ALL THE CONTENT under "The code to demonstrate your question" with your
TestRod
function, like below:What you got
Code does not continue running after calling browser.MustPage panic: test timed out after 5m0s
What you expect to see
I need the program to keep running for processing page html, err := page.HTML()
What have you tried to solve the question
I use: apk add chromium I tried downgrading to a lower version of chromium but it didn't work Before chromium version: Chromium 125.0.6422.112 Alpine Linux