Re: [wtr-general] Re: facing issue with clicking buttons

2010-07-28 Thread Željko Filipin
On Wed, Jul 28, 2010 at 4:25 AM, Jason Trebilcock <
jason.trebilc...@gmail.com> wrote:
> Or, someone might take the lazy way out and use the ruby-gmail gem.

And there is also mail gem that I use all the time for sending and receiving
mail:

http://github.com/mikel/mail/

Željko

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

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


RE: [wtr-general] Re: facing issue with clicking buttons

2010-07-27 Thread Jason Trebilcock
Or, someone might take the lazy way out and use the ruby-gmail gem. But
that's just me. Automating email handling through some sort of client (web,
Outlook, etc.) is just plain dumb. I sometimes use something similar in Perl
if/when I need to generate/send email.

When all you have is a hammer, everything pretty much looks like a nail.
Sometimes you have to think outside the box to solve your problems.

(Note: This is not directly in response to Chuck...rather, in response to
the insanity that is test automation.)

> -Original Message-
> From: watir-general@googlegroups.com [mailto:watir-
> gene...@googlegroups.com] On Behalf Of Chuck van der Linden
> Sent: Tuesday, July 27, 2010 5:59 PM
> To: Watir General
> Subject: [wtr-general] Re: facing issue with clicking buttons
> 
> Frankly I'd find some other thing to try and automate.
> 
> GMAIL intentionally makes their UI difficult to automate.  ID's are
> uniquely regenerated each time you instantiate the compose mail page
> (and different each time)  Classes look fairly randomized and I'd
> place no bets on Gmail not updating them on some rotating basis.
> That div with 'send' in it, consists of about 5 nested divs, and I've
> no idea which of them is 'wired' to respond to the click.  Even if we
> figured out the right class etc to make it work, who's to say it would
> stay working an hour or a day from now.
> 
> (consider for a moment all the 'evil' that could be caused by people
> abusing an easily scriptable gmail interface and you'll understand why
> there's no incentive on google's part to make any of this easy for
> anyone., and in fact quite a bit of incentive to make it very
> difficult)
> 
> If it's possible at all, it's likely going to take something like
> Xpath to do it, or practically reverse engineering the DOM on the fly
> 
> On Jul 27, 6:43 am, praveen kumar  wrote:
> > Hi Raveendran,
> >
> > Thanks for the reply...
> >
> > I tried with the all the possibilities you provided.None of them are
> > working. Getting error as "Unable to locate element".
> >
> > Please let me know if any other options.
> >
> > Thanks,
> > Praveen
> >
> >
> >
> > On Tue, Jul 27, 2010 at 11:09 AM, Raveendran P 
> wrote:
> > > Hi Praveen,
> >
> > >  Have you tried these possibilities ?
> >
> > > *canvas_frame.div(:class, 'J-Zh-I J-J5-Ji Bq L3').flash*
> > > *
> > > canvas_frame.div(:id, ':
> > > 15m
> > > ').flash
> > >  canvas_frame.div(:id, ':
> > > 15m
> > > ').flash
> >
> > > *
> >
> > > On Fri, Jul 23, 2010 at 1:32 PM, praveen kumar
> wrote:
> >
> > >> Hi John,
> >
> > >> I have tried with div, but unable to click on button. Following is
> the
> > >> code:
> >
> > >> require 'watir'
> > >> require 'test/unit'
> > >> require 'win32ole'
> > >> class TC_article_example < Test::Unit::TestCase
> >
> > >>   def test_data
> > >>     $ie = Watir::IE.new
> > >>     $ie.goto("http://mail.google.com/mail/?ui=html";)
> > >>     #Define the excel file
> > >>     excel= WIN32OLE::new("excel.Application")
> > >>     wrkbook=excel.Workbooks.Open("C:\\test.xls")
> > >>     wrksheet = wrkbook.worksheets(1)
> > >>     wrksheet.select
> >
> > >>     #read the data from excel file
> > >>     rows = 2
> > >>     $username=wrksheet.cells(rows,"A") ['text']
> > >>     #puts $field
> > >>     $password=wrksheet.cells(rows,"B") ['text']
> > >>     $ie.text_field(:name,"Email").set($username)
> > >>     $ie.text_field(:id,"Passwd").set($password)
> > >>     $ie.button(:id, 'signIn' ).click
> > >>     #browser.show_frames
> > >>     # We need the iframe with ID 'canvas_frame'.  Store it in a
> var.
> > >>     #$ie.goto("http://mail.google.com/mail/?ui=html";)
> > >>     canvas_frame = $ie.frame(:id, 'canvas_frame')
> > >>     # Get the current user's email address.  We'll be sending
> email to it.
> > >>     my_address = $username
> > >>     mail_subject = 'Hello Watir world!'
> > >>     mail_body_text = 'Hi.'
> > >>     canvas_frame.span(:text, 'Compose Mail').click # Compose new
> mail
> > >>     canvas_frame.text_field(:name, 'to').set(my_address)
> > >>     canvas_frame.text_field(:name, 'subject').set(mail_subject)
> > >>     mail_body_frame = canvas_frame.frame(:index, 1)
> > >>     mail_body_frame.document.body.setproperty('innerText',
> mail_body_text)
> > >>     #$ie.goto("http://mail.google.com/mail/?ui=html";)
> > >>   *  canvas_frame.div(:text, 'Send').click    # Send the message I
> am
> > >> facing problem here to click on Send button. It has no attributes
> like type,
> > >> value*
> > >>     #    canvas_frame.link(:text, 'Sent Mail').click # Browse to
> sent mail
> > >> page
> > >>     #    assert(canvas_frame.contains_text('Hello Watir world!'))
> > >>     #    canvas_frame.link(:text, 'Inbox').click     # Return to
> the inbox
> > >> page
> > >>
> $ie.link(:href,'https://mail.google.com/mail/?logout&hl=en').click s://mail.google.com/mail/?logout&hl=en%27%29.click>
> > >>     $ie.close
> > >>     #rows=rows+1
> > >>   end
> > >> end
> >
> > >> I have also tried with