title: How do I implement mouse click in Awesomium?
body: <p>I wrote this code to test the Inject mouse method but it is not working for me. The test is supposed to click in the google text box search area, but the box never gets highlighted. Any idea why? </p>
  
  <p>Google's page does load. The code runs (confirmed through break points), but nothing happens.</p>
  
  <pre><code>public partial class Form1 : Form
      {
          private IWebView webView;
          public Form1()
          {
              InitializeComponent();
              initiate();
  
          }
  
          private void button1_Click(object sender, EventArgs e)
           {
              click(650, 405);
          }
  
          private async void initiate()
          {
  
              WebSession session = WebCore.CreateWebSession(
  @"C:\SessionDataPath", WebPreferences.Default);
              webView = WebCore.CreateWebView(
        this.ClientSize.Width,
        this.ClientSize.Height, session, WebViewType.Window
       );
              webView.ParentWindow = this.Handle;
              webView.Source = new Uri("http://www.google.com");
              await Task.Delay(30000);
              click(650, 405);
  
          }
  
          public void click(int x, int y)
          {
              webView.InjectMouseMove(x, y);
              webView.InjectMouseDown(MouseButton.Left);
              webView.InjectMouseUp(MouseButton.Left);
          }
      }
  </code></pre>
  
  <p>I tried to get this code to work with chromium handle by looking at the proper chromium class but it didn't work</p>
  
  <pre><code>  private async Task&lt;bool&gt; clickCoorindate(Point point)
          {
              webView.FocusView();
              int x = point.X; // X coordinate of the click
              int y = point.Y; // Y coordinate of the click
              IntPtr handle = webView.ProcessHandle;
              StringBuilder className = new StringBuilder(100);
              while (className.ToString() != "Chrome_RenderWidgetHostHWND") // The class control for the browser
              {
                  handle = GetWindow(handle, 5); // Get a handle to the child window
                  GetClassName(handle, className, className.Capacity);
                  if (className.ToString() == "Chrome_RenderWidgetHostHWND")
                      handle = Handle;
  
              }
  
              IntPtr lParam = (IntPtr)((y &lt;&lt; 16) | x); // The coordinates
              IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl)
              const uint downCode = 0x201; // Left click down code
              const uint upCode = 0x202; // Left click up code
              const uint moveCode = 0x200;
  
              SendMessage(handle, downCode, wParam, lParam); // Mouse button down
              SendMessage(handle, upCode, wParam, lParam); // Mouse button up
              Thread.Sleep(20);
              SendMessage(handle, downCode, wParam, lParam); // Mouse button down
              SendMessage(handle, upCode, wParam, lParam); // Mouse button up
  
              return true;
  
          }
  </code></pre>