[Wtr-general] $ie.button replacing with $ie.b?
cand i do something like this, and how: b=button puts $ie.b(:index,1) instead of puts $ie.button(:index,1) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Having problems figuring out what to click
Hi Matt, You need to access the cell, the onclick event is attached to the cell, not the row. This should work: $ie.table(:id,'table1')[1][1].fire_event('onClick') table with id of table1, first row, first cell. -Charley On 7/6/07, Matt Berney [EMAIL PROTECTED] wrote: I have been using Ruby and watir for a while now. But, the set of web pages has me stumped. Any help you can provide is extremely appreciated. In the source code below, there is a table of items that, when clicked, fills in a frame. I can get to the TableRow. But, click on it or fire_event('onClick') doesn't seem to do the trick. The flash method doesn't light up. However, flashing the entire table seems to work. So apparently, I am not selecting the item I want. # this works $ie.table(:id,'table1').flash # this doesn't work $ie.table(:id,'table1')[1].flash $ie.table(:id,'table1')[1].click $ie.table(:id,'table1')[1].fire_event('onClick') How does one call the changlframes() javascript function? I thought that is what the fire_event() was for. BTW, if it makes any difference, this table is inside a div. Thanks in advance. table id=table1 style=BORDER-COLLAPSE: collapse borderColor=#819cb9 height=180 cellPadding=0 width=69 border=1 tr td id=list1 style=CURSOR: pointer onClick=changeBG('list1');changIframes(0); bgColor=#ceddf0 height=30 p style=TEXT-ALIGN: centerbTicketbr Info/b/p /td /tr ... tr td id=list5 style=CURSOR: pointer onClick=changeBG('list5');changIframes(4); bgColor=#ceddf0 height=30 p style=TEXT-ALIGN: centerbSVAs/b/p /td /tr /table ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] $ie.button replacing with $ie.b?
I'm not quite sure why you'd want to do that, maybe you could explain it. Here are a couple of random possibilities: 1. use the string and eval it, makes the code less readable but there are some good uses for this: b = button eval(puts $ie.#{b}(:index, 1)) 2.wrap the code in a method, cleaner access and sets you up for methods on your pages which you can roll into classes for your pages: def my_form_button; $ie.button(:index, 1);end puts my_form_button my_form_button.click It all depends on what the context of the question is and where you might want to take it. -Charley On 7/7/07, mihai [EMAIL PROTECTED] wrote: cand i do something like this, and how: b=button puts $ie.b(:index,1) instead of puts $ie.button(:index,1) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] $ie.button replacing with $ie.b?
i want to do something like this: def check_elements(ie,elements,btn,lnk) for i in 1 .. elem[1,0] if ( ie.elements[0,0](:index,btn[i-1,0]).exist? and ie.elements[0,0](:value,btn[i-1,1]) and ie.elements[0,0](:name,btn[i-1,2]) ) then write(The button with value: + btn[i-1,2] + exist and not disabled,1) else write(The button with value: + btn[i-1,2] + does not exist ,0) # write is a def with file.puts... end # if exist end # for i end #def elements=Matrix[ [button,link,select_list...] [2,6,1] #number of buttons,links etc ] buttons=Matrix[ [1,,Web Search], # index, name and value [2,,Go], ] links=Matrix check_elements(ie,elements,buttons,links) I want to verify all elements just by calling check_elements procedure and editing an txt file where the buttons, links ..indexes, values and names are This is just a simple example; the check_elements procedure it will be more complex, at least that i want. Tnx for help ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] $ie.button replacing with $ie.b?
Try the send method, which invokes the method named by the first argument and passes it any succeeding parameters. To use your example: b = 'button' puts $ie.send(b, :index,1) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general