4

問題があり、解決策がまったく見つかりません。私の仕事は、Google Chrome Inspect Element から提供されたテキストにアクセスすることです。たとえば、「http://stackoverflow.com」という Web ページが与えられた場合、要素の検査 (右クリック -> 要素の検査) にあるテキストを取得する必要があります。.NETでこれを行う方法を知っている人はいますか?

PS 別の解決策がありますが、このタスクの効果を最大限に高めたいと考えています。私の現在の解決策は、.NET を作成してプログラムで Google Chrome を開き、キーボード ショートカットを使用して Inspect Element テキストにアクセスすることです。しかし、私はこれをバックグラウンドで実行したいと考えています (プログラムは、私が他のことをしている間にすべてを実行します)。

4

1 に答える 1

0

ページのソースをダウンロードしますか? それは基本的に要素を検査することだからです。私が間違っているかどうか教えてください。

string remoteUri = "http://www.contoso.com/library/homepage/images/";
            string fileName = "ms-banner.gif", myStringWebResource = null;
            // Create a new WebClient instance.
            WebClient myWebClient = new WebClient();
            // Concatenate the domain with the Web resource filename.
            myStringWebResource = remoteUri + fileName;
            Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
            // Download the Web resource and save it into the current filesystem folder.
            myWebClient.DownloadFile(myStringWebResource,fileName);     
            Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
            Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);

私のコードではありませ

次に、任意の関数を使用してファイルを読み取り、ソースを使用できます。

于 2013-01-23T17:50:56.817 に答える