-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add the MouseMoveNode function #787
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And can you please add unit tests for the new funcs?
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra blank lines
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra blank lines
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra blank lines
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra blank lines above.
Type: input.MouseMoved, | ||
X: x, | ||
Y: y, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use the constructor func?
p := input.DispatchMouseEvent(input.MouseMoved, x, y)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I just noticed this function here, it did the thing what I’m looking for for MouseMoveXY
|
||
|
||
func MouseMoveNode(n *cdp.Node, opts ...MouseOption) MouseAction { | ||
return ActionFunc(func(ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MouseClickNode
does some check and scrolls the node into view, should we do the same here? If the answer is yes, maybe we should extract those code into a func.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MouseMoveNode function is the similar function to the MouseClickNode, but it doesn’t do the click movement, just put the mouse on the target node.
@rn0l485 A better way to abstract it in Rod: https://github.com/go-rod/rod/blob/d7b838112a1a30304d0c7afd759e1a9608066a93/element.go#L72-L81 page.MustElement("button").MustHover() Hover the mouse over the center of the element. |
Hi,
I just add a function for moving the mouse to the target node.