go-rod / rod

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

Ignoring the error "element's pointer-events is none" #1028

Open CryptoVolting opened 6 months ago

CryptoVolting commented 6 months ago

Rod Version: v0.114.8

How to ignore this error or how to write similar code so that the error does not occur? Because in my conditions, the button often disappears before I can click on it.

el, err := page.Sleeper(rod.NotFoundSleeper).Element(selector)
        if errors.Is(err, &rod.ElementNotFoundError{}) {
        } else if err != nil {
            panic(err)
        } else {
            el.MustClick()
        }

error "element's pointer-events is none"

The same error occurs in this case as well:

page.MustElement(selector)MustClick()       

That means I need the script to continue its work even if the element is not present. Perhaps with this library, I can get the position of the element (X, Y) to press it with a mouse click? However, so far I have not found a way to do this...

github-actions[bot] commented 6 months ago

Please fix the format of your markdown:

13 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

Please fix the golang code in your markdown:

@@ golang markdown block 1 @@
4:27: expected ';', found MustClick
5:2: expected ';', found 'EOF'
5:2: expected '}', found 'EOF'

generated by check-issue

ysmood commented 6 months ago
    point := page.MustElement(selector).MustShape().OnePointInside()
    page.Mouse.MustMoveTo(point.X, point.Y).MustClick(proto.InputMouseButtonRight)