[Wtr-general] How to catch the exception in the Ruby executable window
while working with watir, when i execute any watir file (.rb) a window will open, executing all the statements written in the code. But when any exception occurs the exception is displayed for a second and the window close. How to capture that exception. awating for a reply ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How to access span?
The HTML code like this: ... td name=outlooktitle0 id=outlooktitle0 style=background-color: rgb(108, 142, 229); color: rgb(255, 255, 255); height: 5px; onclick=switchoutlookBar(0) align=center nowrap=nowrap span class=smallFontUser Group/span/td/trtr td name=outlookdiv0 id=outlookdiv0 style=width: 100%; display: none; height: 0%; align=center valign=top div name=outlookdivin0 id=outlookdivin0 style=overflow: auto; width: 100%; height: 100%; spana href=../smanager/roles.php target=mainA/a/spanbr spana href=../smanager/mg_add.php target=mainB/a/spanbr spana href=../smanager/auth_not.php target=mainC/a/spanbr/div/td/trtr td name=outlooktitle1 id=outlooktitle1 style=background-color: rgb(108, 142, 229); color: rgb(255, 255, 255); height: 5px; onclick=switchoutlookBar(1) align=center nowrap=nowrap span class=smallFontUser/span /td/trtr td name=outlookdiv1 id=outlookdiv1 style=width: 100%; display: none; height: 0%; align=center valign=top div name=outlookdivin1 id=outlookdivin1 style=overflow: auto; width: 100%; height: 100%; spana href=../manager/roles.php target=mainE/a/spanbr spana href=../manager/index.php target=mainF/a/spanbr spana href=../manager/auth_not.php target=mainG/a/spanbr/div/td/trtr ... ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Rarely, watir does not wait till the browser gets loaded fully
Hello people, Rarely, Watir starts the execution of a statement before the brwoser gets loaded fully from the previous step's execution. What to do in those situation? Is there any statement in Watir that will tell its script to wait for a particular frame or a table before resuming the execution? Also, is there a statement in Watir that will make its script wait for a particular number of seconds? Thanks for your time, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can variables be used as regular expressions?
Hello people, Can variables be used as regular expressions in Watir? For example, if we want to check whether there is a link with 'href' containing a particular text say 'submitpage', we can say, puts (ie.link(:href,/submitpage/).exists?) Simiarly can we do the following. variable_for_holding_text = 'submitpage' puts (ie.link(:href,/variable_for_holding_text /).exists?) In this, instead of the exact text, I have passed the variable, 'variable_for_holding_text'. This situation will arise when we use want to do such a check within an user-defined function. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] About the timeout of waitr
Thanks for your reply. This is one case that opening a url, how about other operations such as click a button/link/image/, fill in text field, etc. If all these operations in scripts use this method, then the code will become not concise. Is there a global method/variable that could simplify this problem? Regards, Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sathees Sent: 2007年3月28日 13:18 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] About the timeout of waitr That will through a timeout exception and script will terminate. If you wish to continue, then you got to handle that. begin timeout(20) do |timeout_length| ie.goto where ever you want end rescue puts $! end this is just the basic, modify as you need. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Rarely, watir does not wait till the browser gets loaded fully
Try Sleep -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of vijay Sent: Wednesday, March 28, 2007 1:58 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Rarely,watir does not wait till the browser gets loaded fully Hello people, Rarely, Watir starts the execution of a statement before the brwoser gets loaded fully from the previous step's execution. What to do in those situation? Is there any statement in Watir that will tell its script to wait for a particular frame or a table before resuming the execution? Also, is there a statement in Watir that will make its script wait for a particular number of seconds? Thanks for your time, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Mail Disclaimer: This e-mail and any files transmitted with it are confidential and the views expressed in the same are not necessarily the views of Synechron, and its Directors, Management or Employees. This communication represents the originator's personal views and opinions. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, be advised that you have received this e-mail by error, and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. You shall be under obligation to keep the contents of this e-mail, strictly confidential and shall not disclose, disseminate or divulge the same to any Person, Company, Firm or Entity. Even though Synechron uses up-to-date virus checking software to scan it's emails please ensure you have adequate virus protection before you open or detach any documents from this transmission. Synechron does not accept any liability for viruses or vulnerabilities. The rights to monitor all e-mail communication through our network are reserved with us. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can variables be used as regular expressions?
yes, you can! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the window
begin . . your code here . . rescue Timeout_Error = e # you can mention the error you want to rescue if you know them, or just leave it as rescue puts e . . some more code . rescue puts $! end ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the window
Thank for the response satees I use sciTe to write the watir code in .rb file. when i execute the .rb file the executable window opens and shows us what it is doing. sometimes when a exception occurs it just shows the exception for a second and closes the window. The code which you have written, in it does the exception will be stored in a file which i can open seperately and check what was the error. reply would be appreciatable. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] hi, how to get TOOLTIP
Please post html snippet or link to your application. -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the Ruby executable window
Do not execute rb files by double clicking. Instead, open command prompt, go to folder where your rb files are located and then call them. In that case command prompt window will stay open even if exception occur. -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to access span?
Which one? And what do you want to do with it? For example this span span class=smallFontUser Group/span you can flash with any of this ie.span(:text, User Group).flash ie.span(:index, 1).flash ie.span(:class, smallFont).flash I tried it with watir 1.5.1.1158 -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the Ruby executable window
thanks zelijko. My doubt is cleared. :) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can variables be used as regular expressions?
Put variable inside #{}, like this: ie.link(:href,/#{variable_for_holding_text}/).exists? -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Modal_dialog_test.rb
When i execute Modal_dialog_test.rb [which will be under unittests folder], i get 12 errors ,in that Last error says NoMethoderror:IE#modal-dialog is not supported withcurrent vresion of Ruby (1.8.6) So what is the Ruby Version i have to use ,to resolve this problem. I am using Watir 1.5.1.1158 gem with Ruby 1.8.6. Thanks Simba ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Watir 1.5..1..1158 installation
Thanks vermillion ,actually i made silly mistake there, i was not downloaded Gem.zip file i was having only Bonus.zip. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can variables be used as regular expressions?
Thank you so much ZeljkoFilipin. Your answer had clarified my doubt. Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to select the button from button-menu
when i called the test case ie yahoo mail mark the first file, i am getting the exception or error as undefied method 'element' for nil:NilClass NoMethodError can someone through some light on it. appreciatable ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the window
One part fo the doubt is cleared..other is still not clear ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can we use as many variable names without worrying about memory wastage
Hello people, Can we use as many variable names as we want in a script without worrying about the memory wastage? Each variable is going to occupy some bytes in memory and those bytes would remain occupied as long as the script is running. If so, then in order to avoid memory wastage, to the maximum possible extent, we need to use as few variables as possible in the script. Is this right? Can I make Watir free the memory space occupied by a variable once I find that the variable is not needed anymore? Thinking on the lines of not wasting memory, I am using same variables again and again in the script. If I could find out a way, through you people, to free the memory space occupied by a variable, I would use several variables with appropriate names in the script. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage
Ruby takes care of that, as far as I know. You do not have to worry about memory, unless you have extremely low memory situation. -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] .Can we set the Watir's time_out_value in the script?
Hello people, In our application, there are is a dialog box, which takes a lot of time to load. We give the statement, 'ie.modal_dialog', at the point, where the dialog box would come. But this statement times out within a few seconds before the modal dialog gets loaded. While executing the 'ie,modal_dialog' statement, Watir throws an exception saying Modal dialog did not appear within 2.0 seconds. So we opened the 'watir.rb' file and increased the '@@attach_timeout' value present in it from 2.0 to 20.0. Now Watir waits for the dialog to come (which would come within 15 seconds) and attaches to it. Can we increase this 'attach_timeout' value through a watir command instead of opening the 'watir.rb' file and doing that manually (In a testing tool named 'Test Partner', we can do the same with the command, 'timeout_msec = 20')? Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] .Can we set the Watir's time_out_value in the script?
class Watir::IE @@attach_timeout = 10 end I think that should work ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Rarely, watir does not wait till the browser gets loaded fully
You can use sleep command like sleep(5) so that it will wait until it loads.. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] hi, Is there a GOTO function for watir
No. Read this important article : http://en.wikipedia.org/wiki/Spaghetti_code Please rethink how you structure your code. I *highly* recommend taking a course on Programming Concepts and Design if you haven't done any formal structured programming/scripting in a *long* time. GOTO's bad. Very, very bad. =P Good luck! Cheers. On 28/03/07, Maloy kanti debnath [EMAIL PROTECTED] wrote: hi, IS there any function which is simlar like VB 6.0 GOTO so that we can say if condition goto line 8 else goto line 20 end thanks Maloy ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage
The number of variables is not going to be a problem. But watch out if you have for instance several arrays with 50,000 elements in each. Those can eat up some memory. Ruby has what's called a garbage collector that handles removing things that the script is done with. -Chris On 3/28/07, vijay [EMAIL PROTECTED] wrote: Hello people, Can we use as many variable names as we want in a script without worrying about the memory wastage? Each variable is going to occupy some bytes in memory and those bytes would remain occupied as long as the script is running. If so, then in order to avoid memory wastage, to the maximum possible extent, we need to use as few variables as possible in the script. Is this right? Can I make Watir free the memory space occupied by a variable once I find that the variable is not needed anymore? Thinking on the lines of not wasting memory, I am using same variables again and again in the script. If I could find out a way, through you people, to free the memory space occupied by a variable, I would use several variables with appropriate names in the script. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage
I used this code def x puts press return gets end class Foo; end n = 100 x f= Foo.new n.times do |i| f.instance_eval(@a_variable_#{i} = #{i}) end x with n=100 ruby used 6.35M ( according to task manager), before and after creating the variables when n=1, it used 300M before I got bored of waiting - Original Message - From: Chris McMahon [EMAIL PROTECTED] Date: Wednesday, March 28, 2007 10:15 am Subject: Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage The number of variables is not going to be a problem. But watch out if you have for instance several arrays with 50,000 elements in each. Those can eat up some memory. Ruby has what's called a garbage collector that handles removing things that the script is done with. -Chris On 3/28/07, vijay [EMAIL PROTECTED] wrote: Hello people, Can we use as many variable names as we want in a script without worrying about the memory wastage? Each variable is going to occupy some bytes in memory and those bytes would remain occupied as long as the script is running. If so, then in order to avoid memory wastage, to the maximum possible extent, we need to use as few variables as possible in the script. Is this right? Can I make Watir free the memory space occupied by a variable once I find that the variable is not needed anymore? Thinking on the lines of not wasting memory, I am using same variables again and again in the script. If I could find out a way, through you people, to free the memory space occupied by a variable, I would use several variables with appropriate names in the script. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] little framework
Hi Paul, Could you just please explain how you are mapping something like this: text_field :user_name , :id='username' in the parent class? cheers aidy ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to get report message after running everytest case
There might be a way to redirect both to console and file, search google for redirect dos output. I know how to do it in unix, but not sure how to do it in dos. You might also want to look at ci_reporter (available on rubyforge), log4r or some other mechanism to log your test runs. -Charley On 3/27/07, Jason He [EMAIL PROTECTED] wrote: Thanks for your reply. But there will no message output in the console. Could it output to both console and file? Regards, Jason -- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Charley Baker *Sent:* 2007年3月27日 22:50 *To:* wtr-general@rubyforge.org *Subject:* Re: [Wtr-general] How to get report message after running everytest case You can redirect the output of your bat file to a file: mybat.bat results.txt -Charley On 3/27/07, *Jason He* [EMAIL PROTECTED] wrote: Dear all, I write some the filename of test cases in a windows bat file, execute the bat file, and then report messages for each test case will output in the console. Now, in order to make statistics for these messages, could they also output to the log file by script? The following is the report message after running one test case Finished in 15.063 seconds. 1) Failure: test_b(TC_rt_r_login) [C:/watir1145/runtime/rt_r_login.rb:34]: false is not true. 5 tests, 4 assertions, 1 failures, 0 errors Regards, Jason ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to get report message after running everytest case
there was some code posted to comp.lang.ruby in the last few days to do this. There might be a way to redirect both to console and file, search google for redirect dos output. I know how to do it in unix, but not sure how to do it in dos. You might also want to look at ci_reporter (available on rubyforge), log4r or some other mechanism to log your test runs. -Charley On 3/27/07, Jason He [EMAIL PROTECTED] wrote: Thanks for your reply. But there will no message output in the console. Could it output to both console and file? Regards, Jason -- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Charley Baker *Sent:* 2007年3月27日 22:50 *To:* wtr-general@rubyforge.org *Subject:* Re: [Wtr-general] How to get report message after running everytest case You can redirect the output of your bat file to a file: mybat.bat results.txt -Charley On 3/27/07, *Jason He* [EMAIL PROTECTED] wrote: Dear all, I write some the filename of test cases in a windows bat file, execute the bat file, and then report messages for each test case will output in the console. Now, in order to make statistics for these messages, could they also output to the log file by script? The following is the report message after running one test case Finished in 15.063 seconds. 1) Failure: test_b(TC_rt_r_login) [C:/watir1145/runtime/rt_r_login.rb:34]: false is not true. 5 tests, 4 assertions, 1 failures, 0 errors Regards, Jason ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Modal_dialog_test.rb
Simba wrote: So what is the Ruby Version i have to use ,to resolve this problem. 1.8.2 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Pass data to tests
This may be more of a test/unit question than a watir question... I have a test case, based on the Test::Unit::TestCase. How does one pass data to the test in such a way that the test can be run multiple times with different data. For example: class TC_CreateOrder Test::Unit::TestCase def test_NewOrder assert order successful end end Now, I want to be able to generate a new order for various order types, (TYPE1, TYPE2, TYPE3, etc.) class TS_OrderTests def self.suite suite = Test::Unit::TestSuite.new suite TC_CreateOrder.suite # TYPE1 goes here suite TC_CreateOrder.suite # TYPE2 goes here suite TC_CreateOrder.suite # TYPE3 goes here return suite end end Test::Unit::UI::Console::TestRunner.run(TS_OrderTests) How do I pass the order type to the test, such that the test runs multiple times, once for each order type. Thanks in advance. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
Bill, I thought I'd pick your brain a little on an issue I'm having with this app. I've had no trouble dropping scripts into the suites directory and running them from the railsapp unless the script includes or requires another script. For instance, I have library.rb, which is included by test.rb. For simplicity, let's just say that library consists of require 'watir' and test consists of require 'library' and ie = Watir::IE.new. If I run test.rb on my own, it runs successfully. If I run library.rb through the railsapp, it also works fine (0 assertions, etc). However, if I run test.rb through the railsapp, it errors out, stating that gem_original_require has caused an error in custom_require: no such file to load -- library (LoadError). This has me pretty well confused at the moment. Any ideas? Thanks, Adam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Agee Sent: Tuesday, March 27, 2007 11:40 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] watir execution from webserver Importance: High I posted my zipped rails app as an attachment on the Watir contributions page: http://wiki.openqa.org/display/WTR/Rails+test+runner+example+app In my haste to reply I lost track of the fact that you already had something similar working, except for the issue with the goto method not working (which is now solved). So what you have may actually be a better solution than this app. :) But for what it's worth, the zipfile I posted should be all you need to see my app working, provided that rails is installed too. Please let me know if there are any questions. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
areed, I have noticed that paths in ruby are relative to file that is being executed ( i think ). This has caused a couple of head scratching moments on my part while i wonder they files will no longer load using relative paths. I'm not sure this is related to your problem, hope it helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
No I agree, I think it may be related. With this specific application it seems like it should be calling the same path (the app tells me that the path is where I thought it should be), and I've attempted to set the load path in the script as well -- that's why I'm still confused! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Lolis Sent: Wednesday, March 28, 2007 2:29 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] watir execution from webserver areed, I have noticed that paths in ruby are relative to file that is being executed ( i think ). This has caused a couple of head scratching moments on my part while i wonder they files will no longer load using relative paths. I'm not sure this is related to your problem, hope it helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
I had the same issue where the script would execute but couldn't find any of the other 'required' files in the directory. To solve this problem, I had to add some code to the runner\app\controllers\runner_controller.rb specifying the test suite directory that the test should execute in. Now it is working Great! Here are the changes.: Def index ... suite_dir = T:/my test suite session[:suite_dir] = suite_dir #store it in the session so that it can be used by the runsuite action. ... End Def runsuite ... #added the argument: -Cdirectory ---cd to directory, before executing your script cmd = ruby -C#{session[:suite_dir]} [EMAIL PROTECTED] -f -v verbose #{session[:console_filename]} ... end -David Brown -- Message: 5 Date: Wed, 28 Mar 2007 14:28:56 CDT From: John Lolis [EMAIL PROTECTED] areed, I have noticed that paths in ruby are relative to file that is being executed ( i think ). This has caused a couple of head scratching moments on my part while i wonder they files will no longer load using relative paths. I'm not sure this is related to your problem, hope it helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
Thanks David, those changes worked for me as well! Thanks also to Bill Agee - this is going to be a lot of fun to play with. It's nice to have a centralized location like this to run scripts from so that colleagues aren't required to install ruby, install (many) gems, etc. - Adam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brown, David Sent: Wednesday, March 28, 2007 3:39 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] watir execution from webserver I had the same issue where the script would execute but couldn't find any of the other 'required' files in the directory. To solve this problem, I had to add some code to the runner\app\controllers\runner_controller.rb specifying the test suite directory that the test should execute in. Now it is working Great! Here are the changes.: Def index ... suite_dir = T:/my test suite session[:suite_dir] = suite_dir #store it in the session so that it can be used by the runsuite action. ... End Def runsuite ... #added the argument: -Cdirectory ---cd to directory, before executing your script cmd = ruby -C#{session[:suite_dir]} [EMAIL PROTECTED] -f -v verbose #{session[:console_filename]} ... end -David Brown -- Message: 5 Date: Wed, 28 Mar 2007 14:28:56 CDT From: John Lolis [EMAIL PROTECTED] areed, I have noticed that paths in ruby are relative to file that is being executed ( i think ). This has caused a couple of head scratching moments on my part while i wonder they files will no longer load using relative paths. I'm not sure this is related to your problem, hope it helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
The way I solved this back when I was using the rails app was: - I put all my library files into a common dir - I added a line of code to each test script that allows it to find and add the lib dir to $LOAD_PATH For this I use the same idiom from some of the Watir unit test files (in this case it will add the dir one up from the top-level script to $LOAD_PATH): $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ So, you might be able to do something like this: 1. In the runner/data dir, create a new dir called 'lib' and copy your library files to it 2. In your test scripts, add the above line of code at the top 3. Then change your require statements to reflect the lib dir: require 'lib/library_file.rb' Aside from testing this using the runner app, you can test the changes manually by cd'ing in a command window to c:\ or some other random dir, then try running your script from there (ruby c:\foo\runner\data\suites\test.rb). ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
I wasnt really following the thread, but have you prevented people from running the tests simultaeously? - Original Message - From: Adam Reed [EMAIL PROTECTED] Date: Wednesday, March 28, 2007 3:06 pm Subject: Re: [Wtr-general] watir execution from webserver Thanks David, those changes worked for me as well! Thanks also to BillAgee - this is going to be a lot of fun to play with. It's nice to have a centralized location like this to run scripts from so that colleaguesaren't required to install ruby, install (many) gems, etc. - Adam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brown, David Sent: Wednesday, March 28, 2007 3:39 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] watir execution from webserver I had the same issue where the script would execute but couldn't find any of the other 'required' files in the directory. To solve this problem, I had to add some code to the runner\app\controllers\runner_controller.rb specifying the test suitedirectory that the test should execute in. Now it is working Great!Here are the changes.: Def index ... suite_dir = T:/my test suite session[:suite_dir] = suite_dir #store it in the session so that it can be used by the runsuite action. ... End Def runsuite ... #added the argument: -Cdirectory ---cd to directory, before executing your script cmd = ruby -C#{session[:suite_dir]} [EMAIL PROTECTED] -f -v verbose #{session[:console_filename]} ... end -David Brown -- Message: 5 Date: Wed, 28 Mar 2007 14:28:56 CDT From: John Lolis [EMAIL PROTECTED] areed, I have noticed that paths in ruby are relative to file that is being executed ( i think ). This has caused a couple of head scratching moments on my part while i wonder they files will no longer load using relative paths. I'm not sure this is related to your problem, hope it helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Need help figuring out the element
Hello, Thanks for viewing this. I am new to Watir and I am having this problem clicking on this particular element on my company's website. Our graphics guy described it to me as not an image but rather submit form with and image placed on it. I have tried different methods of clicking (button, image, link). None work. I keep getting this error: Unable to locate object, using alt and Submit Order (Watir::Exception::UnknownObjectException) from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2009:in `click' Basically its a submit button, that upon clicking, requests a token from one of our servers which in return grant the user access to a particular page. Right clicking on it and selecting Properties gives me this: Protocol: HyperText Transfer Protocol with Privacy Type: HTML Document I would greatly appreciate any help or any info. If you need anything else let me know ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] little framework
here was one of the ideas I tried. In essence, what it does is create a method called the_search_box that returns the ie.text_field object. Im sure there are some better ways of doing it. Paul require 'watir' class WatirNaming def self.parse_ops( obj_name , opts ) if opts.has_key? :id how = :id elsif opts.has_key? :name how = :name elsif opts.has_key? :index how = :index else raise No Idea how to find that object end what = opts[ how ] mname = eval(:#{obj_name}) return how , what , mname end def self.text_field( obj_name , opts ) how, what , mname = self.parse_ops( obj_name , opts ) define_method( mname ) { @ie.text_field( how , what ) } end end class D WatirNaming text_field the_search_box , :name = 'q' def initialize @ie = Watir::IE.attach(:title , /google/i ) the_search_box.set('abc') end end d=D.new - Original Message - From: aidy lewis [EMAIL PROTECTED] To: wtr-general@rubyforge.org Sent: Wednesday, March 28, 2007 10:55 AM Subject: Re: [Wtr-general] little framework Hi Paul, Could you just please explain how you are mapping something like this: text_field :user_name , :id='username' in the parent class? cheers aidy ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Need help figuring out the element
It is easier anyone to help you, if you would post the HTML code! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Challenging Question!
Currently I am trying with Process. The main point here is to separate the Save Image from the main process and control the Save Image process from the main process. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir execution from webserver
The version of the runner app I posted doesn't check to see if a script is already running before it executes a new one. But that would definitely be necessary if more than one person is likely to try to run a Watir script at the same time. Some solutions I considered were to use a lock file, or perhaps add code to verify that no IE processes exist before starting a Watir script. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] jscript_test.rb doesn't work in my machine.
Hi Bret, I also facing same probelm as bart but i am using ruby 1.8.2 watir 1.5.1.1158 and my IE version is 7.0,what may be the probelm in this case. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to select the button from button-menu
hi, Can you just let me know the script that you are using and the watir version? - Angrez On 3/28/07, rkkanneganti [EMAIL PROTECTED] wrote: when i called the test case ie yahoo mail mark the first file, i am getting the exception or error as undefied method 'element' for nil:NilClass NoMethodError can someone through some light on it. appreciatable ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to select the button from button-menu
hi angrez the following is the script and the version i am using is watir 1.5.1.1158.gem require 'watir' include Watir require 'test/unit' class TC_mail_yahoo_check Test::Unit::TestCase puts ## Opening the Mail.Yahoo.com site sleep 1 ie = IE.new ie.goto(http://mail.yahoo.com;) ie.maximize() puts ## Login and Password Entered sleep 1 ie.text_field(:name, login).set(username) ie.text_field(:name, passwd).set(password) ie.button(:value, Sign In).click() puts ## Checking the mail box sleep 1 ie.button(:id, checkmailbutton).click() # select first message. puts ## Selecting the First Mail sleep 1 ie.radio(:id, folderviewmsg0checkbox).set() # click on mark button so as options can be displayed puts ## Clicking the Mark Button sleep 1 ie.button(:value, Mark).click() # select element that has text Mark as Read element = ie.element_by_xpath(//lihttp://contains(.,'Mark as Read')) # Print properties of the element just to make sure you selected correct element. element.value element.tagName element.innerHTML # fire click event. element.click() puts ## Element ended sleep 1 end ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to catch the exception in the window
Thank Q Naga.. The script is perfectly working for me :) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Selenium IDE vs Watir
Hi, What are the differences/limitations of each of these other than Watir works on IE and Selenium IDE works on Firefox? Regards, Angrez ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to select the button from button-menu
Hi, I think the code usage is not correct. element = ie.element_by_xpath(//lihttp://contains(.,'Mark as Read')) its ie.element_by_xpath(//li[contains(.'Mark as Read')]) # Print properties of the element just to make sure you selected correct element. Is this comment on single line? Regards, Angrez On 3/29/07, rkkanneganti [EMAIL PROTECTED] wrote: hi angrez the following is the script and the version i am using is watir 1.5.1.1158.gem require 'watir' include Watir require 'test/unit' class TC_mail_yahoo_check Test::Unit::TestCase puts ## Opening the Mail.Yahoo.com site sleep 1 ie = IE.new ie.goto(http://mail.yahoo.com;) ie.maximize() puts ## Login and Password Entered sleep 1 ie.text_field(:name, login).set(username) ie.text_field(:name, passwd).set(password) ie.button(:value, Sign In).click() puts ## Checking the mail box sleep 1 ie.button(:id, checkmailbutton).click() # select first message. puts ## Selecting the First Mail sleep 1 ie.radio(:id, folderviewmsg0checkbox).set() # click on mark button so as options can be displayed puts ## Clicking the Mark Button sleep 1 ie.button(:value, Mark).click() # select element that has text Mark as Read element = ie.element_by_xpath(//lihttp://contains(.,'Mark as Read')) # Print properties of the element just to make sure you selected correct element. element.value element.tagName element.innerHTML # fire click event. element.click() puts ## Element ended sleep 1 end ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general