go-rod / rod

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

Click Button Eval Js Not Working #1054

Closed refaldyrk closed 1 month ago

refaldyrk commented 1 month ago
image

In My Code

obj, err := p.Eval(`document.querySelector('#base-contextual-sign-in-modal > div > section > button').click()`)

    fmt.Println(obj, err)

Output

<nil> eval js error: TypeError: Cannot read properties of undefined (reading 'apply')
    at <anonymous>:1:74 <nil>
refaldyrk commented 1 month ago

How To Fix It

github-actions[bot] commented 1 month ago

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.115.0

Please fix the format of your markdown:

1:1 MD033/no-inline-html Inline HTML [Element: img]
4:11 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
5 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```go"]
12 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

generated by check-issue

refaldyrk commented 1 month ago

github.com/go-rod/rod v0.115.0

ysmood commented 1 month ago
obj, err := p.Eval(`() => {
  document.querySelector('#base-contextual-sign-in-modal > div > section > button').click()
}`)

    fmt.Println(obj, err)