CefSharp webpage element click

久未见 提交于 2019-11-29 15:51:18

The problem was in security limitations of JS code.

Solution of the problem is:

  1. Get coordinates of a button/link with JS code
  2. Simulate click action on it with CEF:

    public void MouseClick(int x, int y)
    {
        Browser.GetBrowser().GetHost().SendMouseClickEvent(x, y, MouseButtonType.Left, false, 1, CefEventFlags.None);
        Thread.Sleep(15);
        Browser.GetBrowser().GetHost().SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None);
    }
    
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!