Re: [Wtr-general] Select the first item in a list
You could also use $ie.select_list(:name, list2).select(/.*/) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tiffany Fodor Sent: Friday, June 22, 2007 1:27 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Select the first item in a list Hi all! I have a group of three tiered select lists - the first one defines what values will appear in the second and then the value selected in the second defines what values will appear in the third. For my testing, I don't really care what value is selected in the second and third lists, I just want to select the first entry. I've tried $ie.select_list(:name, list2).select(:index, 1), but I get a wrong number of arguments error. I've also tried adding the contents of the list to an array and setting the value using the array, but the array values are nil. intermediateValues = [$ie.select_list(:name, list2).getAllContents] puts intermediateValues[1] $ie.select_list(:name, list2).select(intermediateValues[1]) Any help would be greatly appreciated! Thanks! -Tiffany ___ 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
[Wtr-general] Select the first item in a list
Hi all! I have a group of three tiered select lists - the first one defines what values will appear in the second and then the value selected in the second defines what values will appear in the third. For my testing, I don't really care what value is selected in the second and third lists, I just want to select the first entry. I've tried $ie.select_list(:name, list2).select(:index, 1), but I get a wrong number of arguments error. I've also tried adding the contents of the list to an array and setting the value using the array, but the array values are nil. intermediateValues = [$ie.select_list(:name, list2).getAllContents] puts intermediateValues[1] $ie.select_list(:name, list2).select(intermediateValues[1]) Any help would be greatly appreciated! Thanks! -Tiffany ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Select the first item in a list
Try $ie.select_list(:name, list2).select(1) On 6/22/07, Tiffany Fodor [EMAIL PROTECTED] wrote: Hi all! I have a group of three tiered select lists - the first one defines what values will appear in the second and then the value selected in the second defines what values will appear in the third. For my testing, I don't really care what value is selected in the second and third lists, I just want to select the first entry. I've tried $ie.select_list(:name, list2).select(:index, 1), but I get a wrong number of arguments error. I've also tried adding the contents of the list to an array and setting the value using the array, but the array values are nil. intermediateValues = [$ie.select_list(:name, list2).getAllContents] puts intermediateValues[1] $ie.select_list(:name, list2).select(intermediateValues[1]) Any help would be greatly appreciated! Thanks! -Tiffany ___ 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] Select the first item in a list
Tiffany, I don't believe 'select' is a valid action on a select list (ironically enough). In my tests, I use: $ie.select_list(:name, list2).value=the_name_of_the_entry_here Thanks, Adam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tiffany Fodor Sent: Friday, June 22, 2007 12:27 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Select the first item in a list Hi all! I have a group of three tiered select lists - the first one defines what values will appear in the second and then the value selected in the second defines what values will appear in the third. For my testing, I don't really care what value is selected in the second and third lists, I just want to select the first entry. I've tried $ie.select_list(:name, list2).select(:index, 1), but I get a wrong number of arguments error. I've also tried adding the contents of the list to an array and setting the value using the array, but the array values are nil. intermediateValues = [$ie.select_list(:name, list2).getAllContents] puts intermediateValues[1] $ie.select_list(:name, list2).select(intermediateValues[1]) Any help would be greatly appreciated! Thanks! -Tiffany ___ 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] Select the first item in a list
We use select in our tests. It's a method in the Watir::SelectList class. As usual, there is more than one way to solve the task. Cheers, Jason On 6/22/07, Adam Reed [EMAIL PROTECTED] wrote: Tiffany, I don't believe 'select' is a valid action on a select list (ironically enough). In my tests, I use: $ie.select_list(:name, list2).value=the_name_of_the_entry_here Thanks, Adam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tiffany Fodor Sent: Friday, June 22, 2007 12:27 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Select the first item in a list Hi all! I have a group of three tiered select lists - the first one defines what values will appear in the second and then the value selected in the second defines what values will appear in the third. For my testing, I don't really care what value is selected in the second and third lists, I just want to select the first entry. I've tried $ie.select_list(:name, list2).select(:index, 1), but I get a wrong number of arguments error. I've also tried adding the contents of the list to an array and setting the value using the array, but the array values are nil. intermediateValues = [$ie.select_list(:name, list2).getAllContents] puts intermediateValues[1] $ie.select_list(:name, list2).select(intermediateValues[1]) Any help would be greatly appreciated! Thanks! -Tiffany ___ 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 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Select the first item in a list
Thanks so much for the quick reply and suggestion! Unfortunately, it didn't work - no error was generated from the command, but it didn't select a value in the list either. I could see the field highlighted in yellow as watir 'touched' it, but no value was selected. -Tiffany ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Select the first item in a list
I would double-check the name of the value. If that is correct, try 1) using a regex, 2) try accessing it in IRB, or 3) use an exists? or selected?, in no particular order. Similar to Adam, I access mine as ie.select_list(:id, 'list2').select('name of value'). Hope that helps. Cheers, Jason On 6/22/07, Tiffany Fodor [EMAIL PROTECTED] wrote: Thanks so much for the quick reply and suggestion! Unfortunately, it didn't work - no error was generated from the command, but it didn't select a value in the list either. I could see the field highlighted in yellow as watir 'touched' it, but no value was selected. -Tiffany ___ 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] Select the first item in a list
Thanks for the suggestion! My problem is that the first value in the second list could be one of many different values, depending on what the selection in the first list is. I just want to select the first value, no matter what it is. -Tiffany ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Select the first item in a list
This may be a little kludgy but worth a try. You will have to make the object names what are in you page... list_one = [] list_one = $ie.select_list( :name, 'list1').getAllContents # Get the contents of the first selectlist and randomly select one cnt = rand(list_one.length) # If there is a placeholder item at the topmost selectlist position bypass it next if #{list_one} == (-- Select One --) $ie.selectBox( :name, 'list1').select(#{list_one[cnt]}) # Wait for the selected item and until next selectlist is populated Sleep 1 list_one = nil # Get the contents of the second selectlist and randomly select one list_two = [] list_two = $ie.select_list( :name, 'list2').getAllContents cnt = rand(list_two.length) # If there is a placeholder item at the topmost selectlist position bypass it next if #{list_two} == (-- Select One --) $ie.selectBox( :name, 'list2').select(#{list_two[cnt]}) # Wait for the selected item and until next selectlist is populated Sleep 1 list_two = nil # Get the contents of the third selectlist and randomly select one list_three = [] list_three = $ie.select_list( :name, 'list3').getAllContents cnt = rand(list_three.length) # If there is a placeholder item at the topmost selectlist position bypass it next if #{list_three} == (-- Select One --) $ie.selectBox( :name, 'list3').select(#{list_three[cnt]}) list_three = nil Hope this helps, --Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tiffany Fodor Sent: Friday, June 22, 2007 12:41 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Select the first item in a list Thanks for the suggestion! My problem is that the first value in the second list could be one of many different values, depending on what the selection in the first list is. I just want to select the first value, no matter what it is. -Tiffany ___ 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] Select the first item in a list
I guess the options in a select list should really be array-like: ie.select_list(:id, 'whatever').select_first ie.select_list(:id, 'whatever').select_last ie.select_list(:id, 'whatever').select[3] # select the 3 or 4th, ( 1 or 0 indexing) Paul - Original Message - From: Tiffany Fodor [EMAIL PROTECTED] To: wtr-general@rubyforge.org Sent: Friday, June 22, 2007 3:09 PM Subject: Re: [Wtr-general] Select the first item in a list Yippee - it worked! Thanks so much! Mama says kludgy is as kludgy does. ;-) It's 3:00 Friday afternoon and my data loading test works now - nice way to kick off a weekend! Many thanks to all for your help! -Tiffany ___ 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