OK, i got the solution.

I pattern matched the link text from the message body.

After grabbing the link text, i can use it to navigate.

So all ok now.

Only thing if someone can help is,  i got the email body  but as same
time i want to mark that email as "read" instead of "unread", so that
next time when i have another new email, i get content from that new
email and previous all emails are in read state.

Does anyone knows it?

Bhavesh

On Apr 24, 4:31 pm, Bhavesh <bhavesh1_sha...@yahoo.com> wrote:
> Hi chuck,
>
> You are still not getting me.
>
> Im am using Watir, and an webapplicaiton.
>
> From my application, i can send notification.
>
> Once notification is received in Outlook Inbox, i have to get the
> links in that emails.
>
> I automated using Watir till i can send the notification on an web
> application.
>
> I have written code to get emails also from the Outlook in watir
> script [which i have pasted in last thread].
>
> Now im getting some different result which i dont understand as why
> hash value is returned instead of actual links.
>
> Hence i posted the query in Watir forum.
>
> This thread is now going in some different direction instead of my
> problem.
>
> Since im not using "mail" gem, i cannot post an query to ruby-mail
> forum.
>
> this is simple WATIR script.
>
> Here is the Snapshot of the full script.
>
> ######################
>
> # encoding: utf-8
>
> $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../..') if $0 ==
> __FILE__
>
> require 'Lib/KazeonCommon/BasicMethodLibrary'
> require 'Lib/KazeonCommon/LegalUIMethodLibrary'
> require 'Lib/KazeonCommon/WebAutosetup.rb'
>
> class Mail < Test::Unit::TestCase
>
> def test_0010
>
>      $ie.goto($legalLink)
>           sleep(5)
>       kazeonLegalLogin("LEGALUI",domain="Local",
> loginName="legaladmin")
>       #kazeonLegalLogin("LEGALUI",domain="Local",
> loginName="legaladmin")
>       sleep(10)
>       printTestCaseInfo("LEGALUI0007", "create a case with case id,
> status 'open', value in Description and value in Responsible
> Attorney")
>       #puts "Select and add reviewers in legal"
>         #  $ie.div(:class => "x-grid3-cell-inner x-grid3-col-
> reviewername", :text => "bhavesh").click
>         #  sleep(5)
>         #  $ie.link(:id, "button2").click
>         #  sleep(5)
>           sleep(5)
>           puts "Select Active Case"
>           selectActiveCase("case4")
>           clickOkButton()
>           puts "Select Notify Custodian Button"
>           $_ = $ie.html
>           $ie.button(:class, "x-btn-text sendemail").click
>           sleep(5)
>           puts "Select Add Receipient Button"
>           $ie.button(:class => "x-btn-text addReviewer", :index => 2).click
>           sleep(5)
>           puts "Select Non Ad User Radio Button"
>           $ie.radio(:value, "nonADUser").click
>           sleep(5)
>           puts "Enter Username"
>           $ie.text_field(:id, "lookupFilter").set("bhavesh.sha...@emc.com")
>           sleep(5)
>           puts "Click Go Button"
>           #$ie.link(:id, "getData").click
>           sleep(5)
>           puts "Select User"
>           $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text =>
> "bhavesh.sha...@emc.com").flash
>           sleep(2)
>           $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text =>
> "bhavesh.sha...@emc.com").left_click
>           sleep(5)
>           puts "Select Add selected Button"
>           $ie.button(:value, "Add Selected").click
>           sleep(3)
>           puts "Select Close Button"
>           $ie.button(:value, "Close").click
>           sleep(5)
>           puts "Select Send Notification button"
>           $ie.button(:text, "Send Notifications").click
>           sleep(10)
>           puts "Done"
>
>           outlook = WIN32OLE.new('Outlook.Application')
>           mapi = outlook.GetNameSpace('MAPI')
>           folders = mapi.Folders
>           new_messages = 0
>
>           #Getting email body of unred email
>           inbox = mapi.GetDefaultFolder(6)
>           inbox.Items.each do |message|
>             #puts message.body if message.Unread
>             puts message.Links if message.Unread
>
>           end
> end
>
> end
> ##################
>
> Last line im getting unexpected result, for which i posted the query.
>
> I dont want to put all code in the post, otherwise it is very big .
>
> I hope im clear this time.
>
> bhavesh
>
> On Apr 24, 4:03 pm, Chuck van der Linden <sqa...@gmail.com> wrote:
>
>
>
>
>
>
>
> > There is not a single line of code in what you provided below that is using
> > Watir.
>
> > Watir is Web Application Testing in Ruby, it is for driving web browsers
> > and automating web applications.
>
> > "I have outlook open"   Outlook is a native application, not a web
> > application.  YOU CANNOT DRIVE OUTLOOK WITH WATIR
> > There is 'OWA or Outlook Web Access' but I can tell you are not using it
> > because of this line of ruby code "WIN32OLE.new('Outlook.Application')"
>
> > You need to ask questions of this sort in a more general forum for ruby, or
> > perhaps on stackoverflow with appropriate tags (such as 'ruby' and 'mapi' )
>
> > If you were using watir, and a web application we'd be glad to help you.
> > but you are not using watir, nor are you using a web application, so this
> > is not the place to ask for help with the problems you are having
>
> > I'd suggest doing some Ruby tutorials, or perhaps getting a good book on
> > basic ruby scripting such as 'everyday scripting in ruby'  you can get it
> > as an ebook and be working on it minutes after you buy it.
>
> > On Tuesday, April 24, 2012 3:44:45 PM UTC-7, Bhavesh wrote:
>
> > > Hi Chuck,
>
> > > I don't expect people to write an code for me.
>
> > > I have already posted the code which i am using in my script in my
> > > first Post.
>
> > > Code is :
>
> > >           outlook = WIN32OLE.new('Outlook.Application')
> > >           mapi = outlook.GetNameSpace('MAPI')
> > >           folders = mapi.Folders
> > >           new_messages = 0
>
> > >           #Getting email body/Links of unread email
> > >           inbox = mapi.GetDefaultFolder(6)
> > >           inbox.Items.each do |message|
> > >            #puts message.body if message.Unread
> > >             puts message.Links if message.Unread
>
> > > This is all i am doing.
>
> > > And it is working too....
>
> > > I have Outlook opened and it is retriving first unread emial which i
> > > want.
>
> > > So i have written an code and it is working.
>
> > > Question is, when i try to retrive email body, it works and retrive it
> > > without error.
>
> > > But when i try to retrive links which are in email, it shows Hash
> > > values instead of actual links.
>
> > > Here is the output :
>
> > > #<WIN32OLE:0x171bda8>
> > > .
> > > Finished in 0.812500 seconds.
>
> > > So i have a doubt, im not clear and therefore im putting my question.
> > > i dont expect anybody to write me a code.
>
> > > I clearly written in  my Post that im not using "mail" gem, im doing
> > > normal stuf related with emails.
>
> > > I hope that explains my concerns.
>
> > > thanks
> > > bhavesh
>
> > > On Apr 24, 2:14 pm, Chuck van der Linden <sqa...@gmail.com> wrote:
> > > > Then show us some example HTML and some code that is using watir that
> > > shows
> > > > what you are trying to do.
>
> > > > I have for example zero idea what mail system you are even trying to
> > > > access, you've given us pretty much zero info other than the code you
> > > want
> > > > to replace (which itself has very little info we could infer).
>
> > > > if you are expecting the folks here to write your code for you, that's
> > > not
> > > > going to happen.  we'll provide guidance, advice, and try to get you
> > > > unstuck etc.  but we're not going to port code from some other gem over
> > > to
> > > > use watir starting from nothing.  Nearly all of us have our hands full
> > > > doing our own work, and little time to do someone elses work for free.
>
> > > > If you have not already done so, spend some time in the watir
> > > tutorialhttp://wiki.openqa.org/display/WTR/Tutorialorwith the Watir
> > > Bookhttp://watir.com/book/(which<http://watir.com/book/%28which> tends
> > > to be more current than the wiki
> > > > tutorial) to get you started.
>
> > > > On Tuesday, April 24, 2012 1:49:14 PM UTC-7, Bhavesh wrote:
>
> > > > > Yes, im doing this in watir.
>
> > > > > Instead of using mail gem, im using this method to retrive emails.
>
> > > > > I dont want to install gem "mail".
>
> > > > > I need to know how to get values  instead of these hash values.
>
> > > > > Bhavesh
>
> > > > > On Apr 24, 1:36 pm, Chuck van der Linden <sqa...@gmail.com> wrote:
> > > > > > The mail gem has it's own google group, the link is in the readme
> > >  look
> > > > > > here:  https://github.com/mikel/mail/
>
> > > > > > That would be the better place to ask your question
>
> > > > > > On Tuesday, April 24, 2012 1:32:00 PM UTC-7, Chuck van der Linden
> > > wrote:
>
> > > > > > > I see no watir in your code below, why are you posting this
> > > question
> > > > > > > here?
>
> > > > > > > On Tuesday, April 24, 2012 1:28:08 PM UTC-7, Bhavesh wrote:
>
> > > > > > >> Hi,
>
> > > > > > >> Im trying to access links inside an email.
>
> > > > > > >> Im am not using Gem “mail”.
>
> > > > > > >> Im doing very simple stuff here.
>
> > > > > > >> Just getting unread email from the mailbox and then getting the
> > > links
> > > > > > >> present inside that email.
>
> > > > > > >> When I try to get email bocdy, I get without error.
>
> > > > > > >> But similarly when I try to get links present inside that email,
> > > it
> > > > > > >> shows Hash  value instead of actual links.
>
> > > > > > >> Code is :
>
> > > > > > >>           #Getting email body/Links of unread email
> > > > > > >>           inbox = mapi.GetDefaultFolder(6)
> > > > > > >>           inbox.Items.each do |message|
> > > > > > >>            #puts message.body if message.Unread
> > > > > > >>             puts message.Links if message.Unread
>
> > > > > > >> What I have to change to get the actual links.
>
> > > > > > >> Bhavesh

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to