如何隐藏打开铬之前出现的硒黑色控制台窗口



我想隐藏在打开chrome和浏览网站之前出现的Selenium黑色控制台窗口 有什么想法吗?

这是我的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenQA.Selenium.Chrome;
using System.Runtime.InteropServices;
namespace DODemo1.UserControls
{
public partial class DashboardUC : UserControl
{
public DashboardUC()
{
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
var options = new ChromeOptions();
var chromeDriver = new ChromeDriver(options);
chromeDriver.Navigate().GoToUrl("http://website.com");
}
}
}

知道吗?

添加

this.driverServiceProcess.StartInfo.CreateNoWindow = true;

到你的代码。

最新更新