Title: Tricky checkbox selection

If you are trying to see information about these object then try something like the following:

   variable = $ie.getDocument().getElementsByName('cbxSelectGroup[]');

   puts variable.each{|i| print i.value, "\n"}
   puts variable.length

 

Add the value property on to the end of your object. So you see I did i.value. That should show you the value.

 

Sergio


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Monday, January 23, 2006 2:21 PM
To: 'wtr-general@rubyforge.org'
Subject: Re: [Wtr-general] Tricky checkbox selection

 

   variable = $ie.getDocument().getElementsByName('cbxSelectGroup[]');

   puts variable.each{|i| print i, "\n"}
   puts variable.length

 

As I said, I am new to _javascript_ and ruby.

The code returns:

#<WIN32OLE:0x2a961b8>
#<WIN32OLE:0x2a96188>
#<WIN32OLE:0x2a96140>

etc.

which I believe represents memory locations? How can I get the values?


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sergio Pinon
Sent: Monday, January 23, 2006 1:58 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Tricky checkbox selection

Did you try the method I gave you? I wanted to know if it worked.

 

Sergio

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Monday, January 23, 2006 1:43 PM
To: 'wtr-general@rubyforge.org'
Subject: Re: [Wtr-general] Tricky checkbox selection

 

The table is generated by an underlining database and the values are different almost every time.
Only the string in the second <td> stays the same, e.g "Test1", "Test2", "Test3"

 

<tr>  <td>  <input  type="checkbox" name="Add_member[]" value="25">  </td>  <td> Test1 </td></tr>
<tr>  <td>  <input  type="checkbox" name="Add_member[]" value="27">  </td>  <td> Test2 </td></tr>
<tr>  <td>  <input  type="checkbox" name="Add_member[]" value="35">  </td>  <td> Test3 </td></tr>

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cain, Mark
Sent: Monday, January 23, 2006 1:38 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Tricky checkbox selection

You don’t need to just try something like this. 

 

$ie.checkbox(:name, /Add_member/i, “35”).set

 

You can use regular expressions for your attribute name if you know part of what that name will be at runtime—although it does get tricky when attribute names for an object are the same, in that case you can use :index.  Indexes are 1 based currently (although I heard some rumbling as to think they will soon be zero based) and start with the first one on the page and continue through the last one on the page.

 

--Mark

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Monday, January 23, 2006 1:19 PM
To: 'wtr-general@rubyforge.org'
Subject: Re: [Wtr-general] Tricky checkbox selection

 

I have almost none _javascript_ experience. How do I get the underlying _javascript_ object of that page?

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sergio Pinon
Sent: Monday, January 23, 2006 11:12 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Tricky checkbox selection

Well the other thing to do is try the code below. What you do is get the underlying _javascript_ object of the page and then interact with it as you would with _javascript_. You get all the elements with the name you supply and then access the one you want using the indexer on that array. Then you just set the checked property of that object to true and it should work. Let me know how it turns out.

 

ie_browser.getDocument().getElementsByName(“Add_member[]”)[index of control].checked = true;

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Monday, January 23, 2006 10:47 AM
To: 'wtr-general@rubyforge.org'
Subject: Re: [Wtr-general] Tricky checkbox selection

 

Unfortunately I do not know the value beforehand.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sergio Pinon
Sent: Monday, January 23, 2006 10:45 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Tricky checkbox selection

Do you know the value of the checkbox beforehand? If you do then just use this method:

 

Ie_browser.checkbox(:name, “Add_member[]”, “35”).set();

 

This should be good to go.

 

Sergio

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Monday, January 23, 2006 10:23 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Tricky checkbox selection

 

Hello,

I have following html code and like to select the checkbox for "Test3". How can I do that?

<input  type="checkbox" name="Add_member[]" value="25"></td><td> Test1</td><td> Subscriber</td><td>208</td></tr>
<input  type="checkbox" name="Add_member[]" value="27"></td><td> Test2</td><td> Subscriber</td><td>208</td></tr>
<input  type="checkbox" name="Add_member[]" value="35"></td><td> Test3</td><td> Subscriber</td><td>208</td></tr>

 

Thanks.

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to