Hi,

Which watir version are you using? Latest version has a method called 'attribute_value' that you can try that to get the value of 'caption' attribute. So you try the following:

ie.checkboxes[1].attribute_value("caption")

Regards,
Angrez

On 6/15/06, Amitha Shetty <[EMAIL PROTECTED]> wrote:
Hi,
  Sorry thats the javascipt which I had given.
Checkboxes on this page are generated by a third party tool which uses the following _javascript_s:
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""><script type="text/_javascript_" src=""><script type="text/_javascript_" src=""
<script type="text/_javascript_" src="">
 
 Is there way to access the html generated this way?I want to get the display name of the checkbox which is present as caption in the view source page as
"a[0]['children'][0]['children'][0]['children'][0]['caption']='CHILD_A2;"
I want the text "CHILD_A2"
 
View Source of the page looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CHECK</title>
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""><script type="text/_javascript_" src=""><script type="text/_javascript_" src=""
<script type="text/_javascript_" src="">
<script type="text/_javascript_">
function init() {
  myTree = new Bs_Tree();
  myTree.imageDir = './images/';
  myTree.useCheckboxSystem      = true;
  myTree.useAutoSequence = false;
  myTree.checkboxSystemWalkTree = 3;
  myTree.initByArray(a);
  myTree.drawInto('treeDiv1');
}
</script>
 
 <script type = "text/_javascript_">

 
var a = new Array;
a[0] = new Array;
a[0]['id'] = '99999'
a[0]['checkboxName'] ='CNAME_14'
a[0]['caption'] = 'Check Here'  (#This is the data I want to retrieve)
a[0]['isOpen'] = true
a[0]['children'] = new Array;
a[0]['children'][0] = new Array;
a[0]['children'][0]['id']='51';
a[0]['children'][0]['caption']='CHILD_A';
a[0]['children'][0]['checkboxName']='VELOZ_51';
a[0]['children'][0]['children'] = new Array;
a[0]['children'][0]['children'][0] = new Array;
a[0]['children'][0]['children'][0]['id']='52';
a[0]['children'][0]['children'][0]['caption']='CHILD_A1;
a[0]['children'][0]['children'][0]['checkboxName']='ID_52';
a[0]['children'][0]['children'][0]['children'] = new Array;
a[0]['children'][0]['children'][0]['children'][0] = new Array;
a[0]['children'][0]['children'][0]['children'][0]['id']='54';
a[0]['children'][0]['children'][0]['children'][0]['caption']='CHILD_A2;
a[0]['children'][0]['children'][0]['children'][0]['checkboxName']='ID_54';
</script>
 
 
<body  >
<div style="margin-top:5px;margin-left:5px;" id="treeDiv1"></div>
  </body>
</html>
 
 
Thanks,
Amitha
 
 


Zeljko Filipin < [EMAIL PROTECTED]> wrote:
You have <input type="checkbox" caption="Check Here" />? It is not valid html. Check it for yourself at http://validator.w3.org/.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
Hi,
   Can I access caption attribute of a checkbox?
 I want to retrieve the display name of the checkbox and this data is present in the caption attribute in the html source. The checkboxes are in the form of a tree.
HTML Source is:
var a = new Array;
a[0] = new Array;
a[0]['id'] = '99999'
a[0]['checkboxName'] ='CNAME_14'
a[0]['caption'] = 'Check Here'  (#This is the data I want to retrieve)
 
 
ie.checkboxes[1].name gives CNAME_14
but ie.checkboxes[1].caption throws the following exception:
undefined method `caption' for #<Watir::CheckBox:0x33c6b38> (NoMethodError)
 
I want to get the data in caption attribute i.e 'Check Here'. How do I retrieve it?
 
Thanks,
Amitha
 

Send instant messages to your online friends http://in.messenger.yahoo.com

Stay connected with your friends even when away from PC. Link: http://in.mobile.yahoo.com/new/messenger/


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to