问题
I want to use CEF to control a Flash Application, so I need to simulate MouseDown and KeySend without JavaScript. I am using offscreen rendering. This is what I tried:
managedCefBrowserAdapter.OnMouseButton(
500, 500, 0, true, 2, CefEventFlags.LeftMouseButton);
or
MouseEvent a = new MouseEvent();
a.Modifiers = CefEventFlags.LeftMouseButton;
a.X = 500;
a.Y = 500;
or
managedCefBrowserAdapter.SendKeyEvent(0, 0, 0);
But nothing works.
回答1:
This code works for me. Clicks once on the position 0, 0 (left-upper corner)
browser.GetBrowser().GetHost().SendMouseClickEvent(0, 0, MouseButtonType.Left, false, 1, CefEventFlags.None);
System.Threading.Thread.Sleep(100);
browser.GetBrowser().GetHost().SendMouseClickEvent(0, 0, MouseButtonType.Left, true, 1, CefEventFlags.None);
来源:https://stackoverflow.com/questions/31135070/cef-simulate-mousedown-and-keysend