How to extract specific part of html page using c# code -


I have a webpage that I want to remove a specific part of the page but not the full page, for example, 4 inches From the left side, just above 4 inches, above the website page. Please guide me how to get it. Here's my code.

  public string GetWebSiteContents (string url) {WebRequest req = WebRequest.Create (url); // Get Stream from the Web's response back to StreamReader sr = New StreamReader (req.GetResponse (). GetResponseStream ()); System.Text.StringBuilder sb = New System Text.StringBuilder (); String stroke; // Read the line one line at a time and keep each one in stringbuilder while ((strLine = sr.ReadLine ()) = = null {// Ignore empty rows if (strLine.Length> gt; 0) sb .Append (strLine); } Sr.Close (); Textbox1.Text = sb.ToString (); Return sb.ToString (); }  

This code works fine, but removes the full page and takes a long time in it.

An easy way to get what you are trying to do is to use a tool like selenium To automate an actual browser to use and then using HTML tags, you can save any information, for example the left-hand side of the page or table. See for a tutorial on Selenium.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -