Programmatically launch a .NET Core web application to test Selenium

I am currently trying to configure some user interface tests for the main web application, however I cannot start the web application. Using the command line directly with "dotnet run" from the web application directory works. The problem occurs when I try to use Process to start it before running my tests, nothing happens.

    var process = new Process
    {
        StartInfo =
        {
            FileName = "dotnet",
            Arguments = "run",
            WorkingDirectory = applicationPath
        }
    };
    process.Start();

Has anyone encountered a similar problem before and / or was able to solve it? Maybe I'm abusing it Process.

+4
source share
2 answers

UseShellExecute StartInfo false :

var process = new Process
{
    StartInfo =
    {
        FileName = "dotnet",
        Arguments = "run",
        UseShellExecute = false,
        WorkingDirectory = applicationPath
    }
};
process.Start();

UseShellExecute true, cmd dotnet run dotnet run, .

+3

 ProcessStartInfo Startinfo = new ProcessStartInfo();
 Startinfo.FileName = "D:\\TFS\\QA\\SH_LoadTest\\SH_LoadTest\\bin\\Debug\\SH_LoadTest.exe";
 StartInfo.Arguments="Your Arguements";
                Process pro = Process.Start(Startinfo);
0

Source: https://habr.com/ru/post/1677761/