JavaScript code only works when executed in the developer console
<p>I'm trying to programmatically click a file input button on a website inside of a <em>ChromiumWebBrowser</em>.</p>

<p>However, when the JavaScript code gets executed with <em>ExecuteScriptAsync</em>, nothing happens.</p>

<p>But... when I execute the same line of code in the ChromiumWebBrowser's developer console, the file input button gets clicked and the choose file dialog appears.</p>

<pre><code>using CefSharp;
using CefSharp.WinForms;
using System;
using System.Windows.Forms;

namespace Uploader
{
    public partial class UploaderForm : Form
    {
        private readonly ChromiumWebBrowser webBrowser = new ChromiumWebBrowser("http://tinyupload.com/");

        public ImageIdentificationForm()
        {
            InitializeComponent();
            webBrowser.FrameLoadEnd += WebBrowser_FrameLoadEnd;
            Controls.Add(webBrowser);
        }

        private void WebBrowser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
        {
            if (e.Url == webBrowser.Address)
            {
                if (webBrowser.Address == "http://tinyupload.com/")
                {
                    webBrowser.ExecuteScriptAsync("document.querySelector('[name=uploaded_file]').click();");
                    Console.WriteLine("Executed script!");
                }
            }
        }
    }
}
</code></pre>

<p>How can I programmatically click the file input button using <em>ExecuteScriptAsync</em>?</p>

<p>By the way, "Executed script!" gets written in the console. (So... the code <strong>IS</strong> being executed.)</p>