title: CefSharp webpage element click
body: <p>I'm trying to do simple click on some page element(like a btn or link).</p>
  
  <p>I have wrote 2 functions for clicking via xpath and via CSS selectors.</p>
  
  <p>Both of those functions perfectly works in browser's developer console, but partially does'nt work in CEF. </p>
  
  <ul>
  <li>code perfectly click's in simple links from Developer Console and from Cef</li>
  <li>code perfectly click's on exact button from Developer Console but doesn't do click from CEF. It's just ignore it for some reason...</li>
  </ul>
  
  <p>How can this be? Js code is absolutely the same!...</p>
  
  <pre><code>    public void Click(string xpath)
      {
          var js = "document.evaluate(\"" + xpath + "\", document, null, XPathResult.ANY_TYPE, null).iterateNext().click();";
  
          EvaluateJavascript(js);
      }
  
      public void ClickCss(string css)
      {
          var js = "document.querySelector('"+ css + "').click()";
  
          EvaluateJavascript(js);
      }
  
  
      public async Task EvaluateJavascript(string script)
      {
          JavascriptResponse javascriptResponse = await Browser.GetMainFrame().EvaluateScriptAsync(script);
  
          if (!javascriptResponse.Success)
          {
              throw new JavascriptException(javascriptResponse.Message);
          }
      }
  </code></pre>
  
  <p>details:
  <a href="https://i.stack.imgur.com/EH8aW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EH8aW.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/rcTSb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rcTSb.png" alt="enter image description here"></a></p>
  
  <p>used click code:</p>
  
  <pre><code>_browser.ClickCss("#upload-container a");
  </code></pre>
  
  <p>one more time: same js code perfectly works in browser dev console, but doesn't work in CEF for some reason.</p>
  
  <p>By the way, I have tested JS code in Chrome. So WebEngine is the same in both situations.</p>
  
  <p>PS: Also will work for me simulation of drag-and-drop of some specific file to some specific web-element. But I didn't found any information about this not for Cef, not for Js, not for JQuery... =(</p>