Re: [wtr-general] Watir-webdriver + right_click
On Fri, Oct 21, 2011 at 1:55 AM, RJ rj412@gmail.com wrote: Just curious to know, the technical readon why watir-webdriver has yet to implement an official right_click operation. You will notice that not a lot of Watir developers read this list. You should post this to wtr-developm...@rubyforge.org, or maybe even better to webdriver/selenium lists. Željko -- watir.com - community manager watir.com/book - author watirpodcast.com - host -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Get machine name for MAC
Joe, Here's a partial answer to why puts ENV[COMPUTERNAME] returned nil. Not every environment variable that is available on Windows is also on OSX (or Linux). To see which Env variables are available on your platform try this code, the results will differ form Windows, to OSX, to Linux. irb ENV.each do | key, value | puts key.to_s + = + value.to_s end On Oct 20, 8:47 am, Joe Fl joeflec...@gmail.com wrote: Hi, This is a ruby question but how do I get the name of my MAC using ruby. I have found: require 'socket' puts Socket.gethostname (not what I am looking for) puts ENV[COMPUTERNAME] puts ENV['USERDOMAIN'] puts ENV['LOGONSERVER'] they all return nil any help would be appreciated. Thank you, Joe -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: best practice for modal that may pop up
Hi Chuck, I have thought of that but these scripts will be run in a production environment so hitting the back end might not be a wise solution. Thank you, Joe On Thu, Oct 20, 2011 at 4:41 PM, Chuck van der Linden sqa...@gmail.comwrote: Potentially, is there some way to query the back-end directly to see the user's status relative to that community and thus be able to predict what SHOULD happen, and thus be able to both deal with it properly, and also verify the system is behaving as expected?? On Oct 20, 12:12 pm, Joe Fl joeflec...@gmail.com wrote: Hi, In my app a modal could pop up whenever a user enters a community and there isn't way to know which one they have been in before. I am currently using the exists? method but it seems to crash once in a while. Error: /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/ gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:24:in `until': timed out after 30 seconds, waiting for {:tag_name=a, :id=prompt_enter_as_admin_yes} to become present (Watir::Wait::TimeoutError) from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/ gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:80:in `method_missing' from /Users/josephfleck/Sites/within3/qa_automation/discussion/ add_multiple_discussion.rb:92 from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/ gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each' from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/ gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each' from /Users/josephfleck/Sites/within3/qa_automation/discussion/ add_multiple_discussion.rb:38 My code looks like this: #Enter as admin confirmation modal if $browser.div(:id,'enter_as_admin_confirmation_modal_content').exists? #Click Yes to be admin of community $browser.div(:id,'enter_as_admin_confirmation_modal_inner_content').link(:id, 'prompt_enter_as_admin_yes').when_present.click #Call wait with counter value w = 400 helper.wait_counter(w) end #if terms of use display if $browser.div(:id,'terms_of_use_modal_content').exist? #Click 'Accept' link on TOU $browser.link(:id,'accept_terms_of_use').click #Call wait with counter value w = 400 helper.wait_counter(w) end #if guidelines window displays if $browser.div(:id,'approve-community-guidelines').exists? guide_checkboxes = $browser.div(:class,'guidelines').div(:class,'guidelines').checkboxes puts guide_checkboxes.length guide_checkboxes.each do |checkbox| puts checkbox_loc = checkbox.id $browser.checkbox(:id,checkbox_loc).set end $browser.link(:class,'continue').click #Call wait with counter value w = 400 helper.wait_counter(w) end Is this the best practice for this scanerio? Thank you, Joe -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Watir 2.0.3 Released
Hi! Watir 2.0.3 has been released. This version has the following changes: * fix ElementCollections#[] * fix IE::Process.start for IE9 when opening multiple windows * add support for Spanish JavaScript and file upload dialogs * fix IE#execute_script for Ruby 1.9 with IE9 Install it with: gem install watir Jarmo -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] I need to retrieve multiple span class=discussion-title
Hi, I need to retrieve multiple discusion titles from a page. I just want the titles only and there can be 5 to 13 on a page with other links listed under them. I have tried the following and it will only return the first discussion title or all links: subject_lines = $browser.div(:class,'one_col_select').div(:id,'naph').div(:id,'discussion- board').span(:class,'discussion-title').links subject_lines.each do|link| puts title_name = link.text end Test Image Thu Oct 20 15:23:56 -0400 2011 subject_lines = $browser.div(:id,'discussion- board').span(:class,'discussion-title').links subject_lines.each do|link| puts title_name = link.text end Test Image Thu Oct 20 15:23:56 -0400 2011 subject_lines = $browser.div(:id,'discussion-board').links subject_lines.each do|link| puts title_name = link.text end Add * Test Image Thu Oct 20 15:23:56 -0400 2011 Matthew James Berman, MD Budget Management Government Relations Grants/Funding Read more 0 comments Add a comment * Check out this document Thu Oct 20 15:23:20 -0400 2011 Matthew James Berman, MD Budget Management Government Relations Read more DataFile.xls 0 comments Add a comment - in the above the * line is the only line I want for each listed on the page. subject_lines = $browser.div(:class,'discussion-meta-wrap').links subject_lines.each do|link| puts title_name = link.text end * Test Image Thu Oct 20 15:23:56 -0400 2011 Matthew James Berman, MD Budget Management Government Relations Grants/Funding HTML code: div id=community_resources_list_2161 class= dl id=theme-resource-list class=discussions-block list-page dt class=discussion-meta image-attachment div class=profile-pic a class=person-inline-profile title=NAPH Member Community href=http://0.0.0.0:3000/profiles/2/show_other_person? default_link=summary /div div class=discussion-meta-wrap span class=discussion-title a class=theme href=http://0.0.0.0:3000/channels/naph-member- community/navigational_categories/discussions/pages/topic/ categorized_resource/ImageAttachment/38Test Image Thu Oct 20 15:23:56 -0400 2011/a /span span class=dtposted span class=related-topics /div /dt dd class=discussion image-attachment div class=discussion-wrap div class=image-details a href=/channels/naph-member-community/image_attachments/38? theme_id=91 img class=image_thumbnail width=84 height=63 src=/attachments/ 38_thumbnail.jpg?1319138639 /a /div div class=discussion-body /div ul class=action-links /dd dt class=discussion-meta file-attachment div class=profile-pic div class=discussion-meta-wrap span class=discussion-title a class=theme href=http://0.0.0.0:3000/channels/naph-member- community/navigational_categories/discussions/pages/topic/ categorized_resource/FileAttachment/37Check out this document Thu Oct 20 15:23:20 -0400 2011/a /span span class=dtposted span class=related-topics /div /dt dd class=discussion file-attachment dt id=link_resource_34 class=discussion-meta link-resource I would appreciate any help on this. Thank you, Joe -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Browser(Chrome/Firefox) running in behind or invisible with Watir?
On Oct 20, 2:09 pm, Guoqiang Huang guoqiang_hua...@163.com wrote: Thanks for reminding, this is just for research purpose. And Facebook don't provide a data stream like Twitter. There's no concept of 'fair use' when it comes to terms of service, it's not like copyright, so 'research purposes' means nothing and grants you no special rights. Either use a service according to the terms, or don't and risk getting your account banned, IP blocked, etc. They might be more willing to grant written permission if it's for 'research purposes', but unless you get that permission, using pretty much any kind of automation against Facebook violates their ToS -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: retrieve drop list items/values
No need to be sorry, and I fully understand the 'revert to what I know' aspect of this when learning something new. So can you share some of the appropriate HTML for these tabs, and what you need to do with them? It may be that a for loop would be your best solution, but there might also be some much better ways around this. Ruby is really good about allowing you to easily iterate on arrays, hashes, arrays of objects, etc. and the latest versions of watir and watir-webdriver are great about being able to return collections of elements that have something in common, or from within some other element. For example if tabs are done as divs of a given class inside which are links, and they are all inside some other container, you can get all of them into a nice package via something like tabs = browser.div(:id, 'tabholder').divs(:class, 'tab') Then if you wanted to loop through and do something with each of those tabs, you could do something like tabs.each do |tab| puts tab.text tab.link.click assert browser.div(:id, 'group_title').text.contains? tab.text end See where I'm going? If you need the index of the element in the array, then you can use .each_with_index, and it will take care of all the index value overhead That could be useful if you just want to make an array out of something from each tab tabs.each_with_index do |tab, i| tab_titles[i] = tab.text tab_links[i] = tab.link.url end (those here better with Ruby than I, wack me if I got any of that wrong) On Oct 20, 6:48 pm, Joe Fleck joeflec...@gmail.com wrote: I know. Sorry. Here is what I am trying to accomplish. Our app has communities that professional members belong to so they can communicate with one an other. Within these communities there are tabs and the community could have 2 to 5 or even more showing. My test is to click on each one of them and make sure the user lands on the intended page. What I have done so far is retrieved the tab names from html list they are in. I have this hole process in a 'do loop' though when the script completes the first tab but blows up when it moves on to the next one. I feel if I put the array into a string then use the split method in Ruby I might be able to do a better job of control the outcome. I am a long time QTP developer so WATIR, ruby are very new to me. I have always used for...next statements in VBScript because I feel I can do a better job of control the script. I hope this helps. Thank you, Joe On Thu, Oct 20, 2011 at 4:49 PM, Chuck van der Linden sqa...@gmail.comwrote: um, you want to take something that is basically an array, cram it all into a comma separated string so you can use split to put it back into an array again? I'm really confused why you want to do things that way Perhaps if you were to explain exactly what it is that you are trying to accomplish (at a slightly higher level) we could suggest a best approach it is sort of a 'ruby language' type question, but since it's in the context of dealing with select list options and values, the answer is likely to be of value to the group. On Oct 20, 10:28 am, Joe Fl joeflec...@gmail.com wrote: How can take those values from the list and put them in a string so I can use the split method? the values from the list box are ACG GI Circle Advisory Board CDK Sandbox Advisory Board Sandbox AFCC Akron Children's Hospital Bayer Pulmonary Hypertension Community Better Health Greater Cleveland Board of Governors Case Western Reserve University - School of Medicine Alumni CHB Demo Children's Hospital Boston Children's Hospital Boston Alumni Association Satellite Community Children's Hospital Boston PPOC Online Community Covance Virtual Advisory Board Future Forum Future Forum Editorial Board GI Consultant Forum Janssen Advisory Board Forum Medical Affairs Leaders Forum NAPH Member Community I want to place them in a string called com_list with a comma between each value. I currently retrieve them by above code but it would a lot easier to work with them in a string. Thank you, Joe On Oct 19, 3:17 pm, Chuck van der Linden sqa...@gmail.com wrote: On Oct 19, 11:14 am, Joe Fl joeflec...@gmail.com wrote: Hi, I have figure it out. Code... names = $browser.select_list(:name,'communities').options community_names_arr = Array.new commuName = name_number = 0 names.each do |name| puts commuName = #{name_number}: #{name.text} name_number = name_number + 1 end this gives me the text to each option in the listbox. You might want to make use of .each_with_index to make your code a little easier and cleaner names = $browser.select_list(:name,'communities').options community_names_arr = Array.new commuName = names.each_with_index do |name, i| puts
[wtr-general] Re: I need to retrieve multiple span class=discussion-title
On Oct 21, 10:41 am, Joe Fl joeflec...@gmail.com wrote: Hi, I need to retrieve multiple discusion titles from a page. I just want the titles only and there can be 5 to 13 on a page with other links listed under them. I have tried the following and it will only return the first discussion title or all links: subject_lines = $browser.div(:class,'one_col_select').div(:id,'naph').div(:id,'discussion- board').span(:class,'discussion-title').links subject_lines.each do|link| puts title_name = link.text end Your problem is that you are telling it to get all the links from within a single span. I think what you need to do is get all the spans which contain those links, and then pull the link text, OR if the only links on the page are those of the class theme are the ones you want, then just go for the links directly If you can go after the links, then subject_links = $browser.links(:class, 'theme') subject_links.each do|link| puts link.text end If the links are not unique enough on their own, then unless there are other spans on the page with the discussion_title class that you don't want, you need to do something more along these lines subjects = $browser.spans(:class,'discussion-title') subjects.each do|subject| puts subject.link.text#presumes we want first link inside the span end -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: [Wtr-development] Watir 2.0.3 Released
Great! We should get money from Microsoft for all the work we've done to support IE9. Bret On Fri, Oct 21, 2011 at 10:55 AM, Jarmo jarm...@gmail.com wrote: Hi! Watir 2.0.3 has been released. This version has the following changes: * fix ElementCollections#[] * fix IE::Process.start for IE9 when opening multiple windows * add support for Spanish JavaScript and file upload dialogs * fix IE#execute_script for Ruby 1.9 with IE9 Install it with: gem install watir Jarmo ___ Wtr-development mailing list wtr-developm...@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-development -- Bret Pettichord Director, Watir Project, www.watir.com Blog, www.testingwithvision.com Twitter, www.twitter.com/bpettichord -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com