Hi All,

I have hit a problem with finding a checkbox inside a table cell. I am able 
to find a hidden input in the same cell but not the checkbox. Any ideas on 
what I might be doing wrong?

*Error:* Unable to locate element, using {:tag_name=>["checkbox"], 
:index=>1} (Watir::Exception::UnknownObjectException)

*HTML Snippet:*
<tr>
<td class="tableHead">Time Due</td>
<td class="tableHead">Next Due</td>
</tr>
<tr class="odd" valign="top">
<td align="center" class="rightBorder bottomBorder" valign="middle"><input 
type="checkbox" id="cbPerson1" name="cbPerson1" 
value="{604E310A-3895-4814-94F2-255363CBB737}" 
onclick="updateSelectedCount(this, 1)" index="1"><input type="hidden" 
id="patientName1" name="patientName1" value="DOE, JOHN" disabled><input 
type="hidden" id="room1" name="room1" value="" disabled><input 
type="hidden" id="bed1" name="bed1" value="" disabled></td>
<td align="center" class="rightBorder bottomBorder"> 
</td>
<td align="center" class="rightBorder bottomBorder"> 
</td>
<td align="center" class="rightBorder bottomBorder"><a 
id="medChartSummaryIcon" href="#" onclick="tciOpenWindowModal(window, 
'../patient/SummaryMedChartDlg.asp?loadAlways=1&amp;patientId={604E310A-3895-4814-94F2-255363CBB737}',
 
-1, -1, 1000, 600)" title="Show Medication Chart Summary"><img 
class="alpha" src="../MedChart/style/summaryMedChart.png"></a></td>
<td class="rightBorder bottomBorder">DOE, JOHN<br>0332430</td>
<td class="rightBorder bottomBorder">
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<col width="23px" class="tableCell">
<col width="*" class="tableCell" style="font-weight : bold;">
<tr>
<td><img src="../medChart/style/overdue.png" class="locationImg alpha" 
style="vertical-align:middle"></td>
<td>108 overdue  starting on 24/01/2012 
 at 08:00</td>
</tr>


*Code Snippet:
*
  require 'watir'

  browser = 
Watir::IE.start("http://svhhatrixtest/medchart/user/MedChartFrame.asp?url=Login.asp";
  browser.frame(:id, "medChartFrame").text_field(:name, 
"username").set("myuser")
  browser.frame(:id, "medChartFrame").text_field(:name, 
"password").set("mypass")
  browser.frame(:id, "medChartFrame").button(:value,"Log In").click
  browser.frame(:id, "medChartFrame").link(:id,"administration").click
  browser.frame(:id, 
"medChartFrame").select_list(:name,"locationId").option(:text, "3N").select

  browser.frame(:id, "medChartFrame").table(:index, 1).rows.each do |row| 
    row.cells.each do |cell|
      if cell.hidden(:value, "DOE, JOHN")
           * cell.checkbox(:index,1).click  # this fails!!*
      end
    end
  end 


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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to