[wtr-general] Re: Drop down menu
so if you have ahold of the SelectList object using $b.select_list(:index, 2), can you make if flash? if so, can you view the values using $b.select_list(:index, 2).options The Watir API says options is a method but in my installation it doesn't seem to be implemented. Here is the code from the API, which works for me. I also added option_values which shows the value of each element in the SelectList if you do $b.select_list(:index, 2).option_values Maybe your SelectList has value options instead of text options. in that case you'd have to use $b.select_list(:index, 2).select_value(Test) module Watir class SelectList def selected_option assert_exists returnArray = [] @container.log There are #...@o.length} items @o.each do |thisItem| if thisItem.selected @container.log Item (#{thisItem.text}) is selected returnArray thisItem.text end end return returnArray end def options assert_exists @container.log There are #...@o.length} items returnArray = [] @o.each { |thisItem| returnArray thisItem.text } return returnArray end def option_values assert_exists @container.log There are #...@o.length} items returnArray = [] @o.each { |thisItem| returnArray thisItem.value } return returnArray end end #end class SelectList end #end module Watir You said it generates a table, you don't mean an actual html Table, right? Just the list of options in the SelectList? Something else you could try would be to create an option by saying o=$b.select_list(:index, 2).option(:text, Test) then maybe you could do the $b.select_list(:index, 2).select(Test) Don't know if any of this will help, but maybe it'll get you closer... On Mar 18, 3:51 pm, tester86 sagar.am...@gmail.com wrote: I have been testing this part of my script in IRB, I also triggered two fire_event onmousedown then onmouseup. Also tried onmousedown sleep 1 then onmouseup, tried and tested all the possbile combinations and methods. When onmousedown is triggered in the table it generated the drop down list -- but it shows up as blank then if you go and select a value via $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test it cannot find the element. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com To unsubscribe from this group, send email to watir-general+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[wtr-general] Re: Drop down menu
you may have to fire more than one mouse event. i once had to fire an onmousedown, wait 1 sec, then fire onclick (or something like that, i don't quite remember). try doing it interactively with irb instead of writing the test and running over and over. playing with it interactively sometimes makes it much faster to develop a solution to an unusual situation. On Mar 17, 9:30 am, tester86 sagar.am...@gmail.com wrote: Hi ( I did try text_field before but it does not work, after I set focus and execute text_field(:index, 2).set(Test) error stating index 2 has been disabled. What I am doing: I set the focus in the drop down, then set onblur(if i do $b.select_list(:value, Test).click this clicks on the default value in the drop down) however the list is invisible checked using firebug. I need to somehow click on the drop down again in order to display the list. I have tried various combinations but nothing working. I have triggered fire_events. Thanks On Mar 16, 10:55 pm, Mrunal mrunal.gor...@gmail.com wrote: Hi In case when there is drop down arrow, the elements are set using text_field sometimes. Please try this option also. e.g. $ie.text_field(:name,'').set('') tester86 wrote: Hi I did fire a javascript event that will set the focus in the drop down list: $b.table(:index, 1)[2][6].fire_event(onmousedown) When the above line is executed it does not display the drop but it is focused. When I do either of the following: $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test) It does not select the link. I have to somehow click on the drop down arrow again in order to populate the drop down list. This is the same behavior when selecting a value in the drop down list manually. Thanks On Mar 15, 5:29 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi! You have a typo in your select statement: $b.select_list(:index, 2).select_list(Test) should be: $b.select_list(:index, 2).select(Test) (although, I think $b.select_list(:index, 2).set(Test) should work as well) Have you tried firing your javascript to put focus on the field just before attempting the select statement? Hope this helps! -Tiffany On Mar 15, 2:43 pm, tester86 sagar.am...@gmail.com wrote: I need to click on a drop down. I have a script that will set the focus in the drop down list then when I go to select the value it does not select the list. Manually: When I click in the drop down field it gets activated then when I click on the drop down arrow it will display the list. Interaction: When I click in the cell it sets the focus, then I have to click on the drop down arrow in order to see the list of options. If I do: $b.table(:index, 1)[2][6].fire_event(onmousedown) The above will set the focus in the field that contains the drop down. Manually I have click on the drop down in order to see the list If I do: $b.select_list(:index, 2).select_list(Test) It does not click on Test. Is there any way I can click on the drop down in order to see the list.. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Drop down menu
I have been testing this part of my script in IRB, I also triggered two fire_event onmousedown then onmouseup. Also tried onmousedown sleep 1 then onmouseup, tried and tested all the possbile combinations and methods. When onmousedown is triggered in the table it generated the drop down list -- but it shows up as blank then if you go and select a value via $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test it cannot find the element. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com To unsubscribe from this group, send email to watir-general+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: [wtr-general] Re: Drop down menu
Hi In case when there is drop down arrow, the elements are set using text_field sometimes. Please try this option also. e.g. $ie.text_field(:name,'').set('') tester86 wrote: Hi I did fire a javascript event that will set the focus in the drop down list: $b.table(:index, 1)[2][6].fire_event(onmousedown) When the above line is executed it does not display the drop but it is focused. When I do either of the following: $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test) It does not select the link. I have to somehow click on the drop down arrow again in order to populate the drop down list. This is the same behavior when selecting a value in the drop down list manually. Thanks On Mar 15, 5:29 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi! You have a typo in your select statement: $b.select_list(:index, 2).select_list(Test) should be: $b.select_list(:index, 2).select(Test) (although, I think $b.select_list(:index, 2).set(Test) should work as well) Have you tried firing your javascript to put focus on the field just before attempting the select statement? Hope this helps! -Tiffany On Mar 15, 2:43 pm, tester86 sagar.am...@gmail.com wrote: I need to click on a drop down. I have a script that will set the focus in the drop down list then when I go to select the value it does not select the list. Manually: When I click in the drop down field it gets activated then when I click on the drop down arrow it will display the list. Interaction: When I click in the cell it sets the focus, then I have to click on the drop down arrow in order to see the list of options. If I do: $b.table(:index, 1)[2][6].fire_event(onmousedown) The above will set the focus in the field that contains the drop down. Manually I have click on the drop down in order to see the list If I do: $b.select_list(:index, 2).select_list(Test) It does not click on Test. Is there any way I can click on the drop down in order to see the list.. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Drop down menu
Hi ( I did try text_field before but it does not work, after I set focus and execute text_field(:index, 2).set(Test) error stating index 2 has been disabled. What I am doing: I set the focus in the drop down, then set onblur(if i do $b.select_list(:value, Test).click this clicks on the default value in the drop down) however the list is invisible checked using firebug. I need to somehow click on the drop down again in order to display the list. I have tried various combinations but nothing working. I have triggered fire_events. Thanks On Mar 16, 10:55 pm, Mrunal mrunal.gor...@gmail.com wrote: Hi In case when there is drop down arrow, the elements are set using text_field sometimes. Please try this option also. e.g. $ie.text_field(:name,'').set('') tester86 wrote: Hi I did fire a javascript event that will set the focus in the drop down list: $b.table(:index, 1)[2][6].fire_event(onmousedown) When the above line is executed it does not display the drop but it is focused. When I do either of the following: $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test) It does not select the link. I have to somehow click on the drop down arrow again in order to populate the drop down list. This is the same behavior when selecting a value in the drop down list manually. Thanks On Mar 15, 5:29 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi! You have a typo in your select statement: $b.select_list(:index, 2).select_list(Test) should be: $b.select_list(:index, 2).select(Test) (although, I think $b.select_list(:index, 2).set(Test) should work as well) Have you tried firing your javascript to put focus on the field just before attempting the select statement? Hope this helps! -Tiffany On Mar 15, 2:43 pm, tester86 sagar.am...@gmail.com wrote: I need to click on a drop down. I have a script that will set the focus in the drop down list then when I go to select the value it does not select the list. Manually: When I click in the drop down field it gets activated then when I click on the drop down arrow it will display the list. Interaction: When I click in the cell it sets the focus, then I have to click on the drop down arrow in order to see the list of options. If I do: $b.table(:index, 1)[2][6].fire_event(onmousedown) The above will set the focus in the field that contains the drop down. Manually I have click on the drop down in order to see the list If I do: $b.select_list(:index, 2).select_list(Test) It does not click on Test. Is there any way I can click on the drop down in order to see the list.. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Drop down menu
Hi I did fire a javascript event that will set the focus in the drop down list: $b.table(:index, 1)[2][6].fire_event(onmousedown) When the above line is executed it does not display the drop but it is focused. When I do either of the following: $b.select_list(:index, 2).select(Test) $b.select_list(:index, 2).set(Test) It does not select the link. I have to somehow click on the drop down arrow again in order to populate the drop down list. This is the same behavior when selecting a value in the drop down list manually. Thanks On Mar 15, 5:29 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi! You have a typo in your select statement: $b.select_list(:index, 2).select_list(Test) should be: $b.select_list(:index, 2).select(Test) (although, I think $b.select_list(:index, 2).set(Test) should work as well) Have you tried firing your javascript to put focus on the field just before attempting the select statement? Hope this helps! -Tiffany On Mar 15, 2:43 pm, tester86 sagar.am...@gmail.com wrote: I need to click on a drop down. I have a script that will set the focus in the drop down list then when I go to select the value it does not select the list. Manually: When I click in the drop down field it gets activated then when I click on the drop down arrow it will display the list. Interaction: When I click in the cell it sets the focus, then I have to click on the drop down arrow in order to see the list of options. If I do: $b.table(:index, 1)[2][6].fire_event(onmousedown) The above will set the focus in the field that contains the drop down. Manually I have click on the drop down in order to see the list If I do: $b.select_list(:index, 2).select_list(Test) It does not click on Test. Is there any way I can click on the drop down in order to see the list.. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Drop down menu
Hi! You have a typo in your select statement: $b.select_list(:index, 2).select_list(Test) should be: $b.select_list(:index, 2).select(Test) (although, I think $b.select_list(:index, 2).set(Test) should work as well) Have you tried firing your javascript to put focus on the field just before attempting the select statement? Hope this helps! -Tiffany On Mar 15, 2:43 pm, tester86 sagar.am...@gmail.com wrote: I need to click on a drop down. I have a script that will set the focus in the drop down list then when I go to select the value it does not select the list. Manually: When I click in the drop down field it gets activated then when I click on the drop down arrow it will display the list. Interaction: When I click in the cell it sets the focus, then I have to click on the drop down arrow in order to see the list of options. If I do: $b.table(:index, 1)[2][6].fire_event(onmousedown) The above will set the focus in the field that contains the drop down. Manually I have click on the drop down in order to see the list If I do: $b.select_list(:index, 2).select_list(Test) It does not click on Test. Is there any way I can click on the drop down in order to see the list.. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com