title: Is it Possible: Selenium from Web App passing scripts at runtime
body: <p>I am able to make this work locally, but when I publish to Azure App Service or to IIS running on Azure VM, it fails.  This is what I'm doing.</p>
  <p>I have a web application where the user can create script with selenium commands.  For example, the user will write this an save as a text file:</p>
  <pre class="lang-js prettyprint-override"><code>script.OpenBrowser(&quot;Chrome&quot;);
  </code></pre>
  <p>Then save it in a file on the web server.  The user can then navigate to that file and press a run button.  That will wrap the script with the following:</p>
  <pre class="lang-csharp prettyprint-override"><code>using System; 
  using System.IO; 
  using TeamStorm.Web.Services; 
  namespace InMemoryApp
  { 
    class Program    
    {
      static void Main(string[] args) 
      { 
        TestServices script = new TestServices();  &quot; + fileContent + &quot;
      }
    }
  }
  </code></pre>
  <p>where fileContent is the script previously mentioned.  That is passed to a class I call TestRunner that will compile that code at runtime and run the script.  I'm capturing info about the run to determine if the test pass or failed and storing that in a dB for reporting results.</p>
  <p>I am doing all of this in Visual Studio 2019 on my local dev machine.</p>
  <p>Now when I publish this application.  Everything works, but the actual running of the test.  I am getting the following errors:</p>
  <p>Exception has been thrown by the target of an invocation.  made changes then starting getting:</p>
  <blockquote>
  <p>error CS0009: Metadata file 'D:\xxxx\xxx\xxx\xxx\xxxx\wwwroot\dependencies\chromedriver.exe' could not be opened -- PE image doesn't contain managed metadata.(1,163): error CS7036: There is no argument given that corresponds to the required formal parameter 'env' of 'TestServices.TestServices(IWebHostEnvironment)'</p>
  </blockquote>
  <p>started passing the IWebHostEnvironment to the method and showing the inner exception and then started getting:</p>
  <blockquote>
  <p>The HTTP request to the remote WebDriver server for URL http://localhost:53204/session timed out after 60 seconds.</p>
  </blockquote>
  <p>I have published to Azure App Service and to a VM running IIS. The later thinking was it runs on my local machine from VS2019. So, try to run on a VM that everyone can get via the web.</p>
  <p>Nothing is working past this point.
  In short I am trying to run Selenium scripts from a web app where the scripts are created and ran at runtime.</p>
  <p>Is what I'm doing even possible to do?  I have search high and low and can find no answers as to how to do this or how to get pass the errors. Is this possible?</p>