Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在同一个“打开”选项卡上打开新url?_C#_Web Crawler - Fatal编程技术网

C# 如何在同一个“打开”选项卡上打开新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

我使用此代码是为了打开特定URL的所有链接,每个链接都将使用新选项卡打开,这将导致巨大的内存使用,如何在现有选项卡上打开新链接

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有什么意义呢?我想构建一个网络爬虫,继续写这篇文章:睡眠时间不足只是为了测试,这仍然没有任何意义。网络爬虫将下载并处理这些页面,而不是在浏览器中打开它们。为什么要在浏览器中打开页面?但是,为什么?您正在对您的网站进行负载测试吗?