相关疑难解决方法(0)

如何在C#中使用Selenium?

.

我下载了C#客户端驱动程序和IDE.我设法记录了一些测试并成功地从IDE运行它们.但现在我想用C#做到这一点.我将所有相关的DLL(Firefox)添加到项目中,但我没有这个Selenium类.一些你好世界会很好.

c# firefox selenium automated-tests webdriver

17
推荐指数
2
解决办法
5万
查看次数

我如何启动进程并隐藏它的窗口?

我试过这个:

ProcessStartInfo psi = new ProcessStartInfo("https://stackoverflow.com/");
            psi.RedirectStandardOutput = false;
            psi.WindowStyle = ProcessWindowStyle.Hidden;
            psi.UseShellExecute = false;

            Process.Start(psi);
Run Code Online (Sandbox Code Playgroud)

但我在 Process.Start(psi); 线上遇到异常

Win32Exception 系统找不到指定的文件

如果我更改行 psi.UseShellExecute = true; 然后它就可以工作,但它不会隐藏窗口。

我希望当它打开浏览器时,例如https://stackoverflow.com/,用户将不会随时看到该窗口,但该窗口仍会打开。不是关闭而是隐藏。

尝试谷歌但没有找到有效的解决方案。

Win32Exception 消息:

System.ComponentModel.Win32Exception was unhandled
  HResult=-2147467259
  Message=The system cannot find the file specified
  Source=System
  ErrorCode=-2147467259
  NativeErrorCode=2
  StackTrace:
       at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
       at System.Diagnostics.Process.Start()
       at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
       at CuteDadyImages.Form1.OpenBroswerTab() in d:\C-Sharp\test\Form1.cs:line 155
       at CuteDadyImages.Form1..ctor() in d:\C-Sharp\test\Form1.cs:line 55
       at CuteDadyImages.Program.Main() in d:\C-Sharp\test\Program.cs:line 35
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, …
Run Code Online (Sandbox Code Playgroud)

.net c# winforms

5
推荐指数
1
解决办法
7073
查看次数

标签 统计

c# ×2

.net ×1

automated-tests ×1

firefox ×1

selenium ×1

webdriver ×1

winforms ×1