This might be another possibility to try:

 

Get the underlying _javascript_ DOM object from the browser:

js_dom = ie_browser.getDocument();

 

At this point you can execute any _javascript_ methods you want against the browser. Since you don’t have any name or id attributes you can get the objects by type.

hyperlinks = js_dom.getElementsByTagName(“”A”);

 

At the point the hyperlinks variable represents a collection of all of the links in your page. So if you know the index of the hyperlink you can just do that. Or you can loop through them all and try to determine which one to use.

hyperlinks[1].click()

 

or

 

for I in 0..hyperlinks.length

            do something with à hyperlinks[i]

end

 

Of course this is just one option. I would say your best option would be to try and give these hyperlinks sometype of identifier. (name, id, etc…)

 

Sergio


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Solis
Sent: Wednesday, January 25, 2006 9:01 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Another _javascript_ Question

 

All,

 

I've been trying desperately for over week to figure out how to click on _javascript_ button to no avail. I have tried just about everybody's suggestions. Mark Cain's solution posted last week looked very promising, but can't get it to work. Here is the code that contains the buttons (cancel & update) I need to click on:

 

<table cellpadding="0" cellspacing="0" border="0" width="300">   <tr
  <td><img src="/images/admin/form_top_left.gif"></td>    <td background="">"/images/admin/form_top_tile.gif"><img src="">"/images/admin/spacer.gif" width="10" height="48"></td>    <td><a >"return validate_form('ADMINPayModelUpdate','enable')" >"imgswap('enablealltop', 'form_top_enableall_over'); return false;" >"imgswap('enablealltop', 'form_top_enableall_up'); return false;"><img NAME="enablealltop" src="">"/images/admin/form_top_enableall_up.gif" value="Enable all" border="0"></a><a >"return validate_form('ADMINPayModelUpdate','disable')" >"imgswap('disablealltop', 'form_top_disableall_over'); return false;" >"imgswap('disablealltop', 'form_top_disableall_up'); return false;"><img border="0" NAME="disablealltop" src="">"/images/admin/form_top_disableall_up.gif" value="Disable all"></a></td>    <td background="">"/images/admin/form_top_tile.gif"><img src="">"/images/admin/spacer.gif" width="226" height="48"></td>    <td><a href="">"_javascript_:document.ADMINPayModel.reset()" >"return validate_form('ADMINPayModelUpdate','cancel')" >"imgswap('canceltop', 'form_top_cancel_over'); return false;" >"imgswap('canceltop', 'form_top_cancel_up'); return false;"><img NAME="canceltop" src="">"/images/admin/form_top_cancel_up.gif" border="0"></a><a href="">"#" >"return validate_form('ADMINPayModelUpdate','update')" >"imgswap('updatetop', 'form_top_update_over'); return false;" >"imgswap('updatetop', 'form_top_update_up'); return false;"><img NAME="updatetop" src="">"/images/admin/form_top_update_up.gif" value="Update" border="0"></a></td>    <td background="">"/images/admin/form_top_tile.gif"><img src="">"/images/admin/spacer.gif" width="6" height="48"></td>    <td><img src="">"/images/admin/form_top_right.gif"></td>   </tr>  </table>
Thanks
!
David 
 


Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.

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

Reply via email to