HI Robert,

Have you tried locating the element within irb?

Using the elements below...

input type="image"
name="ctl00$ctl00$ContentPlaceHolder$ContentPlaceHolder
$LoginImageButton"
id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginImageButton"
src="App_Shared/Pix/en_US/Button-Login.gif"

in irb, navigate to the login page and then use the "flash" command to
see what responds (if anything).

ex:
ie.img(:name, /LoginImageButton/).flash

Hopefully that helps a little!

On Jan 17, 10:00 am, "[email protected]"
<[email protected]> wrote:
> Hello,
> I am doing some QA automation with Ruby and Watir.  My problem is that
> I can't get the login button (actually an image) to click.
>
> Following is the Ruby code that I'm using:
>
> ### Step 1: Go to login page
> if test_status == "pass"
>   puts "Still running"
>   ie.link(:text, "Login").click
> else
>   out.puts "Not running"
> end
>
> ### Enter Login name and password
> ie.text_field(:id,
> 'ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginIDTextBox').set
> ('melogin)
> ie.text_field(:id,
> 'ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_PasswordTextBox').set
> ('mepasswrd:')
>
> ## The above code works fine.
>
> ### None of these work
> ie.image(:id,/
> ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginImageButton/).fire_event
> ('onclick')
> #ie.link(:after?, ie.image(:id,
> 'ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginImageButton')).click
> #ie.image(:src,'App_Shared/Pix/en_US/Button-Login.gif').click
> #ie.image(:id,
> 'ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginImageButton').fire_event
> ('onclick')
> #ie.image(:src,/Button-Login.gif/).click
>
> Following is the client rendered aspx code
>
>                                 <table class="EDC-form-table">
>                                         <tr>
>                                                 <td class="label">
>                                                         <label
> for="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginIDTextBox"
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginIDLabel">
>                                                                 <strong>Login 
> ID:</strong>
>                                                                 <span
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginIDRequiredFieldValidator"
> style="color:Red;display:none;">*</span></label>
>                                                 </td>
>                                                 <td class="field"><input 
> name="ctl00$ctl00$ContentPlaceHolder
> $ContentPlaceHolder$LoginIDTextBox" type="text" maxlength="50"
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginIDTextBox"
> class="textfield" /></td>
>                                         </tr>
>                                         <tr>
>                                                 <td class="label">
>                                                         <label
> for="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_PasswordTextBox"
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_PasswordLabel">
>                                                                 
> <strong>Password:</strong>
>                                                                 <span
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_PasswordRequiredFieldValidator"
> style="color:Red;display:none;">*</span></label>
>                                                 </td>
>                                                 <td class="field"><input 
> name="ctl00$ctl00$ContentPlaceHolder
> $ContentPlaceHolder$PasswordTextBox" type="password" maxlength="20"
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_PasswordTextBox"
> class="textfield" /></td>
>                                         </tr>
>                                         <tr>
>                                                 <td class="label">&nbsp;</td>
>                                                 <td class="field"><span 
> class="checkbox"><input
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RememberMyLoginCheckBox"
> type="checkbox" name="ctl00$ctl00$ContentPlaceHolder$ContentPlaceHolder
> $RememberMyLoginCheckBox" /><label
> for="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RememberMyLoginCheckBox"> Remember
> my login</label></span></td>
>                                         </tr>
>                                         <tr>
>                                                 <td class="label">&nbsp;</td>
>                                                 <td class="submit"><input 
> type="image"
> name="ctl00$ctl00$ContentPlaceHolder$ContentPlaceHolder
> $LoginImageButton"
> id="ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_LoginImageButton"
> title="Login" src="App_Shared/Pix/en_US/Button-Login.gif" alt="Login"
> onclick="javascript:WebForm_DoPostBackWithOptions(new
> WebForm_PostBackOptions(&quot;ctl00$ctl00$ContentPlaceHolder
> $ContentPlaceHolder$LoginImageButton&quot;, &quot;&quot;, true,
> &quot;&quot;, &quot;&quot;, false, false))" style="border-width:0px;" /></td>
>
>                                         </tr>
>                                 </table>
>
> Following is the output when I run the script.  I get a similar error
> with all the other examples "clicks" that I've tried.
>
> Test case execution started
>  Step 1: go to the test site:
> Page launched
> Text checked: pass
> Still running
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
> `assert_ex
> ists': Unable to locate element, using :id, /
> ctl00_ctl00_ContentPlaceHolder_Cont
> entPlaceHolder_LoginImageButton/
> (Watir::Exception::UnknownObjectException)
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:284
> :in `enabled?'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:56:
> in `assert_enabled'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:254
> :in `fire_event'
>         from C:/edc/3.1.4.5 Produce Test Case A 011408.rb:64
>
> Thank you,
> Robert Vaughn
> Albuquerque, NM

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to