[wtr-general] Re: Need file_field assistance
Hey Jarmo, Thanks for the reply Here is the error I am getting. It is a timeout error with RAutomation. timed out after 60 seconds (RAutomation::WaitHelper::TimeoutError) It happens sporadically through out the script. Thanks for the ENV variable. Let me try this and get back to you to see if it works. --Enrique On Aug 12, 8:41 am, Jarmo Pertman jarm...@gmail.com wrote: Does it fail for you consistently or does it handle some of the file fields and then fail? Do you see any error messages after some period of time (default is 60 seconds)? Try to use AutoIt adapter to see if that makes any difference. Add this line before your #file_field.each line: ENV[RAUTOMATION_ADAPTER] = :autoit Jarmo On Aug 11, 11:58 pm, watirboy enrique.j.ma...@gmail.com wrote: Hey Everyone Before the inclusion of rautomation in WATIR 1.9 I was able to do the following without much of a problem file = File.expand_path(File.dirname(__FILE__) + '/files/ testdoc.doc').gsub!('/','\\') browser.file_fields.each do |file_field| file_field.set(file) end There was a page with a set of fields that we looped through. For some reason the Open dialog box gets stuck and kills the rest of the test suite. Does anyone have a suggestion for a work around or a new way of doing this? Is this a known bug withing WATIR and rautomation? Thank you for your help. -- 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] Need file_field assistance
Hey Everyone Before the inclusion of rautomation in WATIR 1.9 I was able to do the following without much of a problem file = File.expand_path(File.dirname(__FILE__) + '/files/ testdoc.doc').gsub!('/','\\') browser.file_fields.each do |file_field| file_field.set(file) end There was a page with a set of fields that we looped through. For some reason the Open dialog box gets stuck and kills the rest of the test suite. Does anyone have a suggestion for a work around or a new way of doing this? Is this a known bug withing WATIR and rautomation? Thank you for your help. -- 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: Watir 1.8.0 final is out!
Has this been tested on Ruby 1.92? On Feb 28, 4:39 pm, Charley Baker charley.ba...@gmail.com wrote: Hello all, I've pushed the 1.8.0 final gems for watir and firewatir into the pipeline. Feel free to test it out and submit any challenges you might have. The biggest change for this release is dropping the ActiveSupport library for Firefox: more notes on that are at the bottom of this mail. Major kudos to Jarmo for pushing that out. The full Changelog is available athttp://github.com/bret/watir/blob/master/CHANGES Make sure your local gem system is up to date. gem update --system Depending on what you're using, either watir or firewatir: gem install (fire)watir Note: If you're installing on Mac or Linux you'll want to use firewatir for the gem install. ...and give it a go. Try to use it with your existing test suites and so on to see if there are any issues. *Problems/Questions? * If there are any problems then: 1) Fix it and send a pull request on Github, our main github repo:http://github.com/bret/watir This is the preferred way of accepting patches, we're happy to work with you on how to do this, github also has extensive docs on how to fork and submit a pull request. 2) Add it to our JIRA tracker:http://jira.openqa.org/browse/WTR If you need help with that let us know. *More information about the removal of ActiveSupport: * We have removed the activesupport gem as a dependency for Firewatir. This means that if you are using it's convenience methods for things like dates as Jarmo mentions below or a boatload of other nice methods which are listed in the docs:http://as.rubyonrails.org/http://www.google.com/url?sa=Dq=http://as.rubyonrails.org/ be aware that we are no longer installing this as a dependency. It was a hefty dependency for a few simple methods in Firewatir and caused problems with versioning, 2.8.x vs 3.0.x, differing Rails versions that people might have as well as different versions of Ruby. You're now free to use whatever version of Activesupport you want by a simple gem install, and if you uninstall Watir but leave whatever version of AS you have installed, if you are actually using methods from it, then your tests will continue to work exactly the same. Despite the fact that AS is extremely large and most people not using Rails only need a small portion of the methods, I do like it and would recommend checking it out. It does work better as an application dependency vs a library dependency. Charley Baker Lead Developer, Watir,http://watir.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: Multithreading WATIR Script
Hey Zeljko, Thanks for the new view of how I can do this. As MJP mentioned, I am trying to stress test concurrency issues on our system. I will look into this solution and get back to you guys. Thank you! On Jan 27, 3:51 pm, MJP michael.pet...@rfsuny.org wrote: Hi Zeljko, Very good points. Maybe the OP can respond more specifically to your questions and his requirements. On your second point - ' 2) If yes, are you aware of the fact that you can never be sure that something happened at the *exactly* same time?' - I agree. With this type of scenario we are usually testing that the system's queue (or connection pool, or whatever...) is functioning as expected. We want to sync the requests up close enough to force the system's queue through it's paces, and possibly force error handling. So instead of trying to get two request sent at *exactly* the same time, I would try for a higher number of requests sent *about* the same time. Regards, MJP On Jan 27, 4:12 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Jan 26, 2011 at 5:59 PM, watirboy enrique.j.ma...@gmail.com wrote: The test is to see if a generated unique id can collide with our system (example, I write a note and save it, the unique ID would be 0001.pdf. if i have two people trying to save at the same time, will both get 0001.pdf or will we get two different ids, 0001.pdf and 0002.pdf.) I do not think you need threads at all. Are you trying to do something in the *exactly* same time? 1) If not, then just open two browsers and do what you need: browser1 = Watir::Browser.new browser2 = Watir::Browser.new # do something with browser1 # do something with browser2 2) If yes, are you aware of the fact that you can never be sure that something happened at the *exactly* same time? Ž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] Re: Multithreading WATIR Script
Hey Zeljko, I am trying to throw up two IE processes utilizing Ruby's threading mechanism so I can run concurrent tests. I was trying to use the same test method for both threads, but when I run it only one instance of IE comes up instead of both threads. The test is to see if a generated unique id can collide with our system (example, I write a note and save it, the unique ID would be 0001.pdf. if i have two people trying to save at the same time, will both get 0001.pdf or will we get two different ids, 0001.pdf and 0002.pdf.) Thanks :) On Jan 26, 3:56 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Jan 25, 2011 at 7:11 PM, watirboy enrique.j.ma...@gmail.com wrote: Here is my situation. The user has a portal that they can enter data. Once this data is entered, our back end system generates a unique ID for the PDF Image associated with this data. The issue at hand is that sometimes this unique ID is generated for two separate sets of data. I do not understand the problem. What are you trying to do? Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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] Multithreading WATIR Script
Hey Guys, I read the solution here: http://groups.google.com/group/watir-general/browse_thread/thread/86488f3bcf641f4/c0dbd194a23cca8b?lnk=gstq=multithreading#c0dbd194a23cca8b and for some odd reason it is not working at all. Here is my situation. The user has a portal that they can enter data. Once this data is entered, our back end system generates a unique ID for the PDF Image associated with this data. The issue at hand is that sometimes this unique ID is generated for two separate sets of data. Here is what I have so far... {code} require 'rubygems' require 'watir' require 'yaml' require 'thread' include Watir def create_data $HIDE_IE=false browser = Watir::Browser.new browser.speed = :zippy config = YAML::parse(File.open(File.dirname(__FILE__) + '/../../ config.yml')).transform user = config['employee']['user'] pass = config['employee']['pass'] site = config['employee']['site'] browser.goto site browser.text_field(:name, 'txtuser').set(user) browser.text_field(:name, 'txtpwd').set(pass) browser.button(:name, 'btnlogin').click browser.text_field(:name, 'txttitle').set(JUNK) browser.text_field(:name, 'txtcomment').set(JUNK) browser.button(:name, 'btnsubmit').click browser.button(:name, 'btnhistory').click linkloc = browser.link(:text, /New Data/).link_string_creator pdffile = linkloc[0].split('/').last puts 'new Data PDF is: ' + pdffile browser.close end threads = [] 2.times do threads Thread.new {create_data} end threads.each {|x| x.join} {/code} When I run this, only one instance of IE comes up. What am I doing wrong? Any help would be greatly appreciated... :) -- 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: Multithreading WATIR Script
Hey Dave, Thanks for the reply. The original script works great (pretty much a copy and past from an existing WATIR Unit Test). I am using IE 8 on a Windows XP Machine. It doesnt seem like both threads are coming up (just the first one...) On Jan 25, 3:22 pm, Dave McNulla mcnu...@gmail.com wrote: When I have trouble with tailoring something that is new to me, I step backward to the original and make sure that worked before I made changes. In that thread, the suggestion is to run the unit test. Maybe you can try that to see if you get success there. If the original doesn't work, then you may have another issue to deal with. BTW, browsers have changed a little since 2008. Maybe that has something to do with it. My IE creates a separate process for each thread. Are you getting multiple threads? Which version of IE are you using? Good luck, Dave On Jan 25, 1:11 pm, watirboy enrique.j.ma...@gmail.com wrote: Hey Guys, I read the solution here: http://groups.google.com/group/watir-general/browse_thread/thread/864... and for some odd reason it is not working at all. Here is my situation. The user has a portal that they can enter data. Once this data is entered, our back end system generates a unique ID for the PDF Image associated with this data. The issue at hand is that sometimes this unique ID is generated for two separate sets of data. Here is what I have so far... {code} require 'rubygems' require 'watir' require 'yaml' require 'thread' include Watir def create_data $HIDE_IE=false browser = Watir::Browser.new browser.speed = :zippy config = YAML::parse(File.open(File.dirname(__FILE__) + '/../../ config.yml')).transform user = config['employee']['user'] pass = config['employee']['pass'] site = config['employee']['site'] browser.goto site browser.text_field(:name, 'txtuser').set(user) browser.text_field(:name, 'txtpwd').set(pass) browser.button(:name, 'btnlogin').click browser.text_field(:name, 'txttitle').set(JUNK) browser.text_field(:name, 'txtcomment').set(JUNK) browser.button(:name, 'btnsubmit').click browser.button(:name, 'btnhistory').click linkloc = browser.link(:text, /New Data/).link_string_creator pdffile = linkloc[0].split('/').last puts 'new Data PDF is: ' + pdffile browser.close end threads = [] 2.times do threads Thread.new {create_data} end threads.each {|x| x.join} {/code} When I run this, only one instance of IE comes up. What am I doing wrong? Any help would be greatly appreciated... :) -- 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: Help with select_no_wait
Thanks Jarmo...I dont know why I didnt even look at this! I feel like a dunce Everyone on this group is the best!!! On Jan 20, 7:34 am, Jarmo Pertman jarm...@gmail.com wrote: Maybe this post helps you to avoid the popup:http://watir.com/2011/01/14/testing-webpages-with-javascript-popups-c... Jarmo Pertman - IT does really matter -http://www.itreallymatters.net On Jan 18, 9:44 pm, watirboy enrique.j.ma...@gmail.com wrote: Hey Jarmo, When my script selects an option, a javascript pop-up shows up. WATIR is stuck at this point, and cannot move since it is waiting for something in the list element (possibly closing said pop-up). Do you have another idea? I tried throwing a thread up with AutoIt, but for some odd reason it wasnt working... On Jan 18, 1:53 pm, Jarmo Pertman jarm...@gmail.com wrote: It should be probably in the SelectList class. But why do you need it anyway? Can't you solve the problem somehow differently? Jarmo Pertman - IT does really matter -http://www.itreallymatters.net On Jan 17, 11:34 pm, watirboy enrique.j.ma...@gmail.com wrote: Hey Guys, I have been reading up on possibly patching my WATIR installation with a select_no_wait function (similar to click_no_wait) but I have no idea where I should place this. When I put it in lib/watir/element.rb I get the following error: Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:1157 Loaded suite C:\code\watir\scripts\testcase Started E Finished in 9.582906 seconds. 1) Error: test_01(TestCase): NoMethodError: undefined method `eval_in_spawned_process' for #Watir::IE:0x3dccc98 C:/ruby/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/element.rb: 358:in `select_no_wait' C:\code\watir\scripts\testcase.rb:55:in `test_01' 1 tests, 0 assertions, 0 failures, 1 errors and this is the code I entered: module Watir class Element # ... the rest of Element code above here... def select_no_wait(item) assert_enabled highlight(:set) object = #{self.class}.new(self, :unique_number,#{self.unique_number}) @page_container.eval_in_spawned_process(object + .select('#{item}')) highlight(:clear) end end end -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Displaying text from RegEx
Hey, thanks Charley! I'll try it out today and tell you how it worked, and if I have to use XPATH I'll also update and explain how I got there... --Enrique On Dec 9, 3:09 pm, Charley Baker charley.ba...@gmail.com wrote: :class should work as well to identify the table, if the text you're getting from tables has the same class attribute. It's a bit hard to read, but then you want to pull the text from the cell, which is easy: foo.table(:class, 'box3')[1][1].text something like that and then parse the text that's returned. Are you able to get that far? Let me know how far you can get. Worst case scenario, you could use xpath, I'm not a huge fan and can't give you examples, but you can look that up as well. hth, Charley Baker Lead Developer, Watir,http://watir.com On Thu, Dec 9, 2010 at 1:01 PM, watirboy enrique.j.ma...@gmail.com wrote: Just to clarify, I am trying to get the number next to XYZ in the HTML and echo it out. On Dec 9, 2:58 pm, watirboy enrique.j.ma...@gmail.com wrote: Due to security purposes, I stripped out any identifying info from tags and either just deleted it or replaced it with lorem ipsum (only one part has that). There were no names or ids on any of the tags, and all that i left was class. Thanks for the help :) html body table tr td form name=main method=post table tr td /td /tr tr td /td /tr tr class=box3 /td td /td td /td td font /fontbr font /fontbr font /fontbr /td td font /fontbr input name= type=hidden value= font /fontbr input name= type=hidden value= font /font/br input name= type=hidden value= /td /tr /table div /div table class=box1 tr td /td /tr /table /body/html table tr td table tr td h6/h6 /td /tr tr td hrbr/td /tr /table table class=box3 tr td p font size=2Lorem Ipsum XYZ123456.BRLorem Ipsum.BRLorem Ipsum/fontBRbrinput type=button name=new value=New onclick=javascript: window.location.href=''; /p /td/tr /table br table tr td iframe src=.../iframe /td /tr /table br /td /tr /table /center /div /form /td /tr table tbody tr td font br /font font hr /font br a href=font /font/a font . /font a href=font /font/a font /font /td /tr tr td font/font /td /tr tr td iframe src=.../iframe /td /tr /tbody /table
[wtr-general] Displaying text from RegEx
Odd situation. The developers at my site are using legacy code that is screwed up HTML. Basically for my WATIR script I need to echo out the next 6 characters after the string I am searching for. Usually I would just dig deep into the TD cells, but they are all jumbled. Does anyone have any idea how I can do this? Normally I would just RegEx the IE Contains, but I need to make sure that it displays after the wording. In my real world example, I need to look for the company's name (XYZ) and grab the generated digits after it: After creating a policy for XYZ Corporation, the generated number on the page is: XYZ123456987 I need to grab the number after XYZ No hidden inputs, and the priority on fixing this is low for this customer. -- 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: Displaying text from RegEx
Due to security purposes, I stripped out any identifying info from tags and either just deleted it or replaced it with lorem ipsum (only one part has that). There were no names or ids on any of the tags, and all that i left was class. Thanks for the help :) html body table tr td form name=main method=post table tr td /td /tr tr td /td /tr tr class=box3 /td td /td td /td td font /fontbr font /fontbr font /fontbr /td td font /fontbr input name= type=hidden value= font /fontbr input name= type=hidden value= font /font/br input name= type=hidden value= /td /tr /table div /div table class=box1 tr td /td /tr /table /body/html table tr td table tr td h6/h6 /td /tr tr td hrbr/td /tr /table table class=box3 tr td p font size=2Lorem Ipsum XYZ123456.BRLorem Ipsum.BRLorem Ipsum/fontBRbrinput type=button name=new value=New onclick=javascript: window.location.href=''; /p /td/tr /table br table tr td iframe src=.../iframe /td /tr /table br /td /tr /table /center /div /form /td /tr table tbody tr td font br /font font hr /font br a href=font /font/a font . /font a href=font /font/a font /font /td /tr tr td font/font /td /tr tr td iframe src=.../iframe /td /tr /tbody /table /table /body /html On Dec 9, 2:17 pm, Charley Baker charley.ba...@gmail.com wrote: Can you give a snippet of the mangled html? I'm sure there's a way to find it. Cheers, Charley On Thu, Dec 9, 2010 at 12:13 PM, watirboy enrique.j.ma...@gmail.com wrote: Odd situation. The developers at my site are using legacy code that is screwed up HTML. Basically for my WATIR script I need to echo out the next 6 characters after the string I am searching for. Usually I would just dig deep into the TD cells, but they are all jumbled. Does anyone have any idea how I can do this? Normally I would just RegEx the IE Contains, but I need to make sure that it displays after the wording. In my real world example, I need to look for the company's name (XYZ) and grab the generated digits after it: After creating a policy for XYZ Corporation, the generated number on the page is: XYZ123456987 I need to grab the number after XYZ No hidden inputs, and the priority on fixing this is low for this customer. -- 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
[wtr-general] Re: Displaying text from RegEx
Just to clarify, I am trying to get the number next to XYZ in the HTML and echo it out. On Dec 9, 2:58 pm, watirboy enrique.j.ma...@gmail.com wrote: Due to security purposes, I stripped out any identifying info from tags and either just deleted it or replaced it with lorem ipsum (only one part has that). There were no names or ids on any of the tags, and all that i left was class. Thanks for the help :) html body table tr td form name=main method=post table tr td /td /tr tr td /td /tr tr class=box3 /td td /td td /td td font /fontbr font /fontbr font /fontbr /td td font /fontbr input name= type=hidden value= font /fontbr input name= type=hidden value= font /font/br input name= type=hidden value= /td /tr /table div /div table class=box1 tr td /td /tr /table /body/html table tr td table tr td h6/h6 /td /tr tr td hrbr/td /tr /table table class=box3 tr td p font size=2Lorem Ipsum XYZ123456.BRLorem Ipsum.BRLorem Ipsum/fontBRbrinput type=button name=new value=New onclick=javascript: window.location.href=''; /p /td/tr /table br table tr td iframe src=.../iframe /td /tr /table br /td /tr /table /center /div /form /td /tr table tbody tr td font br /font font hr /font br a href=font /font/a font . /font a href=font /font/a font /font /td /tr tr td font/font /td /tr tr td iframe src=.../iframe /td /tr /tbody /table /table /body /html On Dec 9, 2:17 pm, Charley Baker charley.ba...@gmail.com wrote: Can you give a snippet of the mangled html? I'm sure there's a way to find it. Cheers, Charley On Thu, Dec 9, 2010 at 12:13 PM, watirboy enrique.j.ma...@gmail.com wrote: Odd situation. The developers at my site are using legacy code that is screwed up HTML. Basically for my WATIR script I need to echo out the next 6 characters after the string I am searching for. Usually I would just dig deep into the TD cells, but they are all jumbled. Does anyone have any idea how I can do this? Normally I would just RegEx the IE Contains, but I need to make sure that it displays after the wording. In my real world example, I need to look for the company's name (XYZ) and grab the generated digits after it: After creating a policy for XYZ Corporation, the generated number on the page is: XYZ123456987 I need to grab the number after XYZ No hidden inputs
[wtr-general] Re: WatirRecorder being forked and resurrected.
Hey Charley, Thanks for the heads up. I will monitor this thread closely and try to move the conversation over to a new group. I talked to Scott and he gave me his blessing, and since I got it out of the OpenQA SVN I figured it's gotta be under some OSI Compliant license. The Ruby version of the recorder (from hence forth called Scrapper) is under BSD so I placed the source code under that as well. Again, Thanks for the help. This is the first time I am leading a forked project, so I apologize for placing this here. --Enrique On Dec 2, 4:16 pm, Charley Baker charley.ba...@gmail.com wrote: Hey Enrique, Good work. We generally have an anti-recorder philosophy for Watir, and for any issues/user support you might want to resurrect WatirRecorder lists or set up a new one. I'm assuming you've talked to Scott about this as well? I don't know what the original license was. People will have questions about it, and I'd recommend you monitor this group and gently redirect to the group specific to the recorder. There's more historical information in the group about why we choose not to support recorders, which I'd recommend taking a look at. Also you may want to blog a bit about your intentions and the inherent dangers in recorders. Without going into too much detail, most of which you'll find through a quick search, I'm more inclined to rename it and consider it a potential scraper, not recorder. hth, Charley Baker Lead Developer, Watir,http://watir.comOn Thu, Dec 2, 2010 at 9:53 AM, watirboy enrique.j.ma...@gmail.com wrote: Hey Guys, I dont know how else to tell people about this, and I hate promoting it, but I have recently resurrected the WatirRecorder that Hanselman did back in the day. It is updated to use more modern WATIR standards and calls a config.xml file for template changes. http://code.google.com/p/watirrecordersharp/ I would love the community to play, test, break, and contribute if possible. This is a first release, and I am planning on changing the UI from utilizing SandBar and SandDock to WPF. Again, any help will be tremendous. It's a great tool and I would hate to see it die... --watirboy -- 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] WatirRecorder being forked and resurrected.
Hey Guys, I dont know how else to tell people about this, and I hate promoting it, but I have recently resurrected the WatirRecorder that Hanselman did back in the day. It is updated to use more modern WATIR standards and calls a config.xml file for template changes. http://code.google.com/p/watirrecordersharp/ I would love the community to play, test, break, and contribute if possible. This is a first release, and I am planning on changing the UI from utilizing SandBar and SandDock to WPF. Again, any help will be tremendous. It's a great tool and I would hate to see it die... --watirboy -- 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