以编程方式启动用于Selenium测试的.NET Core Web应用程序
我目前正在尝试在Core Web应用程序上设置一些UI测试,但是我无法启动Web应用程序。 从Web应用程序目录直接使用命令行“dotnet run”工作。 当我在执行测试之前尝试使用Process来运行它时,问题就出现了。
var process = new Process { StartInfo = { FileName = "dotnet", Arguments = "run", WorkingDirectory = applicationPath } }; process.Start();
有没有人在遇到类似的问题之前和/或设法解决它? 我可能会误用Process
。
UseShellExecute
将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
,这是我需要的。
试试这个
上述就是C#学习教程:以编程方式启动用于Selenium测试的.NET Core Web应用程序分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
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);
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/961622.html