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 <praveen454gr...@gmail.com> 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 <jazzezr...@gmail.com> > 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 > <praveen454gr...@gmail.com>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<http > s://mail.google.com/mail/?logout&hl=en%27%29.click> > > >> $ie.close > > >> #rows=rows+1 > > >> end > > >> end > > > > >> I have also tried with the attribute id, but that is also not > working. > > > > >> Please help me and let me know if require any details. > > > > >> Praveen > > > > >> On Thu, Jul 22, 2010 at 10:23 PM, John Fitisoff > <jfitis...@yahoo.com>wrote: > > > > >>> Try treating it as a div rather than a button? > > > > >>> ------------------------------ > > >>> *From:* praveen kumar <praveen454gr...@gmail.com> > > >>> *To:* watir-general@googlegroups.com > > >>> *Sent:* Thu, July 22, 2010 5:42:59 AM > > >>> *Subject:* [wtr-general] facing issue with clicking buttons > > > > >>> Hi All, > > > > >>> I am trying to automate the gmail by clicking on the compose mail > and > > >>> entering to address , subject and body content. I am facing > problem in > > >>> clicking the "Send" button. The button has following HTML > elements > > > > >>> *<div tabindex="1" class="J-Zh-I J-J5-Ji Bq L3" id=":15m" > role="button" > > >>> style="-moz-user-select: none;"><b>Send</b></div> > > >>> * > > >>> I have tried with following script > > > > >>> *canvas_frame.button(:text, 'Send').click * > > > > >>> canvas_frame is the variable in which the frame is stored. > > > > >>> I am confusing because there is no type attribute. It has role > attribute > > >>> i.e role=button. > > > > >>> Please help me in going forward... > > > > >>> Thanks, > > >>> Praveen > > -- 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