Reputation: 379
i want to search keyword in Google. i have tried the following code to enter keyword and click the search button through a c# program.
private void WebForm_Load(object sender, EventArgs e)
{
webBrowser1.Height = 1000;
webBrowser1.Width = 1000;
this.Controls.Add(webBrowser1);
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted);
this.webBrowser1.Navigate("www.google.com.au");
}
my documentcompleted method is:
public void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
var webBrowser = sender as WebBrowser;
webBrowser.DocumentCompleted -= WebBrowser_DocumentCompleted;
HtmlElement textElement = webBrowser.Document.All.GetElementsByName("q")[0];
textElement.SetAttribute("value", "mlm company");
HtmlElement btnElement = webBrowser.Document.All.GetElementsByName("btnG")[0];
btnElement.InvokeMember("click");
}
now i can go through different links of the Google search page..... i want to get email, title and url of the websites that are searched and retrieved by the Google through my code. i can also get url of every website. now the problem is, how to search email, title in every website because every website have different structure....
i have tried the following code but was unsuccessful.
HtmlNode mytd3 = mydocument4.DocumentNode.SelectSingleNode(@"//html/body/article/section/section[2]/section[2]/ul/li[1]");
HtmlNode mytd4 = mydocument4.DocumentNode.SelectSingleNode(@"//html/body/article/section/section[2]/div/p[2]");
Upvotes: 0
Views: 616
Reputation: 343
Why don't you instead create a Google Alert and then create a recipe in IFTTT to write the results of the Google search to a file in your Dropbox? Then you can easily parse the contents of the text file in your Dropbox folder.
Here is a sample IFTTT recipe that might be exactly what you need: https://ifttt.com/recipes/66982
Upvotes: 1