Skip to content

After simulating touch, all mouse events are abnormal #1188

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

Open
pony5551 opened this issue May 6, 2025 · 1 comment
Open

After simulating touch, all mouse events are abnormal #1188

pony5551 opened this issue May 6, 2025 · 1 comment
Labels
question Questions related to rod

Comments

@pony5551
Copy link

pony5551 commented May 6, 2025

Rod Version: v0.116.2

system windows 11

Just use the following code:
_ = proto.EmulationSetEmitTouchEventsForMouse{
Enabled: true,
Configuration: proto.EmulationSetEmitTouchEventsForMouseConfigurationMobile,
}.Call(page)

All mouse events below will be invalid and will be blocked

	proto.InputDispatchMouseEvent{
		Type:       proto.InputDispatchMouseEventTypeMouseMoved,
		X:          startX,
		Y:          startY,
		ClickCount: 0,
	}.Call(page)


		// 2. 按下鼠标左键(核心代码)
		err = proto.InputDispatchMouseEvent{
			Type:       proto.InputDispatchMouseEventTypeMousePressed, // 事件类型
			Button:     proto.InputMouseButtonLeft,                    // 左键
			X:          startX,                                        // 坐标X
			Y:          startY,                                        // 坐标Y
			ClickCount: 1,                                             // 点击次数
		}.Call(page)
		if err != nil {
			panic(err)
		}

page.Mouse.MustDown(proto.InputMouseButtonLeft)

		err = page.Mouse.Down(proto.InputMouseButtonLeft, 1)
		if err != nil {
			log.Errorln(err)
		}

page.Mouse.MustMoveTo(curentX, curentY) //移动轨迹

@pony5551 pony5551 added the question Questions related to rod label May 6, 2025
Copy link

github-actions bot commented May 6, 2025

Please fix the format of your markdown:

3:18 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]

generated by check-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

1 participant