Re: [wtr-general] RubyMine with Watir, Cucumber, and Page objects
Chuck, I know Rubyists are usually scared off by the overhead, but I started using Aptana Studio (Eclipse geared toward Ruby - as a standalone or a plugin) with my new company, and I've been very impressed, especially since Eclipse can integrate with Assembla/Bugzilla/SVN/CVS/GIT/etc, etc, etc. And, it's free, which is always nice. On Friday, March 30, 2012 7:59:44 PM UTC-5, Željko Filipin wrote: On Sat, Mar 31, 2012 at 2:49 AM, Chuck van der Linden sqa...@gmail.com wrote: Does it just know about Watir, Cucumber, etc all on it's own? I do not think you have to do any setup. I think it scans the gems you have installed and tries to figure out what to do. Željko -- 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] Testing theory/approach question from SO
I posted this question on StackOverflow this afternoon and just wanted to get some more visibility on it for the folks that may not visit there as often. http://stackoverflow.com/questions/10035371/approach-for-watir-webdriver-coverage-on-site-with-many-clients/10035613#10035613 -- 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] Testing theory/approach question from SO
Thanks for the reply Oscar - I agree that it is a good, and simple approach. I suppose I'm just hoping to think of something with a little less overhead -- but if I don't, I will be happy with that approach. By the way, the pastie link that you shared is the page-object approach (taking an inventory of all page elements) - so as it turns out you ARE familiar with it, just not by that name! Thanks again, Adam On Thursday, April 5, 2012 4:58:51 PM UTC-5, Oscar.Rieken wrote: I would treat each client site as its own site (which it is really) and create a page class for each page they are similar but they all behave differently you could chop them all up into partials of each page or in taza you can do filtering (sorry I am not familiar with page-object) then you would just have to maintain the filtering for each site the more I think about it I am torn between making each site specificly(it has its advantages mainly the simplicity and knowing exactly how each site needs to act) OR I would define one master site and have each site include that master site and the elements on the pages that are specific for them this one could get kind of tricky keeping track of what site/page belongs to what and what fits where but its cooler :) for the forms i would just do something like this http://pastie.org/3735502 i cut out a lot but you get the idea On Thu, Apr 5, 2012 at 4:47 PM, Adam Reed reed.a...@gmail.com wrote: I posted this question on StackOverflow this afternoon and just wanted to get some more visibility on it for the folks that may not visit there as often. http://stackoverflow.com/questions/10035371/approach-for-watir-webdriver-coverage-on-site-with-many-clients/10035613#10035613 -- 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] Best practice for using Active Directory user/pass for script?
This started out as an encryption question, but it may end up being a testing best practice question. I have an application that is not customer-facing, so new accounts cannot be created. It uses personal Active Directory information, and we have no (nor are we allowed to obtain) test accounts for Active Directory. I have a personal account that can access the content to be tested, but I do not want my AD password to be easily obtained. I am using Jenkins to launch scripts so I can easily prompt the user for a password and store it in a variable to be used... but I know how easy it would be to then log these passwords to a flat file. I'd like to provide more security for coworkers if I'm setting up a system that accepts user input (instead of using my own as an encrypted master for the script). The test case is pretty standard - log in, assert a few features and functions and that's it. I looked into AES encryption thinking that I would encrypt the password manually and then take the encrypted string and paste it into a decrypt function in the script... but that function would obviously list the decryption keys so it's really only adding a step of obfuscation to the process of retrieving the password. What's the best practice for this scenario? Thanks, Adam -- 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: Best practice for using Active Directory user/pass for script?
Edit/Update: I have handled this in other cases by including a flat file in Subversion with the variable names for user/pass, but no user information. In order for the script to run, the user (me) has to add their credentials to the file and make sure not to check it back into Subversion once changes are made. Is that as good as it gets? On Nov 14, 10:55 am, Adam Reed reed.a...@gmail.com wrote: This started out as an encryption question, but it may end up being a testing best practice question. I have an application that is not customer-facing, so new accounts cannot be created. It uses personal Active Directory information, and we have no (nor are we allowed to obtain) test accounts for Active Directory. I have a personal account that can access the content to be tested, but I do not want my AD password to be easily obtained. I am using Jenkins to launch scripts so I can easily prompt the user for a password and store it in a variable to be used... but I know how easy it would be to then log these passwords to a flat file. I'd like to provide more security for coworkers if I'm setting up a system that accepts user input (instead of using my own as an encrypted master for the script). The test case is pretty standard - log in, assert a few features and functions and that's it. I looked into AES encryption thinking that I would encrypt the password manually and then take the encrypted string and paste it into a decrypt function in the script... but that function would obviously list the decryption keys so it's really only adding a step of obfuscation to the process of retrieving the password. What's the best practice for this scenario? Thanks, Adam -- 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: Need clarification
This is not a WATIR-related question. You will have better luck at a general Ruby forum. It sounds like Excel is not installed/registered on that machine. Thanks On Sep 12, 8:49 am, ss skbj...@gmail.com wrote: irbrequire 'win32ole' =true irbexcel = WIN32OLE::new(excel.Application) i get the error like win32olrruntimeError:unknownOLE Server:excel.application HRESULT ERRORCODE: invalid classstring from line 2 irb... How to clear that error.. In my office open office org calc used but i changed the save format like .xls but run in cmd prompt i get the error like this.. so,i need clarification ham on the right path or not.. Thanks in advance!.. -- 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: Post Requests
Mo, your question is not Watir-related as you have described it, so you may have better luck using another Google group. I have not personally used the net/http method (I use Mechanize or Watir/ Webdriver). Have you tried filling out the form and submitting it using Watir? Thanks, Adam On Aug 23, 11:06 am, Mohsen Qureshi mohsen...@googlemail.com wrote: Hi guys, I am wondering if anyone has any experience doing post requests. I am trying to automate a request without having much luck. I have HTML page which simulates the post for me, however I don't want to include this. Its very simple and works, however trying to do this using Ruby is proving a little difficult. Here is the HTML: htmlhead meta http-equiv=content-type content=text/html; charset=ISO-8859-1 /headbodyform name=input action=https://www.examplesite.com; method=post promotions code: input name=promotions_code value=X type=text input name='button' value=Submit type=submit /form /body/html I am trying to simulate this using net/http, and have come up with the following code: Net::HTTP.post_form(URI.parse('https://www.examplesite.com'), {'promotions_code' = 'X', 'button' = 'Submit'}) However I keep getting a BadResponse error. Im not too sure what the problem is here? Has anyone tried doing posts before, or can anyone see anything wrong with what I am doing? Thanks in advance Mo -- 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: should exist in a case statement
You will have better luck with support in the RSpec group, and honestly, but reading the RSpec manual/FAQ. You're confusing RSpec conventions with WATIR and mixing the two. http://old.nabble.com/rspec-users-f17460.html http://rspec.rubyforge.org/rspec/1.2.7/ On Aug 19, 10:23 am, Rahul Sharma rahulsharma@gmail.com wrote: Any suggestion on this folks? On 18 August 2011 15:29, Rahul Sharma rahulsharma@gmail.com wrote: ok. I also tried moving require 'rspec' to the environment file from the other file which I load after env.rb but that didn't help either. On Aug 18, 2:31 pm, Rahul Sharma rahulsharma@gmail.com wrote: Hi Guys, Just wondering what happens behind the scenes in case of should exist? I am trying to do the following: Class DepositSuccess def initialize(browser) @browser = browser verify_page_is_displayed end def verify_page_is_displayed case SITE_NAME when /abc/ messageA.should exist when /def/ messageB.should exist end # end case end end # class when i replace should exist with exists? it works. I agree I should not be asserting anything in the method but this is odd one out. The error I get is the following: undefined local variable or method `exist' for #Pages::DepositSuccess: 0x103d7fc18 (NameError) -- Before posting, please readhttp://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 -- Regards, Rahul Sharma Ph:+44 7800 736851 -- 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: Communicating Watir-Results
I use Cucumber, and have used RSpec and Test/Unit in the past - but I know what you mean about actually communicating the results. As far as I know none of these frameworks have email built-in. I have saved the output files from these frameworks to a network drive and/or docroot for a simple webserver and posted them that way. I have also used net/smtp with great success. One of our developers started using a few of my scripts to test performance in the Dev and QA environments, and to minimize the necessary interaction the script emails results to both of us whenever/wherever it runs. I'd be happy to send you an example if you'd like. Adam On Apr 27, 3:22 pm, Tim Koopmans tim.ko...@gmail.com wrote: Consider some form of CI like judson/jenkings perhaps? Put your scripts into a test framework that has reporting/test runners like rspec or cucumber? I use the Pony gem on linux for just about all my mailing needs ... On Thu, Apr 28, 2011 at 6:17 AM, Francisco Diaz Trepat - gmail francisco.diaztre...@gmail.com wrote: Hi guys I was planning to use net/smtp for communicating watir results. I need some guidance/recommendations for it. Is this ok? should I use something else? How could I send the stdout lines of text that are written when watir runs and fails or I do a puts? In other words, how would you notify on test faillures? f(t) -- Before posting, please readhttp://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 -- Cheers, Tim @90kts -- 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: Slow speed of filling of text area on watir-webdriver
Good to know! On Apr 21, 5:32 pm, Jari Bakken jari.bak...@gmail.com wrote: On Thu, Apr 21, 2011 at 8:33 PM, Adam Reed reed.a...@gmail.com wrote: Using text_area.value = string rather than text_area.set string has saved a significant amount of time for my scripts in massive-data- entry scenarios. Not so for watir-webdriver - they both use the same mechanism under the hood (which in some cases means native key press events). Jari -- 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: Slow speed of filling of text area on watir-webdriver
Using text_area.value = string rather than text_area.set string has saved a significant amount of time for my scripts in massive-data- entry scenarios. On Apr 21, 10:14 am, Jari Bakken jari.bak...@gmail.com wrote: On Thu, Apr 21, 2011 at 5:07 PM, the_zonker the.zonk...@gmail.com wrote: Environment: watir-webdriver 2.0.0 Ruby 1.9.2 Firefox 3.6, IE8 It's a good practice to always try the latest released version before reporting issues. watir-webdriver is currently at 0.2.2. I faced with a problem - I need to put a content of XML file into text area. The content is quite long and the process of filling is extremely slow. This slowness of filling causes a timeout error: How long is the string? WebDriver simulates native key presses on some platforms (like Windows), which may be slow. For putting value into text area I use: text_area.set(value) Are there any other ways to fill in text area more quick? I tried Javascript via execute_script method but JavaScript cannot handle XML content (probably because of quotes) as a valid element value. Using execute_script should work. If you could provide an example string where it doesn't work, I could probably help you out. Another approach is to do what a user would do: paste in the XML from the clipboard. If you have the XML content on the clipboard, you should be able to do that by sending Control-V: text_area.send_keys [:control, 'v'] Jari PS. The full list of keys you can send can be found here:http://selenium.googlecode.com/svn/trunk/rb/lib/selenium/webdriver/co... -- 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: Accessing an unordered list
Hi Anne, The reason you're getting that error is that you're using lis rather than li in your code. This is like saying browser.images, as in browser.images.each do |img|... To reach a singular element, you want to use the singular locator. Also, while you are certainly able to click on an li it looks like the element you're actually trying to access is a link (denoted by the anchor tag and href element: a href=). Unless there are multiple links on the page that have the exact same descriptors as this one, there is no reason to access the link's parent element. You may want to try this instead: browser.link(:href, /mystuff/my-topic).click browser.link(:text, My Topic Title).click Thanks, Adam On Apr 6, 5:35 pm, Keith Hughes khughe...@gmail.com wrote: Hi Anne, Have you tried browser.li(:id= abc/123,:index=1).click ? rgds Keith On Wed, Apr 6, 2011 at 9:49 PM, Anne annemordk...@gmail.com wrote: I've been doing automation for a while but am new to Ruby/Watir. I'm trying to access the first item in an unordered list and everything I try returns an Argument Error (wrong number of arguments (2 for 0)). I've been hitting my head against a wall for a day now and just can't seem to get it. Can you please help? the html looks like this: div id=searchResults div id=priorities div id=resultList ul li a id=abc/123 classsearchResult searchResultPreviewed href=/mystuff/my-topic My Topic Title /a /li +li +li /ul I'm trying to click on the first li item (which is one of many). I've tried: browser.lis(:id, abc/123).click browser.lis(:xpath, //a[id='abc/123']/).click browser.lis(:text, My Topic Title).click I also tried all these with .select instead of .click each time I've gotten ArgumentError: wrong number of arguments (2 for 0) I know I'm missing something basic. Can you point me in the right direction? Thanks! Anne -- Before posting, please readhttp://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] Re: checkbox questions
Cristina, You may find solutions faster by searching this group using the search box at the top of the page. Both topics have been addressed many times here. 1. ie.checkbox(:name = Checkbox).checked?returns true or false 2. There are a few methods to alter the checkbox value: ie.checkbox(:name = Checkbox).set (defaults to true) ie.checkbox(:name = Checkbox).set false ie.checkbox(:name = Checkbox).clear ie.checkbox(:name = Checkbox).click Thanks, Adam On Apr 4, 8:26 am, a b cristina.watir.toro...@gmail.com wrote: Hi, I have 2 questions: 1. How can I check the default value for a checkbox. Do we have any watir api. So I would like to check if a specific checkbox is enabled/desabled. 2. I encounter the following problem: I cannot enable/disable a checkbox. Here is just a part of the code. I wand to disable/enable the checkbox td span help=1 class=macstring string=servicesServices/span:/td td span style=display: inline; class=machidden machidden=create update mailbox hidden=inline span style= help=1 class=macstring string=pop3POP3/span:input id=__services_pop3 r=1 type=checkboxnbsp;nbsp;/span That is the watir code sleep 6 puts ... POP3 label test11 = @ff.div(:class = macblock).div(:id = maccontext).table(:index, 1)[10][2].span(:class = macstring, :string = pop3).text puts test11 sleep 10 test12 = @ff.div(:class = macblock).div(:id = maccontext).table(:index, 1)[10][2].checkbox(:id = __services_pop3).clear puts test12 @ff.div(:class = macblock).div(:id = maccontext).table(:index, 1)[10][2].checkbox(:id = __services_pop3).set sleep 10 Also I've attached a screen snapshot with the html source code and the ui. I'll appreciate any sugestion, Best Regards, Cristina checkbox.png 122KViewDownload -- 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: Java Developer - Technical/Product Job Opening - NYC,NY
I don't mind these every once in a while but this is the third I've received today. I have changed my stance on the topic to nuke without remorse. On Apr 4, 1:54 pm, Basim Baassiri ba...@baassiri.ca wrote: seriously, this is not a watir related question Please can you stop Thanks Basim On Mon, Apr 4, 2011 at 1:12 PM, Makro Tech makrotech@gmail.com wrote: Hi Dear Candidate, This is Vignesh with Makro Technologies, Inc. We have been in business for over 10 years and we are one of the Fast 500 National IT staffing and Solution firms in USA. Our clients include country’s top-notch IT, Healthcare, Pharmaceutical, Financial, Telecom,Government and other industries. Staying current with technology, finding great consultants and exceeding our clients' expectations are our primary objectives. Thanks for your time and attention to this e-mail. Please let me know if you have any candidates available, please find the Job description as mentioned below. *Job Titile: Java Developer - Technical/Product Duration: 1 Year Contract Location: NYC, NY* *Job Description:* • Development of projects supporting commission management tools. • Key responsibilities include development, testing, implementation, and support. • Key member who is part of the team that is involved in continuous improvement of processes, product development, product quality and technology • Successful candidate would take ownership of one of the key parts of application Skills • Highly experienced Java developer, with 4+ years of experience building multi-tier applications • Comfortable working on agile development projects, with frequent delivery of small incremental improvements • Strong web development skills, including expertise in using JavaScript and HTML. • Basic proficiency in Linux • Proven ability to communicate effectively at all organizational levels. Excellent listening, written, analytical, strategic and verbal communication skills. • Demonstrated development skills in a collaborative, team oriented style. • Unwavering commitment to Liquidnet’s Core Values • Strategic thinking and problem solving skills. • Preferred Qualifications/Skills • Experience with and knowledge of commission management products and instruments • Experience with Oracle, including PL/SQL • Experience building applications with Grails and Groovy Thanks *Vignesh *Sr Talent Acquisation Consulant Tel: 973-481-0100 Ext: 3069 Fax: 973 883 1488 Email: vignesh.renik...@makrohealth.com *Linkedin: **http://www.linkedin.com/in/vignesh1*http://www.linkedin.com/in/vignesh1 *For current openings please visit *http://jobs.makrotech.com/searchjobs.aspx * **Makro Technologies Inc.* www.makrotech.com Corporate Headquarters: New Jersey One Washington Park, Suite 1502, Newark, NJ 07102 *Other Offices:* Pennsylvania, Illinois, California ** Makro is a 3-time INC 5000 company for 2007/2008/2009 ** Makro is a 3-time FAST 50 firm in NJ for 2005/2006/2007 (by Deloitte) ** Makro is a 3-time FAST 500 firm in USA for 2005/2006/2007 (by Deloitte) -- Before posting, please readhttp://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] Re: how to access an element from a multi level nested div/ul/li
Cristina, you can copy/paste the relevant html here directly (with care to remove superfluous elements). If the div has an attribute that you can access (class, name, id), the nested list elements may not enter into it: browser.div(:how, what).text will grab all of the text in this div. Example: browser.div(:class, my-div-element).text. If you need a more specific locator, you will probably need to use XPath (http://wiki.openqa.org/display/WTR/XPath) to locate the item. Thanks, Adam On Mar 31, 10:35 am, a b cristina.watir.toro...@gmail.com wrote: Hi, please tell me the email address where I can send an attached file. Thanks, Cristina -- 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: Error on Watir installation
I ran into this issue yesterday when installing watir for two new users. We also were forced to upgrade to 1.8.7 (even though two of us had the same build of 1.8.6 and the same version of watir installed...). When attempting to install cucumber, we received another error about a gem being compiled for Ruby 1.9.1 which turned out to be JSON 1.5. We uninstalled JSON and reinstalled with gem install json -v 1.4.6 and this resolved all issues. It's always fun to install from scratch! On Mar 21, 8:54 pm, blkjk blkjk@gmail.com wrote: I had to also add System variable to environment path: RUBYOPT - rubygems Thk you. On Mar 21, 5:30 pm, Tim Koopmans tim.ko...@gmail.com wrote: I'd definitely recommend Ruby 1.8.7 over 1.8.6. It comes with a newer version of rubygems Check instructions athttp://watir.com/installationforlocation of binary Cheers, Tim @90kts On Tue, Mar 22, 2011 at 11:05 AM, blkjk blkjk@gmail.com wrote: That did not work either. :( On Mar 21, 4:11 pm, Tim Koopmans tim.ko...@gmail.com wrote: For the time being, install rubygems manually, I've been having similar trouble with firewatir and ubuntu http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.zip unzip rubygems-1.6.2.zip ruby rubygems-1.6.2/setup.rb Cheers, Tim @90kts On Tue, Mar 22, 2011 at 10:04 AM, blkjk blkjk@gmail.com wrote: on WIN7 with: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] gem install watir yields error: hoe requires RubyGems version 1.4 tried 'gem update --system', but no improvement I have installed successfully on other pcs w/ same, but failing here. Thoughts? -- Before posting, please readhttp://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 readhttp://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] Re: Managing multiple version of Watir
Also see pik for Windows (I believe it's linked from RVM's site as well): https://github.com/vertiginous/pik/ Adam On Mar 30, 1:23 pm, Tim Koopmans tim.ko...@gmail.com wrote: Rvm ? Regards, Tim Sent from my mobile ... On 31/03/2011, at 12:39 AM, Darryl Brown d-l-br...@roadrunner.com wrote: Hello All, We are currently using Git branches to manage multiple versions of Watir. Our base scripts were all created with 1.6.2 and we're transitioning to the newer versions and testing along the way. Start out with master branch that does that does not have Watir. Then from master, checkout -b 1.6.2; then 1.6.7, 1.7.0 etc. and install the versions. Now we can easily switch versions. My question - is there a different / better way to accomplish this? Thanks, Darryl -- Before posting, please readhttp://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] Re: Managing multiple version of Watir
I'll admit my reply was more of a response to the first comment than the original issue, but I would agree with the explicit versioning comment unless for some reason you wanted to uninstall your gem and install a specific version for each test: gem uninstall watir gem install watir -v 1.6.5 etc. On Mar 30, 1:58 pm, Dmitriy Korobskiy dkro...@gmail.com wrote: How about using Gem to specify explicit versioning, something along these lines: http://docs.rubygems.org/read/chapter/4 Just a thought... -- DK AIM: DKroot1, Skype: DKroot On 3/30/11 2:49 PM, Darryl Brown wrote: RVM is a Ruby version manager. I'm trying to find out if there is a better way to manage multiple versions of Watir. Using Git with a branch for each version is working. Are you guys suggesting that I should manage multiple instances of Ruby with each one having a unique version of Watir?? -or- am I missing something? Darryl On Mar 30, 2:32 pm, Adam Reedreed.a...@gmail.com wrote: Also see pik for Windows (I believe it's linked from RVM's site as well): https://github.com/vertiginous/pik/ Adam On Mar 30, 1:23 pm, Tim Koopmanstim.ko...@gmail.com wrote: Rvm ? Regards, Tim Sent from my mobile ... On 31/03/2011, at 12:39 AM, Darryl Brownd-l-br...@roadrunner.com wrote: Hello All, We are currently using Git branches to manage multiple versions of Watir. Our base scripts were all created with 1.6.2 and we're transitioning to the newer versions and testing along the way. Start out with master branch that does that does not have Watir. Then from master, checkout -b 1.6.2; then 1.6.7, 1.7.0 etc. and install the versions. Now we can easily switch versions. My question - is there a different / better way to accomplish this? Thanks, Darryl -- Before posting, please readhttp://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] Re: Automating the object with in TD tag
I think what you're looking for is a way to use Watir to attach to or investigate that TD element. You can find an exact example of that in the Watir Wiki using XPath: http://wiki.openqa.org/display/WTR/XPath puts ie.cell(:xpath, //i...@src='3.jpg']/../).text Adam On Jan 12, 9:28 am, Sanu ure...@gmail.com wrote: Hi, I have an object with TD tag with out any object type specified. That is actually a tag in the application. please find the HTML code below TR TD class=styleTabUnSelected id=S3Role #text SCRIPT and goes like this if i spy the tab i am getting the below Attributs, Name Value align left background-image(css) url(../images/AsTabBackMiddle.gif) class styleTabUnSelected= color(css) #00 cursor(css) pointer height 24 id S3Role onclick JavaScript:pushTab('S3Role'); onmouseout JavaScript:mouseOutTab('S3Role') onmouseover JavaScript:mouseOverTab('S3Role') style BACKGROUND-IMAGE: url(../images/ AsTabBackMiddle.gif); CURSOR: pointer; COLOR: #00 I am very new to Ruby kindly provide your ideas. -- 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: Option in select
Put a begin/rescue/end around the offending code and prevent the test from exiting. On Jan 5, 1:08 pm, Shlomit Gazit shlomitpatr...@gmail.com wrote: The problem is also if the title I am looking for doesnt exists I am getting an exception: Watir::Exception::NoValueFoundException: No option with :title of pop_instr_type in this select element C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/ input_elements.rb:87:in `select_item_in_select_list' and the test breaks. I cannot even check if it exists. On Dec 10 2010, 10:51 am, Super Kevy kpe...@scholarshipamerica.org wrote: Assume the page with the attributed options html head titleMyTest/title /head body hr form name=input action=html_form_action.asp method=get Username: input type=text name=user / Car Select: select name=cars title=head optionid=a2 title='One' value=volvoVolvo/option optionid=a3 title='Two' value=saabSaab/option optionid=a4 title='333' value=fiatFiat/option optionid=a5 title='444' value=audiAudi/option optionid=http://semanticweb.databaserepublic.com/c2p/systemData/ searchField#attachmentTargetItself value=341 title=true,Inner Search,^50$|^62$|^56$,attachmentTargetItselfAttachment::/option /select input type=submit value=Submit / /form /body /html This code will do two things. 1) Select theoptionby its title Example: ie.select_list(:name,'cars').select_item_in_select_list('title', 'Two') # Choose the Saab 2) Dump the html for the select_list into a striing you can parse Example: ans_txt = ie.select_list(:name,'cars').html.to_s Sample script require 'rubygems' require 'watir' ie = Watir::IE.new sUrl='C:\Ruby\Testing\KLP1.html' ie.goto(sUrl) ie.maximize() ie.bring_to_front() sleep 3 puts 'Tell me what theoptiontext is..' contents =[] contents = ie.select_list(:name, cars).getAllContents contents.each { |e| puts e.to_s } puts '='*30 puts ' Select theoptionvalue by title' ie.select_list(:name,'cars').select_item_in_select_list('title', 'Two') # Choose the Saab ## puts ' Can I see Attributes? for theoption?' #puts ie.select_list(:name,'cars').option(:text, 'Audi').attribute_value('title').to_s #This Does not Work!!! puts '-'*30 puts ' Show me all the html code for this select_list and I can parse myself' ans_txt = ie.select_list(:name,'cars').html.to_s puts ans_txt sleep 3 ie.close() puts 'Done' There seems to be no direct interface to get an attribute_value from anoptionin a select list. It shows a weakness in the select/options that might need a bug writeup -- 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: Can I run tests in IE and FF one by one in the one ruby script?
require 'watir' browsers = [ie, firefox] browsers.each do |b| Watir::Browser.default = b browser = Watir::Browser.new browser.goto url end This would work if you were looking to literally run both tests inside of one script, and could also involve multi-threading to run them simultaneous, however, I think the best approach is to put your browser selection in a the Watir YAML file and use a batch to set the default browser, run the test, edit the default browser and save the YAML file again, and then run the test(s) again. Create the file 'options.yml' with contents: # This file specifies options affecting all tests. # These options can also be set using environment variables prefixed with 'watir_ # These environment variables will override settings from this file. # 'ie' (Watir::IE) or 'firefox' (FireWatir::Firefox) browser: ie #browser: firefox # These options only affect IE. # speed options are fast, slow, and zippy speed: zippy #visible: false visible: true Include the following code in your script(s): Watir.options_file = 'options.yml' Now, whenever you change the default browser designation in your options.yml file, your scripts will use that browser. Hope that helps. Adam On Jan 3, 10:36 am, Oleg ol.shevche...@gmail.com wrote: Hi All. Please give me advice how can I run IE and FF tests in the one ruby script. I tried the following, but in the second part opens browser initialized firstly (IE in this example) require 'watir' Watir::Browser.default = 'ie' browser = Watir::Browser.new browser.goto url ... require 'firewatir' Watir::Browser.default = 'firefox' browser = Watir::Browser.new browser.goto url ... -- 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] OT: WIN32OLE and Word difficulty
I've worked with the win32ole library in my WATIR scripts for a long time, and I've just now stumbled onto a problem that I'm hoping some of you have also encountered. I have a script that reads from various Word file formats (doc, docx), however the documents that are being provided to me from our users have the text written in a Text Box rather than at the top level of the document. When I try to read document.Sentences or .Words, I get none of this text (just a special character representing the background image). I worked through the API and ole_methods and haven't found anything that seemed to work right yet. Have any of you had to access this type of object before? I've posted on StackOverflow but I know that a lot of you work with win32ole often, so I thought I'd bring some attention to it here. http://stackoverflow.com/questions/4419446/how-to-access-textbox-object-text-in-document-using-ruby-win32ole Thanks, Adam -- 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.url method
Xguarder, This works for me in 1.6.6. What version of Ruby are you using? Can we see your code? It sounds like you might be accessing a different browser variable than you are expecting. Adam On Oct 22, 11:08 am, xguarder shams...@gmail.com wrote: Hello, as of late, anything I run the $browser.url method, I keep getting an empty string returned. I know for sure this used to work. Any ideas as to why this method is no longer returning the proper value? Thanks in advance! -- 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: Automating command line tools
Try googling ruby ssh or ruby sftp. The first result on either search answers your question. On Sep 3, 8:43 am, Basim Baassiri ba...@baassiri.ca wrote: Watir stands for web application testing in ruby so I believe the answer to your question is no On Fri, Sep 3, 2010 at 9:04 AM, Srinidhi srinidhi...@gmail.com wrote: Hi All, Is it possible to automate command line tools like puttysftp or openSSH in ruby. Please let me know any way. :Sorry if i have posted it in wrong section. i have been asking this question everywhere now. -- Before posting, please readhttp://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.comwatir-general%2bunsubscr...@googlegroups.com -- 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: Need help with a text field inside a table (watir doesn't see any tables!)
Hi Wolfie, and welcome to Watir. How are you accessing the frames in conjunction with show_tables (exact command)? Thanks, Adam On Aug 24, 10:26 am, Wolfie ballard.wolf...@gmail.com wrote: Hello! - Using gem version 1.3.7, Ruby 1.8.7 and watir 1.6.5, IE8 on Windows 7 - HTML Snippet:http://codeviewer.org/view/code:1150 I've been using Ruby+Watir for a day now and I am stumped as to how to find the text field in the table from the above HTML (input type=text, name=cust_code) When i select the corresponding frame and do a p $ie.show_tables in irb, I get Found 0 tables - same for every frame in the page or just the page itself. Watir doesn't see any tables and I've tried a bunch of stuff with xpath but to no avail (xpath newbie as well) - any guidance would be much appreciated. -- 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: Need help with a text field inside a table (watir doesn't see any tables!)
It was a logical step, just wrong :). Glad you were able to figure it out. Adam On Aug 24, 11:29 am, Wolfie ballard.wolf...@gmail.com wrote: How are you accessing the frames in conjunction with show_tables (exact command)? Bingo - you asked the right question. I was doing the following $ie.frame(:name,frame1) $ie.show_tables and assumed that the tables shown are for the current frame $ie.frame(:name,frame1).tables gave me useful output $ie.frame(:name,frame1).text_fields.each { |t| puts t.to_s } gave me what I wanted Thank you sir - I be in your debt. Thanks, Adam On Aug 24, 10:26 am, Wolfie ballard.wolf...@gmail.com wrote: Hello! - Using gem version 1.3.7, Ruby 1.8.7 and watir 1.6.5, IE8 on Windows 7 - HTML Snippet:http://codeviewer.org/view/code:1150 I've been using Ruby+Watir for a day now and I am stumped as to how to find the text field in the table from the above HTML (input type=text, name=cust_code) When i select the corresponding frame and do a p $ie.show_tables in irb, I get Found 0 tables - same for every frame in the page or just the page itself. Watir doesn't see any tables and I've tried a bunch of stuff with xpath but to no avail (xpath newbie as well) - any guidance would be much appreciated. -- 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: Unable to see error message in ruby interpreter
Hi Goutham, It sounds like you're double-clicking the script in order to run it which closes the DOS window upon completion. If installed, you can execute the script using the SciTE editor. Right click on the script, select Edit. The output pane can be enabled using F8 if it is not shown. Alternatively, you can open a DOS prompt and browse to the location of the script you would like to run. Execute the script from the command line, and the DOS window will not close. Good luck, Adam On Aug 16, 10:46 am, goutham goutham.mand...@gmail.com wrote: Hi all, I am new to watir ,I am trying to find element using xpath but i could not and one more issue is that i couldnot see the error message what it is returning as ruby interpreter is getting closed how to see the error messages returned during execution Thankyou, Goutham -- 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: How I can catch the JS errors?
Well, the easiest method would be to discover the JS error content manually, and disable the options in your browser for stopping on errors, and/or displaying the contents of JS errors during browsing. Automation isn't always the best solution. Otherwise, Jarmo has a great function for discovering and taking screenshots of JS errors on his blog/github: http://itreallymatters.tumblr.com/ On Jul 29, 9:48 am, carmen3lia eliaol...@gmail.com wrote: The application has a few JS errors and when I run the script, it is stopped because the erors, How I can catch the errors and the script can follow executing. I'm using Internet Explorer 7 and 8 -- 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: How I can do double click on a Cell
Can you provide the error message with line number and the rest of the script? The error does not appear to be generated by the code that you posted. Thanks On Jul 28, 2:52 pm, carmen3lia eliaol...@gmail.com wrote: I am not able to do double click on a Cell, this I have ie.cell(:xpath,/html/body/div/div/div[2]/div[2]/div[2]/div/div/ div[2]/div/div[2]/div/div/div[2]/div/div[17]/table/tbody/tr/ td[2]).fire_event(ondblclick) The following error is displayed undefined method `toString' for nil:NilClass -- 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: Firewatir attach method doesn't work properly
I'm not sure why that happens with the parent window, but you should be able to attach back to the parent: ff = FireWatir::Firefox.attach(:title, Parent Window) Thanks, Adam On Jul 26, 6:07 am, Amit Kumar amit.e...@gmail.com wrote: Hi All! I'm using Firewatir 1.6.5 I want to test an web application which open a pop up window. I want to attach this pop up window with firewatir. So, i have written below code: require 'firewatir' ff =FireWatir::Firefox.new ff.goto(www.example.com) ff.link(:text,Pop_up).click ff2= FireWatir::Firefox.attach(:title,New Pop Up Window) Now, the problem is... After attaching new pop up window, firewatir loose control over parent window. It remember only pop up window which have attached recently and forget parent window. So, i can't access parent application anymore. eg: puts ff.title == New Pop Up Window puts ff2.title == New Pop Up Window It doesn't return window title of parent window. Any comments or solution?? Thank You -- 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: Redo the last command
My first approach would be to resolve why the application is not loading completely or call it a 'failure' and talk to you developers or network architects... Another approach would be to check to see if the last visible element on the page has loaded (whatever element is missing 100% of the time when the page doesn't finish loading), and if it does not exist, @browser.refresh. Adam On Jul 13, 5:23 am, Shlomit Gazit shlomitpatr...@gmail.com wrote: Is there any way to redo the last command of the test? The problem is that sometimes I see that in my application the page is not loading completely so I need to refresh the page. I was thinking as a solution to check for a certain word every page load, and if the word doesn't appear, the page will be refreshed. The problem is that I need to redo the last command that was running, for example that an anchor will be open. Any idea? Shlomit -- 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: Launching Report At End of Test
Joe, Since the report is a basic .html file, you can open/view/launch it just like any other web content. You could launch a browser and supply the browser.goto command with the file name you defined earlier (from the tutorial): @report = @html.createReport('google_search', 'Google Search', browser_type) As I understand it, this should create a file named google_search.html. So that you don't have to repeat this code for each script you create, you'd want your report name set as a variable that you can access later. Obviously there's a lot of exception handling and validation you would want to add, but here's an idea of how you could handle it: - test.rb report_name = google_search # path_to_report = C:/Logs/#{report_name}.html @report = @html.createReport(report_name, 'Google Search', browser_type) #FROM TUTORIAL !-- code code code -- !-- code code code -- @html.finishReport(@report, browser_type, test_environment) #FROM TUTORIAL view_report(path_to_report) - includes.rb def view_report(report) @report_browser = Watir::Browser.new @browser.goto report end #view_report On Jul 2, 5:53 pm, Joe Touhey joetou...@gmail.com wrote: Hi, I am using the report class athttp://wiki.openqa.org/display/WTR/HTML+report+class+%28version+2%29. What I would like to do is launch the report that I created during my test at the end of the test. Can someone give me a hand with the code to do this? Have a great day, Joe Touhey -- 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: Automating omniture tags
I also use an Excel data file to generate an array for testing, but my method for detection is a bit different: There are a couple of custom functions that you won't be able to see, but their names should let you know what their purpose is. def check_omni $browser.goto http://www.domain.com#{$url}; html = $browser.html.to_s code1 = 's.pageName=' + $pageName + '' code2 = 's.channel=' + $channel + '' code3 = 'var s_code=s.t' begin assert_match(code1, html) assert_match(code2, html) assert_match(code3, html) log_success(Does Omniture Code exist for #{$url}?) rescue log_failure(Does Omniture Code exist for #{$url}?) end #begin end #check_omni On Jun 11, 4:33 am, Wesley Chen cjq@gmail.com wrote: Expect the file attached can kind of help you. Wesley. For life, the easier, the better. On Fri, Jun 11, 2010 at 5:29 PM, Wesley Chen cjq@gmail.com wrote: First, you have to prepare a xls file, in the file, in the file, the data is your expected data, the format is as below: s.pageName Home Page s.channel s.prop3 x Please write a method, get all the data from xls out into an array/hash A; Second, you have to capture all the sc value out from the page source, suppose the value is actual_sc_values. *actual_sc_values = ie.html.scan(/s\..*/)* The comment can capture all the s. out into an array, you can make it an array or a hash B. Then, you just need compare A to B. Do you think so? Wesley. For life, the easier, the better. On Fri, Jun 11, 2010 at 2:58 PM, Marlon marlonmoja...@gmail.com wrote: Ah ok, sorry I over looked this one, yes it is implemented using javascript Example: script type=text/javascript language=JavaScript s.pageName = Home Page; s.channel = Home Page; s.prop3 = Home Page; s.prop34 = No; s.eVar18 = No; /script Can you show me a sample script for checking this? -- Before posting, please readhttp://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.comwatir-general%2bunsubscr...@googlegroups.com DOC-239744.htm 117KViewDownload -- 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: Automating omniture tags
Marlon, Can you tell me how the Omniture tags are being implemented if not in the html source? That would help me in considering an approach. My company uses Omniture but because the flags show up in the source, I just have to do pattern/text matching to verify values. Thanks, Adam On Jun 9, 8:15 pm, Marlon marlonmoja...@gmail.com wrote: Is there a way to automate omniture tags (ex. Load Events, Props, Evars)? I would like to check if it has the correct values. I notice that these are not present on the html source. Can get these values using Wasp or Omnibug Please help Thanks -Marlon -- 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: Automating omniture tags
#2 - is it possible the source you're looking at is only for a single frame/iframe, and not the section that contains the Omniture information? Adam On Jun 10, 1:36 pm, Adam Reed reed.a...@gmail.com wrote: Marlon, Can you tell me how the Omniture tags are being implemented if not in the html source? That would help me in considering an approach. My company uses Omniture but because the flags show up in the source, I just have to do pattern/text matching to verify values. Thanks, Adam On Jun 9, 8:15 pm, Marlon marlonmoja...@gmail.com wrote: Is there a way to automate omniture tags (ex. Load Events, Props, Evars)? I would like to check if it has the correct values. I notice that these are not present on the html source. Can get these values using Wasp or Omnibug Please help Thanks -Marlon -- 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: click on link now working in watir
Naresh, How does it 'not work'? Are you receiving an error? What _does_ it do when it is run? If you click on the link, the page should automatically go to URL (just as if you clicked a link manually). Your 'goto' statement is superfluous. Also, the semi-colons at the end of each line are unnecessary. The '#' on the 4th line is in the wrong position if you're trying to comment out that line. Thanks, Adam On Jun 9, 5:17 am, naresh nareshvatsa...@gmail.com wrote: Hi All, I am new to watir, in watir script i have written code to click on link and then go to specified page. But clicking on link is not working.Link is of type s:link seam framework in xhtml page. l am using JSF, Jboss Seam and Richfaces. I have pasted my code below . ie.link(:id, globalForm:customfieldCategoriesLink).click; puts 'link clicked' ie.goto(http://localhost:8080/admin/customfield-categories.seam;) i#e.bring_to_front; #ie.maximize; Regards, Naresh Vatsal -- 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: get value from password type text-field
I just tried this on a login page, and @browser.text_field(:id, / pwd/).value gave me the correct/expected text. It appears that you are setting your password field id descriptor with a variable(?), is it possible you're accessing the wrong element? Make sure to try $ie.text_field(:name, WpaPswdConfirm).value first, to ensure that the basic functionality is working before your introduce complication. Thanks, Adam On Jun 3, 7:58 pm, kashyap kashyap...@gmail.com wrote: Hi all, I am testing(using Watir) a web-form that has many text fields in it.One of the text-fields is a password type text field. The text-field's HTML is: INPUT class=stdbox type=password maxLength=64 onchange=IsAlphaNumericOrSet( this.value, g_PswdSetChars, 'Confirm Password', this.title) name=WpaPswdConfirm value= / The requirement is to check if the default password that is there on the text-field is a valid password or not. For this i need to get the value from that text-field. I tried the follwowing: passwordValue = $ie.text_field(:id, idPassword).value However, passwordValue has a value 1 in it.It is not giving me the exact value of the password. Is there any other way to retrieve the value from a text-field that is of type password? -- 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: How to create a file and save it.
I agree with Jason, and I would also recommend Everyday Scripting with Ruby/Marick - great book for scripters that know more about WATIR than they do about Ruby. http://pragprog.com/titles/bmsft/everyday-scripting-with-ruby On Jun 3, 8:30 am, Jason Trebilcock jason.trebilc...@gmail.com wrote: Watir is really a tool for interacting with web applications. For what you want to do, you may want to rephrase the question as being Ruby-specific and not related to Watir. Further, you may want to invest a little time researching your problem. There are plenty of resources available to help you solve this problem. An initial hint is to google for 'ruby creating text file'. After that, once you have some code, you may want to reach out to a Ruby mailing list for further help. But, note that when you do reach out for help, there is going to be an expectation that you have specific questions that you're not able to solve rather than a blanket request for help. On Thu, Jun 3, 2010 at 7:28 AM, meaculpa harismah...@gmail.com wrote: I need to create a text file and save it using watir. How is it possible. Can anybody help ? -- Before posting, please readhttp://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.comwatir-general%2bunsubscr...@googlegroups.com -- 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: How to create a file and save it.
With respect, file manipulation is a basic feature of Ruby. WATIR is a testing library/tool that makes use of the basic built-in Ruby functionality. That is the distinction that is being made. In your case, you would need to design a way to locate the Order Id, temporarily assign that value to a variable, open or create a text file, and finally write this value to the file. Which step in that process are you having difficulty coding? Thanks, Adam On Jun 3, 9:17 am, meaculpa harismah...@gmail.com wrote: Its WATIR specific only. And This is not a blanket request for help. Everyone in this forum are having experience and they are not just NOOBS. So they can surely understand what i mean... Also After googling only I post here... I believe this group is mainly for helping each other than creating specific rules !!! I accept that my question was little. My actual problem is : From a webpage I get a Order Id. I want to save that in a notepad. I googled and didnt find any help. -- 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: text_filed validation - onchange alert window
Exactly what I came to post; You're too fast Željko! On May 27, 3:04 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, May 27, 2010 at 7:14 PM, kashyap kashyap...@gmail.com wrote: I want to get a handle of that popup and verify the text on the alert window and hit on OK button. Did you read this? http://wiki.openqa.org/display/WTR/Pop+Ups Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi -- 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: canxth element
I popped the OP's code into a simple html page and Željko's approach worked great. If the content in the third element might change (and not literally say something as friendly as Three), here's a more robust approach: MyCells = Array.new browser.cells.each do |cell| # If looking for a specific table, browser.table(:class, /testing/).cells.each do |cell| if cell.id == zippy # Assuming you only want the cells with this id MyCells [cell.id, cell.text] else end #if end #cells.each MyCells.last # Grab the last element MyCells[2] # Grab the third element Of course, if all you need is simple functionality, go with simple code! -Adam On May 6, 10:08 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, May 6, 2010 at 4:58 PM, tjp kris...@gmail.com wrote: td id=zippyOne/td td id=zippyTwo/td td id=zippyThree/td How do I refer to the third one? Not tested, but should work: browser.cell(:text = Three) or browser.cell(:id = zippy, :text = Three) Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com -- 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: canxth element
I popped the OP's code into a simple html page and Željko's approach worked great. If the content in the third element might change (and not literally say something as friendly as Three), here's a more robust approach: MyCells = Array.new browser.cells.each do |cell| # If looking for a specific table, browser.table(:class, /testing/).cells.each do |cell| if cell.id == zippy # Assuming you only want the cells with this id MyCells [cell.id, cell.text] else end #if end #cells.each MyCells.last # Grab the last element MyCells[2] # Grab the third element Of course, if all you need is simple functionality, go with simple code! -Adam On May 6, 10:08 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, May 6, 2010 at 4:58 PM, tjp kris...@gmail.com wrote: td id=zippyOne/td td id=zippyTwo/td td id=zippyThree/td How do I refer to the third one? Not tested, but should work: browser.cell(:text = Three) or browser.cell(:id = zippy, :text = Three) Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com -- 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: time loop
Rufus looks neat for building it in... If you're looking for something external and are using Windows, you can create a Scheduled Task and point it to the .rb file you'd like to run. If using RSpec, you can create a batch file (.bat) with your spec command line text and schedule that batch file to run, also. On May 5, 1:36 pm, Shlomit Gazit shlomitpatr...@gmail.com wrote: How can I create a loop for a test to run every 15 minutes? -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com -- 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] OT: Is anyone else at Star East this week?
Thought this might be a good opportunity to put faces with names if anyone else is attending the conference in Orlando! Adam -- 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: how ruby kill the powerpoint app
What are you trying to accomplish? Rather, why does the Quit() function not work for you? You may have better luck asking in the Ruby group: http://groups.google.com/group/ruby-talk-google Thanks, Adam On Apr 19, 10:21 am, arihan sinha arihan.si...@googlemail.com wrote: Hi, Is there any way to kill the powerpoint application through ruby apart from ppt.Quit() ppt = WIN32OLE.new('PowerPoint.Application') ppt['Visible'] = true doc = ppt.ActivePresentation slidecount = doc.Slides.Count doc.Close() ppt.Quit() -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com -- 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
[wtr-general] Re: watir exit code
I can't say if the approach you're using is viable or not because I'm not clear on your intended goal, but if you're trying to get just the number after SystemExit try: $variable = $variable.split(SystemExit)[1] If I knew what test framework you were using, I could probably offer an easier way to fail a test and send an email. For test/unit: begin assert_match(/testing/, @browser.text) (actions for PASS go here) rescue = e (actions for FAIL/error go here) end #begin On Apr 14, 5:22 pm, Shlomit Gazit shlomitpatr...@gmail.com wrote: Somehow #{$!.class} prints as: SystemExit1 or SystemExit0, which is the opposite than what I see on the console in Irb: Exit code: 0, Error code: 1. In any case I need only the numbers 1 or 0 without the word SystemName, any idea? I wrote a script to send email if the test is failing. For now I am setting variable to 0 when initializing the test, and 1 at the end of the test, if it is not failing, the variable is set to 1. But I prefer to not depends on that. On Apr 14, 2:00 pm, Ethan notet...@gmail.com wrote: as Charley said, watir does not exit, itself. If you want to know if an exception occurred causing your program to exit, you can check if the global exception variable, $! is set. at_exit do if $! print an exception occurred of type #{$!.class} end end or something along those lines. On Wed, Apr 14, 2010 at 16:36, Charley Baker charley.ba...@gmail.comwrote: Watir itself doesn't have an exit code, it's just a library. Are you talking about your own testing framework, rspec, test::unit? Those generally can set exit codes. My question is what are you trying to do? Set it up in a CI run? Something else entirely? -c On Wed, Apr 14, 2010 at 2:30 PM, Shlomit Gazit shlomitpatr...@gmail.comwrote: Is there a method to use watir exit code (0 or 1)? I want to know that if it is 0 to do something at_exit. Thank you, Shlomit. -- Before posting, please readhttp://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, reply using remove me as the subject. -- Before posting, please readhttp://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 -- 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
[wtr-general] Re: Error in IRB: LoadError: no such file to load -- watir
Not to further hammer the point here, but I've found that this message board has provided MANY helpful how-to's and JIRA bugs for WATIR. When an issue is discovered that has not been discussed previously, someone always asks the original poster to update the Wiki or log a JIRA bug. So, now that you've isolated this issue, adding it to the Wiki will save everyone else who stumbles across it the troubleshooting time, and the merry cycle continues. I absolutely understand the frustration with some open source products, but I've always felt Watir's documentation (and more so its community) to be very helpful, which is also why I feel even more encouraged to respond to posts here more than other groups when I do have something useful to add. -- 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, reply using remove me as the subject.
[wtr-general] Re: ajax and unable to locate element
If you'd like to be a little more exact in your approach, instead of using sleep you could wait_until the element exists. http://wiki.openqa.org/display/WTR/How+to+wait+with+Watir On Apr 8, 11:45 am, Sal Jamil salem.m.ja...@gmail.com wrote: I added a sleep(5) after the fire_event and Watir was able to find the new field: b.radio(:id, entryModeManual).fire_event(onclick) sleep(5) b.text_field(:name, 'order_ref[1]').set('OE123') Thanks for the help On Thu, Apr 8, 2010 at 12:24 PM, Sal Jamil salem.m.ja...@gmail.com wrote: Thanks. I tried that using IRB and I got There are 0 frames BUT Watir did not have a problem locating the new input field using IRB but it still throws the same Exception running the test from a file. I am going to google further on this issue. Thanks again. On Thu, Apr 8, 2010 at 12:12 PM, windy lyfi2...@sina.com wrote: please open irb, try 'browser.show_frames' maybe it's in a frame, so you can't get it . hope it's useful. 在 Thu, 08 Apr 2010 11:26:55 +0800,Sal Jamil salem.m.ja...@gmail.com 写道: I am sorry, it is not available on the web. I can give you the source of the page but it references a lot of libraries and server code that I am not sure it will be helpful. Thanks for your help. On Wed, Apr 7, 2010 at 11:09 PM, Rats crapats...@yahoo.com.au wrote: On Apr 8, 2:59 pm, Sal Jamil salem.m.ja...@gmail.com wrote: I just tried that and I am getting the same error. Is this page published on the web? If so then please provide a URL so we can have a look at it. It is very strange that firebug displays the element name yet Watir cannot find it. I've never had this problem ... -- Before posting, please readhttp://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, reply using remove me as the subject. -- Before posting, please readhttp://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 -- Sal Jamil • ephicax President Desk (650-585-2198)sal.ja...@ephicax.com This transmission may contain information that is intended to be confidential and solely for the use of ephicax, and those persons or entities to whom it is directed. It is not to be reproduced, retransmitted, or in any other manner distributed. If you received this message in error, please delete it from your system. -- Sal Jamil • ephicax President Desk (650-585-2198)sal.ja...@ephicax.com This transmission may contain information that is intended to be confidential and solely for the use of ephicax, and those persons or entities to whom it is directed. It is not to be reproduced, retransmitted, or in any other manner distributed. If you received this message in error, please delete it from your system. -- 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
[wtr-general] Re: Component focus issues on different computers
You're selecting the first element in a drop down box? If not, can you please provide a little bit more info on exactly what you're interacting with? ie.select_list(:id, /Request_Salutation_I/).set First Value Name Thanks, Adam On Apr 5, 6:40 pm, Rats crapats...@yahoo.com.au wrote: On Apr 6, 8:42 am, Rats crapats...@yahoo.com.au wrote: I'm having some issues with setting focus to fields on different computers. I scripted some stuff over the weekend on my home computer where I set focus to a field and then did some send_keys on the field. This worked perfectly however on my work computer the same .focus command sets focus to the browser URL field instead of the desired component. I'm using the following command: ie.text_field(:id, Request_Salutation_I).focus ie.send_keys({DOWN}) Basically this just sets the salutation field on a request form to the first value. Sorry forgot to mention if I run the two individual commands via command line then they work fine. It's only when run as part of a script that they are failing. Really weird. :-( -- 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, reply using remove me as the subject.
[wtr-general] Re: Confused about array declaration failure (rspec, watir)
Thanks guys, that makes sense. I'm definitely focusing too much on the new element (RSpec) and too little on the basic architecture! On Mar 3, 7:18 am, Ethan notet...@gmail.com wrote: You're defining the @countries instance variable outside of any method. You're making @countries an instance variable of whatever 'self' is in the describe block (which appears to be a class or a module), which is not the same thing that your methods are being called on (presumably an instance of that class or a class including that module). If you want 'countries' to be the same across all instances of the class, use a class variable. If you want it to be the same throughout the program, use a global. If it should be per-instance, use an instance variable defined in some method of the class (#initialize, most likely). On Tue, Mar 2, 2010 at 16:11, Adam Reed reed.a...@gmail.com wrote: This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). In a nutshell, the script goes to a static page, collects the links, visits each linked page and verifies an item - it has been significantly dumbed down for the purpose of this question and I have tested this simplified version to make sure it gives the same output. Can someone help me understand why my array here (@countries) is not recognized? I tried to instantiate it as a global variable ($countries) and it still was not recognized. Is it an issue with my organization/format, or something else? Again, if I explicitly describe an array in place of the variable, the script works . global_page_spec.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/example_helper' describe The country page for do include ExHelper before(:all) do setup collect_global_countries end �...@countries.each do |name, link| describe name do it should contain the word #{name} in the title do �...@browser.goto link �...@browser.div(:id, /content-content/).text.should include(name) end #it end #desc end #countries after(:all) do teardown end #after end #spec example_helper.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/global_helper' module ExHelper include GlobalHelper def setup �...@browser = Watir::Browser.new �...@browser.add_checker lambda {|b| b.text.should_not include('The requested page could not be found.')} end # setup def collect_global_countries �...@countries = Array.new �...@countries.should be_empty �...@browser.goto http://www.#{$env}.com/global; �...@browser.table(:class, /global-list/).links.each do |link| �...@countries [link.text, link.href] end #links �...@countries.should_not be_empty def teardown �...@browser.close end # teardown end #module The Error: global_page_spec.rb:12: undefined method `each' for nil:NilClass (NoMethodError) from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `module_eval' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `subclass' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:55:in `describe' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_factory.rb:31:in `create_example_group' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/dsl/main.rb: 28:in `describe' from global_page_spec.rb:4 -- 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.comwatir-general%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- 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: Confused about array declaration failure (rspec, watir)
Solution for documentation: not everything has to go inside a describe block. Create/collect the array before any describe methods. @Array = [...] or Method to collect array data @array.each do |name, stuff| describe name do it should put the lotion in the basket do code end end end On Mar 3, 9:12 am, Adam Reed reed.a...@gmail.com wrote: Thanks guys, that makes sense. I'm definitely focusing too much on the new element (RSpec) and too little on the basic architecture! On Mar 3, 7:18 am, Ethan notet...@gmail.com wrote: You're defining the @countries instance variable outside of any method. You're making @countries an instance variable of whatever 'self' is in the describe block (which appears to be a class or a module), which is not the same thing that your methods are being called on (presumably an instance of that class or a class including that module). If you want 'countries' to be the same across all instances of the class, use a class variable. If you want it to be the same throughout the program, use a global. If it should be per-instance, use an instance variable defined in some method of the class (#initialize, most likely). On Tue, Mar 2, 2010 at 16:11, Adam Reed reed.a...@gmail.com wrote: This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). In a nutshell, the script goes to a static page, collects the links, visits each linked page and verifies an item - it has been significantly dumbed down for the purpose of this question and I have tested this simplified version to make sure it gives the same output. Can someone help me understand why my array here (@countries) is not recognized? I tried to instantiate it as a global variable ($countries) and it still was not recognized. Is it an issue with my organization/format, or something else? Again, if I explicitly describe an array in place of the variable, the script works . global_page_spec.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/example_helper' describe The country page for do include ExHelper before(:all) do setup collect_global_countries end �...@countries.each do |name, link| describe name do it should contain the word #{name} in the title do �...@browser.goto link �...@browser.div(:id, /content-content/).text.should include(name) end #it end #desc end #countries after(:all) do teardown end #after end #spec example_helper.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/global_helper' module ExHelper include GlobalHelper def setup �...@browser = Watir::Browser.new �...@browser.add_checker lambda {|b| b.text.should_not include('The requested page could not be found.')} end # setup def collect_global_countries �...@countries = Array.new �...@countries.should be_empty �...@browser.goto http://www.#{$env}.com/global; �...@browser.table(:class, /global-list/).links.each do |link| �...@countries [link.text, link.href] end #links �...@countries.should_not be_empty def teardown �...@browser.close end # teardown end #module The Error: global_page_spec.rb:12: undefined method `each' for nil:NilClass (NoMethodError) from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `module_eval' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `subclass' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:55:in `describe' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_factory.rb:31:in `create_example_group' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/dsl/main.rb: 28:in `describe' from global_page_spec.rb:4 -- 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.comwatir-general%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- 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
[wtr-general] Confused about array declaration failure (rspec, watir)
This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). In a nutshell, the script goes to a static page, collects the links, visits each linked page and verifies an item - it has been significantly dumbed down for the purpose of this question and I have tested this simplified version to make sure it gives the same output. Can someone help me understand why my array here (@countries) is not recognized? I tried to instantiate it as a global variable ($countries) and it still was not recognized. Is it an issue with my organization/format, or something else? Again, if I explicitly describe an array in place of the variable, the script works . global_page_spec.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/example_helper' describe The country page for do include ExHelper before(:all) do setup collect_global_countries end @countries.each do |name, link| describe name do it should contain the word #{name} in the title do @browser.goto link @browser.div(:id, /content-content/).text.should include(name) end #it end #desc end #countries after(:all) do teardown end #after end #spec example_helper.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/global_helper' module ExHelper include GlobalHelper def setup @browser = Watir::Browser.new @browser.add_checker lambda {|b| b.text.should_not include('The requested page could not be found.')} end # setup def collect_global_countries @countries = Array.new @countries.should be_empty @browser.goto http://www.#{$env}.com/global; @browser.table(:class, /global-list/).links.each do |link| @countries [link.text, link.href] end #links @countries.should_not be_empty def teardown @browser.close end # teardown end #module The Error: global_page_spec.rb:12: undefined method `each' for nil:NilClass (NoMethodError) from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `module_eval' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `subclass' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:55:in `describe' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_factory.rb:31:in `create_example_group' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/dsl/main.rb: 28:in `describe' from global_page_spec.rb:4 -- 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: Switching from Test::Unit to RSpec - tips/gotchas? Short code review.
I'm at it again! Having some trouble completing an RSpec script with a pretty simple concept -- mostly having trouble with the hierarchy of it all. Basically, I have a single page with many links. Each link points the same type of template with a different title. The script stores these links to an array, visits each page and verifies that it contains the correct title. That's the easy part. However with RSpec, I'd like each different link to be it's own headline/describe function for the HTML report -- each page should have it's own NAME page should contain the word name in the title, etc. Here is what I have so far, that obviously does not work: describe Page with links do before(:all) do setup @browser.goto page end #before.all it should contain a table with links do @browser.table(:class, /example/).links.each do |link| @countries [link.text, link.href] end #links @countries.should_not be_empty end #it @countries.each do |name, link| it should contain the word #{name} in the title do @browser.goto link @browser.div(:id, /example/).text.should include(name) end #it end #...@countries after(:all) do teardown end #after end #describe That made me think that I'd need something more like what is below, but I need to instantiate the browser and created the @countries array, and this script did not like having two describe blocks... I'm getting pretty confused! (this seems correct, I just don't know where to put it in the script!) @countries.each do |name, link| describe name do it should contain the word #{name} do @browser.goto link @browser.div(:id, /whatever/).text.should include(name) end #it end end #each With Test::Unit, I would simply use the following, but again, I'm not trying to conform to RSpec-type output here: def test_01_example page_links Array.new @browser.goto page @browser.links.each do |link| page_links [link.text, link.href] end #page.links.each page_links.each do |title, url| @browser.goto url assert(@browser.contains_text(title)) end #page_links.each end #def Can someone please sort me out? -- 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: Switching from Test::Unit to RSpec - tips/gotchas? Short code review.
Thanks Jarmo! There are a lot of similarities between this format and what I was previously doing with Watir, as well as some good new information. I think learning the new material for RSpec put a stimga of sorts on the organization and these replies definitely cleared a few things up for me. Adam On Feb 25, 10:58 am, Jarmo Pertman jarm...@gmail.com wrote: I'm answering into the group directly - maybe someone else finds this also useful. Think of the helpers as a collection of methods which will be used throughout the tests. You could do many modules. Some modules would be specific to your current application under test and some others would be even more global. So if you start testing some new web application then there are already some modules which you can include and then use those methods from there. In addition you can create a separate module for this project which has it specific methods. So, your idea below is almost correct, but think about it as a hierarchy. Let's say that you have 2 software projects going on - ProjectOne and ProjectTwo. So, i would do something like this: global_helper.rb - this is at some globally accessible place on the filesystem: # put here also all global requires require 'watir' require 'spec' # you may require also this, since some IDE-s allow you to run specs then with their formatter module GlobalHelper def global_method_one # do something end def global_method_two # do something else end end project_one_helper.rb - this is located under ProjectOne: # make sure that you've handled the $LOAD_PATH so you can do like this: require 'global_helper' module ProjectOneHelper include GlobalHelper def project_one_method # do something specific to project_one end end project_two_helper.rb - this is located under ProjectTwo: # make sure that you've handled the $LOAD_PATH so you can do like this: require 'global_helper' module ProjectTwoHelper include GlobalHelper def project_two_method # do something specific to project_two end end project_one_spec.rb - so, now in some ProjectOne test you just have to do like this: require 'project_one_helper' describe something in ProjectOne do include ProjectOneHelper # you don't have to include GlobalHelper anymore since it is already included it does something do global_one_method project_one_method end end And something similar goes to ProjectTwo specs. So, that's how you can keep your code modularized and hopefully follow the practices of DRY (http://en.wikipedia.org/wiki/Don't_repeat_yourself). But when coming back to your concrete example, then i'd suggest you to read about RSpec Matchers (http://rspec.rubyforge.org/rspec/1.3.0/ classes/Spec/Matchers.html). So, let's say that you are dealing with ProjectTwo, then i would do it something like this - project_two_helper.rb: require 'global_helper' module ProjectTwoHelper include GlobalHelper def setup @browser = Watir::Browser.new @browser.goto http://url.com; end def header @browser.div(:id = 'header') end def has_correct_header? header.text.should == 'this is the header' end end and in project_two_spec.rb: require 'project_two_helper' describe ProjectTwo do before :all do setup end it has header do should have_correct_header end end There are some other nifty tricks in RSpec, but i can just recommend you to read RSpec book (http://www.pragprog.com/titles/achbd/the-rspec- book - i haven't read it myself though) or just wander around in it's RDochttp://rspec.rubyforge.org/rspec/1.3.0/ Jarmo On Thu, Feb 25, 2010 at 5:28 PM, Adam Reed reed...com wrote: Jarmo, Thank you very much for your insightful reply. You definitely addressed my weak point with Rspec right now which is the test organization and structure (modules vs. other constructs). I will certainly subscribe to your RSS feed! I was wondering if I might be able to ask you one more questions here. I've read about RSpec and have Google searched for a few of these topics, but was not able to find much help. Learning Watir was definitely a trial-and-error exercise a few years ago, so I'd like to get a better start with RSpec without having to go back and redesign everything because of early mistakes! In the specific test that I'm writing, for instance, I want to verify some global elements -- that the page does not show an error (as you described in your reply to my thread), that the footer exists and is correct, that the header exists and is correct, etc. All pages and all tests need to include these. At this point, I'm not sure how to handle those global tests -- my first inclination was shared_methods/helpers, but it appears that I would be better served by a module contained in a separate script that can be required and included in each other script. Would
[wtr-general] Re: Ruby array question
Reposting my favorite approach from comp.lang.ruby google group (http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ 7405cd6c99bea121#): class Array def indexes_of(obj) indexes = Array.new self.each_with_index {|s,i| indexes i if s === obj } return indexes end end textlist = [Apple, Orange, Lemon, Grape, Orange, Melon,Orange, Banana] p textlist.indexes_of(Orange) #= [1,4,6] -- Luc Heinrich - l...@honk-honk.com On Feb 25, 9:36 am, xguarder shams...@gmail.com wrote: Question about an array. Say I have the following array... textlist = [Apple, Orange, Lemon, Grape, Orange, Melon, Orange, Banana] if I did textlist.index(Orage), I would get 1 returned. Can anyone tell me how I could retrieve the index number of the 2nd instance of Orange? Thanks in advance! -- 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] Switching from Test::Unit to RSpec - tips/gotchas? Short code review.
We have a new project starting up that I think presents a good opportunity to try out Rspec. I've gone through a lot of the documentation over the years and have begun to create the first couple of tests without test/unit. I know that Bret and others have used Rspec extensively, and I was wondering if there are any tips or pitfalls that would be helpful to know when starting out. Here is a short example of a location search that I'm working with for critique: require 'watir' require 'spec' describe Locator search results do before(:each) do @browser ||= Watir::Browser.new @browser.goto(http://www.##.com;) end #before shared_examples_for all pages do it should behave like all pages do @browser.text.should_not include('Page could not be displayed') end describe for Ontario search do it_should_behave_like all pages it should return Los Angeles, CA catalog do @browser.div(:id, /example/).text.should include('Los Angeles') end #desc ontario describe for San Marcos, TX search do it_should_behave_like all pages it should return Austin, TX catalog do @browser.div(:id, /example/).text.should include('Austin') end #desc San Marcos describe for Dallas, TX search do it_should_behave_like all pages it should return Dallas, TX catalog end #desc San Marcos after(:each) do @browser.close unless @browser.nil end #after end #Locator search results -- 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: Switching from Test::Unit to RSpec - tips/gotchas? Short code review.
Thanks Željko! 1. I used the require 'spec' so that I could execute the script in SciTE to check for simple errors before running spec from the command line. To your point, I will make sure not to include it on future scripts. 2. Agree with you on the before(:all)/(:each) - I'm still figuring out how that works practically in my tests. What is this? @browser ||= Watir::Browser.new 3. I actually took that from the RSpec example here: http://wiki.openqa.org/display/WTR/RSpec I hate to admit that I implemented it without knowing exactly what it did, but in testing it did not seem to change behavior. I have not used it with any other scripts but this first venture into RSpec. On Feb 24, 10:01 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: Hi, Comments are inline. On Wed, Feb 24, 2010 at 4:51 PM, Adam Reed reed.a...@gmail.com wrote: require 'spec' You do not need this. Execute tests with `spec search_spec.rb` and it just works. before(:each) do �...@browser ||= Watir::Browser.new �...@browser.goto(http://www.##.com;) end #before after(:each) do �...@browser.close unless @browser.nil end #after Why are you opening and closing the browser for every test? I would do it something like this: before(:all) do @browser = Watir::Browser.new end #before before(:each) do @browser.goto(http://www.##.com;) end #before after(:all) do @browser.close unless @browser.nil end #after What is this? @browser ||= Watir::Browser.new Should it be just this? @browser = Watir::Browser.new Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - podcasts on software testing. all of them -- 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: Switching from Test::Unit to RSpec - tips/gotchas? Short code review.
Thanks Željko! 1. I used the require 'spec' so that I could execute the script in SciTE to check for simple errors before running spec from the command line. To your point, I will make sure not to include it on future scripts. 2. Agree with you on the before(:all)/(:each) - I'm still figuring out how that works practically in my tests. What is this? @browser ||= Watir::Browser.new 3. I actually took that from the RSpec example here: http://wiki.openqa.org/display/WTR/RSpec I hate to admit that I implemented it without knowing exactly what it did, but in testing it did not seem to change behavior. I have not used it with any other scripts but this first venture into RSpec. On Feb 24, 10:01 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: Hi, Comments are inline. On Wed, Feb 24, 2010 at 4:51 PM, Adam Reed reed.a...@gmail.com wrote: require 'spec' You do not need this. Execute tests with `spec search_spec.rb` and it just works. before(:each) do �...@browser ||= Watir::Browser.new �...@browser.goto(http://www.##.com;) end #before after(:each) do �...@browser.close unless @browser.nil end #after Why are you opening and closing the browser for every test? I would do it something like this: before(:all) do @browser = Watir::Browser.new end #before before(:each) do @browser.goto(http://www.##.com;) end #before after(:all) do @browser.close unless @browser.nil end #after What is this? @browser ||= Watir::Browser.new Should it be just this? @browser = Watir::Browser.new Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - podcasts on software testing. all of them -- 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