go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.43k stars 357 forks source link

Code does not continue running when use chromium: Chromium 128.0.6613.84 Alpine Linux #1107

Closed lekhang2512 closed 2 months ago

lekhang2512 commented 3 months ago

Rod Version: v0.116.1

The code to demonstrate your question

  1. Clone Rod to your local and cd to the repository:

    git clone https://github.com/go-rod/rod
    cd rod
  2. Use your code to replace the content of function TestRod in file rod_test.go.

  3. Test your code with: go test -run TestRod, make sure it fails as expected.

  4. 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

lekhang2512 commented 2 months ago

I downgrade version go from FROM golang:1.22-alpine3.19 Chromium 124.0.6367.78 Alpine Linux is working