[英]Hide geckodriver command window selenium c#
I have a windows form application.我有一个 Windows 窗体应用程序。 Running the project which contains selenium (geckodriver) it is opening a
Command Window
.运行包含 selenium (geckodriver) 的项目,它会打开一个
Command Window
。 How can I hide it?我怎样才能隐藏它?
enter image description here在此处输入图片说明
Below I attached my code:下面我附上了我的代码:
public partial class Form1 : Form
{
IWebDriver driver = new FirefoxDriver();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
driver.Navigate().GoToUrl("https://www.google.com");
}
}
I have adapted the code from here and it worked.我已经修改了这里的代码并且它起作用了。
public partial class Form1 : Form
{
IWebDriver driver;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ar driverService = FirefoxDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
driver = new FirefoxDriver(driverService, new FirefoxOptions());
driver.Navigate().GoToUrl("https://www.google.com");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.