C# 如何在同一个“打开”选项卡上打开新url?
我使用此代码是为了打开特定URL的所有链接,每个链接都将使用新选项卡打开,这将导致巨大的内存使用,如何在现有选项卡上打开新链接C# 如何在同一个“打开”选项卡上打开新url?,c#,web-crawler,C#,Web Crawler,我使用此代码是为了打开特定URL的所有链接,每个链接都将使用新选项卡打开,这将导致巨大的内存使用,如何在现有选项卡上打开新链接 static void Main(string[] args) { ProcessStartInfo processStartInfo = null; string googleChoromePath = "C:\\Users\\Dandin\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe
static void Main(string[] args)
{
ProcessStartInfo processStartInfo = null;
string googleChoromePath = "C:\\Users\\Dandin\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe";
string argument = "";
string url = "http://edition.cnn.com/";
WebClient wClient = new WebClient();
string st = wClient.DownloadString(url);
List<string> list = LinkFinder.Find(st);
processStartInfo = new ProcessStartInfo(googleChoromePath);
for (int i = 0; i < list.Count; i++)
{
argument = list[i];
try
{
if (argument.StartsWith("http://"))
{
processStartInfo.Arguments = argument;
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.RedirectStandardError = true;
processStartInfo.CreateNoWindow = true;
processStartInfo.UseShellExecute = false;
processStartInfo.ErrorDialog = false;
Process googleChrome = Process.Start(processStartInfo);
Thread.Sleep(1000);
}
}
catch (Exception)
{
}
}
}
static void Main(字符串[]args)
{
ProcessStartInfo ProcessStartInfo=null;
string googleChoromePath=“C:\\Users\\Dandin\\AppData\\Local\\Google\\Chrome\\Application\\Chrome.exe”;
字符串参数=”;
字符串url=”http://edition.cnn.com/";
WebClient wClient=新的WebClient();
string st=wClient.DownloadString(url);
List=LinkFinder.Find(st);
processStartInfo=新的processStartInfo(Google ChromePath);
for(int i=0;i
您能解释一下为什么要在浏览器中打开这么多URL吗?打开某个URL然后立即打开另一个URL有什么意义呢?我想构建一个网络爬虫,继续写这篇文章:睡眠时间不足只是为了测试,这仍然没有任何意义。网络爬虫将下载并处理这些页面,而不是在浏览器中打开它们。为什么要在浏览器中打开页面?但是,为什么?您正在对您的网站进行负载测试吗?