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
    $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 <[email protected]> wrote:

> Try treating it as a div rather than a button?
>
> ------------------------------
> *From:* praveen kumar <[email protected]>
> *To:* [email protected]
> *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: [email protected]
> To unsubscribe: 
> [email protected]<watir-general%[email protected]>
>
>  --
> 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: [email protected]
> To unsubscribe: 
> [email protected]<watir-general%[email protected]>
>

-- 
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: [email protected]
To unsubscribe: [email protected]

Reply via email to