C#: Click an email in Hotmail using the Web browser?

kytro360

Power Member
Joined
Jan 12, 2010
Messages
708
Reaction score
737
Hello everyone. I need a little help with a bit of code cause Hotmail is acting weird. What I am trying to do is make my bot click an email inside of Hotmail.

The code I have should work but it isnt clicking on anything so I wanted to ask here if anyone can help me out to make it work :).

Ive only included the portion to click on the email. If you can provide any help, I would be truly grateful:

Code:
 if (webBrowser1.Url.AbsoluteUri.Contains("mail/InboxLight.aspx"))
 {                           

HtmlElementCollection allelements = webBrowser1.Document.GetElementsByTagName("a"); 

foreach (HtmlElement element in allelements) 

{

 if (element.GetAttribute("value").Contains("Hotmail getting started tip #1: Add contacts"))                             {                                  element.InvokeMember("click");                             } 

}
 
WatIn is so easy for this type of thing, Use it you might be able to attach it to your webbrowser control instance to save any code refactoring.

Syntax would be somethin like this

ie.Document.Links.Filter(Find.ByText("Hotmail getting started blahblah")).First.Click();

Beautiful syntax
 
To click on link in WebBrowser, in Delphi I use this :
Code:
http://www.delphipages.com/forum/showthread.php?t=118008

Maybe it can help you...

Beny
 
I use this for email related projects:

Code:
http://sourceforge.net/projects/hpop/
 
I use this for email related projects:

Code:
http://sourceforge.net/projects/hpop/
 
To click on link in WebBrowser, in Delphi I use this :
Code:
http://www.delphipages.com/forum/showthread.php?t=118008

Maybe it can help you...

Beny

Of course it can help him, if he would program in delphi, but he uses C# for fucks sake...

I think the reason your code is not working is that hotmail uses Ajax.
My advice is you forget the Webbrowser, its shit anyways and use something good like Selenium or WatIn.
 
Back
Top