[wtr-general] Re: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
HTML SelectList elements have two 'parameters' as it were for each item on the list. a text lable that is displayed to the user, and an underlying 'value' that is returned in the HTTP request when that list item is selected. I think you are confusing the two. Try looking at the actual HTML for the selection list and you'll see both the text 'label' of the list item, and the displayed value. To select the n'th element in the list use brower.select_list (:name,FacsimileSearchControl1:FromDateDropdownlist).select_item_in_select_list (:index, n) potentially you might have to use n-1 I'm told that firewatir uses 'zero based' index counting, where Watir is 'one based', but I don't know if this is one of those cases where watir and firewatir are still different or not. On Aug 26, 5:35 pm, Doodle jeffrey.eman...@gmail.com wrote: Thanks for your response, Chuck. I tried clearing the selection first, and that didn't seem to make a difference. The changing of the dropdown box does in fact trigger a postback: onchange=javascript:setTimeout('__doPostBack (\'FacsimileSearchControl1$FromDateDropdownlist\',\'\')', 0) I am afraid I'm a bit out of my element in understanding this part. I tried adding the sleep commands in as well, and that didn't help either. The thing that confuses me is that, when you manually open the site (which, btw, is a public site for looking at detailed reports about banks), the dropdown list is populated with dates, such as 06/31/2009. Yet, when I load up the options of the dropdown into an array and put that out, the array contains these values: 91 111 98 106 101 99 116 32 72 84 77 76 79 I assume these values somehow drive the javascript which populates the dropdown. But I have not figured out a way to simply get at the nth element in the dropdown. Do you have any ideas? I really appreciate the help! On Aug 24, 11:41 am, Chuck van der Linden sqa...@gmail.com wrote: Try clearing the current selection, before selecting another value in the selection list. Also since picking the radio button causes the page to re-render (or is it a postback?), you might need to put in a small wait for a second or two after doing that to give the browser a chance to do it's thing before you start populating the search field and ripping through the from-dates The same goes for after firing the onchange, that initiates some kind of re-render or postback (I'd have to be running fiddler to see if it's actually hitting the server) and you might need a allow a little time for that to take place. Have you tried using an IRB session to walk through this manually so you can see what steps are working and what steps are not working? (you'd probably want to omit the loops, but otoh you could use something like puts dropdate.options to see if it's able to get the list of options for the select list you never really indicated what happens when you run the code above (and given the site involved, I'm NOT going to try it for myself ;-) are you getting some kind or error at any point, or is the site just not reacting to the onchange, or what? On Aug 21, 2:40 pm, Doodle jeffrey.eman...@gmail.com wrote: Hi everyone, I'm loving Watir so far but running into a wall with a certain site. The site uses javascript/asp.net to control a drop down list. I have gone crazy trying different things to use select_list, but nothing seems to work. I just want to be able to select the nth element in a dropdown list, but if I look for certain text it won't work, and if I grab the contents and try to set it that way it also doesn't work. I suspect it has to do with using javascript and the fire_event function, but this does not seem to be very well documented. Also, I am a novice ruby code so any tips or feedback in terms of the general coding style would be greatly appreciated. Thanks! Here is a copy of the code I'm using, presented below the line. 'C:\BankData\failedbankcertcodes.txt' is a txt file containing just these lines: 26870 26535 28344 27011 33901 34194 34881 23556 22574 18659 34043 32069 34341 27367 23124 35469 _ require 'firewatir' require 'rubygems' require 'ftools' include FireWatir ff=Firefox.new certlist='C:\BankData\failedbankcertcodes.txt' File.readlines(certlist).each do |line| urlstring =https://cdr.ffiec.gov/public/ManageFacsimiles.aspx; ff.goto(urlstring) ff.radio(:name, FacsimileSearchControl1:identifierRButton).set ff.select_list(:name,FacsimileSearchControl1:uniqueIDDropdown).select (FDIC Certificate Number) ff.text_field(:name, FacsimileSearchControl1:uniqueIDTextBox).set line datedrop=ff.select_list (:name,FacsimileSearchControl1:FromDateDropdownlist) reportdates=datedrop.options() for i in
[wtr-general] Re: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
On Thu, Aug 27, 2009 at 2:35 AM, Doodle jeffrey.eman...@gmail.com wrote: site (which, btw, is a public site for looking at detailed reports about banks), Can you send us a link and let us know what you want to do? Željko -- http://watirpodcast.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
Sorry, I thought it was clear in my first post. The site is https://cdr.ffiec.gov/public/ManageFacsimiles.aspx I am trying to search through a list of Cert Codes. For each Cert Code, I want to download the file corresponding to each date present in the date dropdown list and click submit. On Aug 27, 3:19 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, Aug 27, 2009 at 2:35 AM, Doodle jeffrey.eman...@gmail.com wrote: site (which, btw, is a public site for looking at detailed reports about banks), Can you send us a link and let us know what you want to do? Željko --http://watirpodcast.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
Thanks for your response, Chuck. I tried clearing the selection first, and that didn't seem to make a difference. The changing of the dropdown box does in fact trigger a postback: onchange=javascript:setTimeout('__doPostBack (\'FacsimileSearchControl1$FromDateDropdownlist\',\'\')', 0) I am afraid I'm a bit out of my element in understanding this part. I tried adding the sleep commands in as well, and that didn't help either. The thing that confuses me is that, when you manually open the site (which, btw, is a public site for looking at detailed reports about banks), the dropdown list is populated with dates, such as 06/31/2009. Yet, when I load up the options of the dropdown into an array and put that out, the array contains these values: 91 111 98 106 101 99 116 32 72 84 77 76 79 I assume these values somehow drive the javascript which populates the dropdown. But I have not figured out a way to simply get at the nth element in the dropdown. Do you have any ideas? I really appreciate the help! On Aug 24, 11:41 am, Chuck van der Linden sqa...@gmail.com wrote: Try clearing the current selection, before selecting another value in the selection list. Also since picking the radio button causes the page to re-render (or is it a postback?), you might need to put in a small wait for a second or two after doing that to give the browser a chance to do it's thing before you start populating the search field and ripping through the from-dates The same goes for after firing the onchange, that initiates some kind of re-render or postback (I'd have to be running fiddler to see if it's actually hitting the server) and you might need a allow a little time for that to take place. Have you tried using an IRB session to walk through this manually so you can see what steps are working and what steps are not working? (you'd probably want to omit the loops, but otoh you could use something like puts dropdate.options to see if it's able to get the list of options for the select list you never really indicated what happens when you run the code above (and given the site involved, I'm NOT going to try it for myself ;-) are you getting some kind or error at any point, or is the site just not reacting to the onchange, or what? On Aug 21, 2:40 pm, Doodle jeffrey.eman...@gmail.com wrote: Hi everyone, I'm loving Watir so far but running into a wall with a certain site. The site uses javascript/asp.net to control a drop down list. I have gone crazy trying different things to use select_list, but nothing seems to work. I just want to be able to select the nth element in a dropdown list, but if I look for certain text it won't work, and if I grab the contents and try to set it that way it also doesn't work. I suspect it has to do with using javascript and the fire_event function, but this does not seem to be very well documented. Also, I am a novice ruby code so any tips or feedback in terms of the general coding style would be greatly appreciated. Thanks! Here is a copy of the code I'm using, presented below the line. 'C:\BankData\failedbankcertcodes.txt' is a txt file containing just these lines: 26870 26535 28344 27011 33901 34194 34881 23556 22574 18659 34043 32069 34341 27367 23124 35469 _ require 'firewatir' require 'rubygems' require 'ftools' include FireWatir ff=Firefox.new certlist='C:\BankData\failedbankcertcodes.txt' File.readlines(certlist).each do |line| urlstring =https://cdr.ffiec.gov/public/ManageFacsimiles.aspx; ff.goto(urlstring) ff.radio(:name, FacsimileSearchControl1:identifierRButton).set ff.select_list(:name,FacsimileSearchControl1:uniqueIDDropdown).select (FDIC Certificate Number) ff.text_field(:name, FacsimileSearchControl1:uniqueIDTextBox).set line datedrop=ff.select_list (:name,FacsimileSearchControl1:FromDateDropdownlist) reportdates=datedrop.options() for i in 0..reportdates.size datedrop.set reportdates[i] datedrop.fire_event(onchange) ff.button(:name, tabStrip:_ctl2).click begin ff.button(:name, SearchResultsControl1:CallReportDataGrid:_ctl0:_ctl4:MyButton).click ff.radio(:name, FacsimileDownloadControl1:formatButtonList).set SDF ff.button (:name,FacsimileDownloadControl1:downloadTabStrip:_ctl2).click rescue puts reportdates[i] end end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
Try clearing the current selection, before selecting another value in the selection list. Also since picking the radio button causes the page to re-render (or is it a postback?), you might need to put in a small wait for a second or two after doing that to give the browser a chance to do it's thing before you start populating the search field and ripping through the from-dates The same goes for after firing the onchange, that initiates some kind of re-render or postback (I'd have to be running fiddler to see if it's actually hitting the server) and you might need a allow a little time for that to take place. Have you tried using an IRB session to walk through this manually so you can see what steps are working and what steps are not working? (you'd probably want to omit the loops, but otoh you could use something like puts dropdate.options to see if it's able to get the list of options for the select list you never really indicated what happens when you run the code above (and given the site involved, I'm NOT going to try it for myself ;-) are you getting some kind or error at any point, or is the site just not reacting to the onchange, or what? On Aug 21, 2:40 pm, Doodle jeffrey.eman...@gmail.com wrote: Hi everyone, I'm loving Watir so far but running into a wall with a certain site. The site uses javascript/asp.net to control a drop down list. I have gone crazy trying different things to use select_list, but nothing seems to work. I just want to be able to select the nth element in a dropdown list, but if I look for certain text it won't work, and if I grab the contents and try to set it that way it also doesn't work. I suspect it has to do with using javascript and the fire_event function, but this does not seem to be very well documented. Also, I am a novice ruby code so any tips or feedback in terms of the general coding style would be greatly appreciated. Thanks! Here is a copy of the code I'm using, presented below the line. 'C:\BankData\failedbankcertcodes.txt' is a txt file containing just these lines: 26870 26535 28344 27011 33901 34194 34881 23556 22574 18659 34043 32069 34341 27367 23124 35469 _ require 'firewatir' require 'rubygems' require 'ftools' include FireWatir ff=Firefox.new certlist='C:\BankData\failedbankcertcodes.txt' File.readlines(certlist).each do |line| urlstring =https://cdr.ffiec.gov/public/ManageFacsimiles.aspx; ff.goto(urlstring) ff.radio(:name, FacsimileSearchControl1:identifierRButton).set ff.select_list(:name,FacsimileSearchControl1:uniqueIDDropdown).select (FDIC Certificate Number) ff.text_field(:name, FacsimileSearchControl1:uniqueIDTextBox).set line datedrop=ff.select_list (:name,FacsimileSearchControl1:FromDateDropdownlist) reportdates=datedrop.options() for i in 0..reportdates.size datedrop.set reportdates[i] datedrop.fire_event(onchange) ff.button(:name, tabStrip:_ctl2).click begin ff.button(:name, SearchResultsControl1:CallReportDataGrid:_ctl0:_ctl4:MyButton).click ff.radio(:name, FacsimileDownloadControl1:formatButtonList).set SDF ff.button (:name,FacsimileDownloadControl1:downloadTabStrip:_ctl2).click rescue puts reportdates[i] end end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---