tags:

views:

87

answers:

1

I've been working with sending and receiving email through various web-mail clients using WatiN, I've got logging in, writing and sending emails working perfectly, however I am having issues opening specific emails.

Each email I send has a specific id codein the subject, but I can't work out how to tell WatiN to actually click the specific email. I would of thought it would be something like:

ie.Link(Find.ByText("UN1QU3_1D")).Click();

But due to how Gmail and Live set up their display this doesn't seem to work...

Also, a slightly simpler question, is there a way of preventing WatiN closing the browser once it has finished with it?

Does anyone have any bright ideas?

Many thanks.

+1  A: 

Since all gmail message titles are actually in spans not links, I think this will work:

ie.Span(Find.ByText("UN1QU3_1D")).Click();

Also, as far as I remember, WatiN won't close a browser unless you specifically closed them, like:

ie.Close();

UPDATE:

Finally it worked for me :D Span ieFramesSpan = ie.Frames[3].Span( delegate(Span s) { return s.InnerHtml==null? false: s.InnerHtml.Contains("UN1QU3_1D"); }); ieFramesSpan.MouseDown();

Shady M. Najib
You still might want to check you browser AutoClose property ie.AutoClose
Shady M. Najib
Hi Shady,Many thanks for the prompt, I receive the error "...Could not find SPAN element tag matching criteria: Attribute 'inntertext' matches '^ *UN1QU3_1D *$'..." Any other thoughts?
James Doc
Finally it worked for me :DSpan ieFramesSpan = ie.Frames[3].Span( delegate(Span s) { return s.InnerHtml==null? false: s.InnerHtml.Contains("UN1QU3_1D"); });ieFramesSpan.MouseDown();
Shady M. Najib
You are a hero Shady. Many thanks!
James Doc
Quick addition Shady; Not sure if you have used the screen shot function or not, however if you screen shot it should save the whole page, however within Gmail it only grabs what is visible in the window rather than scrolling to view the whole page. Any thoughts?
James Doc
Shady M. Najib
Fair enough. Thanks for the help!
James Doc