This can be done in many ways, this is one of them
Create a windows application and add
webbrowser[
^] control to it.
Load the url and query the element from the DOM to read the text and
write it into a text file[
^]
Simple example: it will save your name to the text file, by passing this question url to it.
using System;
using System.IO;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string url = "http://www.codeproject.com/Questions/1121032/Find-custom-textin-pagesource";
WebBrowser web = new WebBrowser();
web.Url = new Uri(url);
web.DocumentCompleted += web_DocumentCompleted;
}
void web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser web = (sender as WebBrowser);
string name = web.Document.GetElementById("ctl00_ctl00_MC_AMC_QuestionAuthorRepInfo_MemberName").InnerText;
MessageBox.Show(name);
string path = @"D\yourFile.txt";
if (!File.Exists(path))
using (StreamWriter sw = File.CreateText(path))
sw.WriteLine(name);
}
}
}