Hi Sapna,
This is how you can find out if mail box is open or closed. Let me know if
you do not know how to use this code.
irb> ie.image(:index, 1).src =~ /mailclosed/
=> 46
irb> ie.image(:index, 1).src =~ /mailopen/
=> nil
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/fd9f8aef/attachment-0001.html
From forum-watir-users at openqa.org Mon Jun 11 05:35:46 2007
From: forum-watir-users at openqa.org (sapna)
Date: Mon, 11 Jun 2007 04:35:46 CDT
Subject: [Wtr-general] Need to fetch the ID
Message-ID: <30422418.22371181554576753.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi,
I had posted this question earlier but did not get any information. So wanted to put the question again. Need help on this. Below is the HTML code.
1> I want to check whether the mail is read or unread depending on the mail icon(first line of HTML)
2> Want to fetch the id generated (id=1303) depending on which I will click on the message link and that would take me to read message window.
6/8/2007
RE: Check Copy Request
|
Thanks in advance.
Regards
Sapna
From forum-watir-users at openqa.org Mon Jun 11 05:43:29 2007
From: forum-watir-users at openqa.org (reinier)
Date: Mon, 11 Jun 2007 04:43:29 CDT
Subject: [Wtr-general] Link description from file
In-Reply-To: <26550969.661181206864161.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <40132134.22771181555039807.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
found the solution:
use the following code:
[code]
object = 'test.html'
ie.link(:href,/#{object}/).click
[/code]
From forum-watir-users at openqa.org Mon Jun 11 06:10:47 2007
From: forum-watir-users at openqa.org (sapna)
Date: Mon, 11 Jun 2007 05:10:47 CDT
Subject: [Wtr-general] How to capture mail box icon
In-Reply-To:
Message-ID: <34024365.23221181556677710.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Can u guid me how to use this code. I need to check if it is opened/closed and then open the closed mail.
From forum-watir-users at openqa.org Mon Jun 11 06:11:00 2007
From: forum-watir-users at openqa.org (mihai)
Date: Mon, 11 Jun 2007 05:11:00 CDT
Subject: [Wtr-general] mouse right click?
In-Reply-To: <27401231.12911181314515007.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <34784227.23231181556690293.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
with java script it works; but i have this problem, this is the site : http://www.dynamicdrive.com/dynamicindex1/contextmenu.htm
right click to select all and it appers a java menu; how do i click, for example, on Message Forum in that menu?
From zeljko.filipin at gmail.com Mon Jun 11 08:21:57 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Mon, 11 Jun 2007 14:21:57 +0200
Subject: [Wtr-general] Need to fetch the ID
In-Reply-To: <30422418.22371181554576753.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <30422418.22371181554576753.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
On 6/11/07, sapna wrote:
>
> href="/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303&messageToUser=True">RE:
> Check Copy Request
Sapna,
To find id of that link you have to know some other attribute of that link.
I will assume that you know text "RE: Check Copy Request"
This is how you can get href attribute of that link.
irb> ie.link(:text, "RE: Check Copy Request").href
=>
"file:///C:/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303&messageToUser=True"
This will extract 1303.
irb> m = /id=(1303)/.match(ie.link(:text, "RE: Check Copy Request").href)
=> #
irb> m[1]
=> "1303"
For more information see class MatchData (
http://phrogz.net/ProgrammingRuby/ref_c_matchdata.html)
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/7f498e88/attachment.html
From zeljko.filipin at gmail.com Mon Jun 11 08:39:21 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Mon, 11 Jun 2007 14:39:21 +0200
Subject: [Wtr-general] How to capture mail box icon
In-Reply-To: <34024365.23221181556677710.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References:
<34024365.23221181556677710.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
On 6/11/07, sapna wrote:
>
> I need to check if it is opened/closed and then open the closed mail.
Sapna,
This will click a link if mail is closed. You will have to replace ":how"
and "what" with something appropriate.
ie.link(:how, what).click if ie.image(:how, what).src =~ /mailclosed/
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/0d8848ec/attachment.html
From paul.rogers at shaw.ca Mon Jun 11 11:46:18 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Mon, 11 Jun 2007 09:46:18 -0600
Subject: [Wtr-general] mouse right click?
In-Reply-To: <34784227.23231181556690293.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <27401231.12911181314515007.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<34784227.23231181556690293.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
the code in that page uses the javascript event object, which we've had problems with in watir.
I think you will be able to make this work by:
simulate right click
see if the menuitem div is visible
click it based on its text
something like this may be what you need
ie.link(:index,1).fireEvent("onContextMenu")
if ie.div(:text , "Message Formur").style.visibility != "hidden"
ie.div(:text , "message forum").click
end
----- Original Message -----
From: mihai
Date: Monday, June 11, 2007 4:11 am
Subject: Re: [Wtr-general] mouse right click?
> with java script it works; but i have this problem, this is the
> site : http://www.dynamicdrive.com/dynamicindex1/contextmenu.htm
> right click to select all and it appers a java menu; how do i
> click, for example, on Message Forum in that menu?
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
From forum-watir-users at openqa.org Mon Jun 11 12:32:40 2007
From: forum-watir-users at openqa.org (Hayato)
Date: Mon, 11 Jun 2007 11:32:40 CDT
Subject: [Wtr-general] Modal dialog
In-Reply-To: <68f4a0e80706080418u2902b091vca6d347f944879d8@mail.gmail.com>
Message-ID: <38933500.27981181579592432.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
click_no_wait seems to do it.
Thank you very much for your help!
From areed at relocationcentral.com Mon Jun 11 17:21:03 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Mon, 11 Jun 2007 16:21:03 -0500
Subject: [Wtr-general] Running tests from a webserver -- any new information?
In-Reply-To: <38933500.27981181579592432.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <68f4a0e80706080418u2902b091vca6d347f944879d8@mail.gmail.com>
<38933500.27981181579592432.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E28@rc-mail.relocationcentral.com>
A while ago I posted about the option of running Watir tests
from a centralized webserver or desktop. The point would be for others
to be able to run the tests and view results without installing Ruby,
Watir and dependent libraries and alleviate associated technical
problems. I'm the "automation QA guy" at my company, so this would help
the rest of my team run tests alongside manual tests, or to support
small patches that need a lot of regression testing when I'm away. In
case I'm still being vague, the application would list available tests
(locally or in SVN -- wouldn't matter), allow the user to click a test
to launch it on the host machine, and then display results onscreen.
At the time, I believe on person replied and sent a snippet of
code out that did work, but was difficult to configure due to the fact
it was written by someone else to fill their different needs. Does
anyone else use this approach, or know of any applications that make the
process easier? I've never written active web code, so it's new ground
for me.
Thanks,
Adam
From bob at jdstrategies.net Mon Jun 11 17:43:55 2007
From: bob at jdstrategies.net (Bob)
Date: Mon, 11 Jun 2007 14:43:55 -0700
Subject: [Wtr-general] WATiR contract work in San Francisco
In-Reply-To:
Message-ID: <20070611215036.7DF6E5240A63@rubyforge.org>
Experienced test engineer needed to work on Customer Facing Ecommerce
applications. Requires significant commercial automation work using the
WATiR framework. Immediate, long term contract situation. Very solid team,
positive environment.
Calls or email are good. Bob Lepesh, JD Strategies.
650-941-2900 bob at jdstrategies.net
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of
wtr-general-request at rubyforge.org
Sent: Monday, June 11, 2007 2:30 AM
To: wtr-general at rubyforge.org
Subject: Wtr-general Digest, Vol 43, Issue 13
Send Wtr-general mailing list submissions to
wtr-general at rubyforge.org
To subscribe or unsubscribe via the World Wide Web, visit
http://rubyforge.org/mailman/listinfo/wtr-general
or, via email, send a message with subject or body 'help' to
wtr-general-request at rubyforge.org
You can reach the person managing the list at
wtr-general-owner at rubyforge.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Wtr-general digest..."
From bret at pettichord.com Mon Jun 11 19:13:13 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Mon, 11 Jun 2007 18:13:13 -0500
Subject: [Wtr-general] Concurrent tests, different regions...
In-Reply-To: <34443390.20731181540680121.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <34443390.20731181540680121.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <466DD709.5020009@pettichord.com>
eisdrache wrote:
> I understand what you are saying about the global variables, but in this case they are a necessary evil as I am using the following code in order to handle javascript pop-ups:
>
> def startClicker( button , waitTime= 9, user_input=nil )
> hwnd = $ie.enabled_popup(waitTime)
> if (hwnd)
> w = WinClicker.new
> if ( user_input )
> w.setTextValueForFileNameField( hwnd, "#{user_input}" )
> end
> sleep 3
> w.clickWindowsButton_hwnd( hwnd, "#{button}" )
> w=nil
> end
> end
Using this code with multiple threads will eventually fail
unpredictably. You need to pass in the ie object as a parameter to avoid
this.
Bret
From forum-watir-users at openqa.org Mon Jun 11 19:22:29 2007
From: forum-watir-users at openqa.org (Jet Liu)
Date: Mon, 11 Jun 2007 18:22:29 CDT
Subject: [Wtr-general] Scheduler
In-Reply-To: <31890691.16621175001281665.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <29848301.431181604179897.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Adding "&auto=true" to the end of the URL does the trick.
Thanks all.
From jazzeattle at gmail.com Mon Jun 11 20:27:27 2007
From: jazzeattle at gmail.com (TT Blue)
Date: Mon, 11 Jun 2007 17:27:27 -0700
Subject: [Wtr-general] Handling Popup
Message-ID: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com>
I'm new to Watir as well as Ruby, and I need help handling a pop-up dialog.
I've searched both the mailing list as well as the trying all that I've
found, but I couldn't get it to click on the "OK" pop-up button.
==============================================================
require 'watir'
require 'watir\enabled_popup'
#require 'watir/WinClicker'
def startClicker( button , waitTime= 9, user_input=nil )
# get a handle if one exists
hwnd = $ie.enabled_popup(waitTime)
if (hwnd) # yes there is a popup
w = WinClicker.new
if ( user_input )
w.setTextValueForFileNameField( hwnd, "#{user_input}" )
end
# I put this in to see the text being input it is not necessary to
work
sleep 3
# "OK" or whatever the name on the button is
w.clickWindowsButton_hwnd( hwnd, "#{button}" )
#
# this is just cleanup
w=nil
end
end
switch_role.role.select("my role")
startClicker( "OK", 3, "")
==============================================================
when I tried code block above, I get this error message:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- watir\contrib\enabled_popup
(LoadError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from CMSlogin.rb:2
when I try this code block:
require 'watir/WinClicker'
def sstartClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{
waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
switch_role.role.select("my role")
startClicker( "OK", 3)
This just waits forever and does not click on the OK button.
==============================================================
Can someone please help?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/75f162c0/attachment-0001.html
From hiriumi at gmail.com Mon Jun 11 20:31:31 2007
From: hiriumi at gmail.com (Hayato Iriumi)
Date: Mon, 11 Jun 2007 17:31:31 -0700
Subject: [Wtr-general] Handling Popup
In-Reply-To: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com>
References: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com>
Message-ID: <50c958a0706111731y3acb099dxfc2c90fe07b7d6e@mail.gmail.com>
I just went through exactly the same issue.
Try to use click_no_wait and see what happens.
On 6/11/07, TT Blue wrote:
> I'm new to Watir as well as Ruby, and I need help handling a pop-up dialog.
>
> I've searched both the mailing list as well as the trying all that I've
> found, but I couldn't get it to click on the "OK" pop-up button.
> ==============================================================
> require 'watir'
> require 'watir\enabled_popup'
> #require 'watir/WinClicker'
> def startClicker( button , waitTime= 9, user_input=nil )
> # get a handle if one exists
> hwnd = $ie.enabled_popup(waitTime)
> if (hwnd) # yes there is a popup
> w = WinClicker.new
> if ( user_input )
> w.setTextValueForFileNameField ( hwnd, "#{user_input}" )
> end
> # I put this in to see the text being input it is not necessary to
> work
> sleep 3
> # "OK" or whatever the name on the button is
> w.clickWindowsButton_hwnd( hwnd, "#{button}" )
> #
> # this is just cleanup
> w=nil
> end
> end
>
> switch_role.role.select("my role")
> startClicker( "OK", 3, "")
> ==============================================================
> when I tried code block above, I get this error message:
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require': no such file to load -- watir\contrib\enabled_popup
> (LoadError)
> from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
> from CMSlogin.rb:2
>
> when I try this code block:
>
> require 'watir/WinClicker'
> def sstartClicker( button , waitTime = 3)
> w = WinClicker.new
> longName = $ie.dir.gsub("/" , "\\" )
> shortName = w.getShortFileName(longName)
> c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{
> waitTime} "
> puts "Starting #{c}"
> w.winsystem(c)
> w=nil
> end
>
> switch_role.role.select("my role")
> startClicker( "OK", 3)
>
> This just waits forever and does not click on the OK button.
>
> ==============================================================
>
> Can someone please help?
>
>
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
From forum-watir-users at openqa.org Tue Jun 12 01:31:44 2007
From: forum-watir-users at openqa.org (sapna)
Date: Tue, 12 Jun 2007 00:31:44 CDT
Subject: [Wtr-general] Need to fetch the ID
In-Reply-To:
Message-ID: <33198844.1661181626334759.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi Zeljko,
I have a quesion on the code you sent me. Kindly find the question below the code.
This will extract 1303.
irb> m = /id=(1303)/.match(ie.link(:text, "RE: Check Copy Request").href)
=> #
Q: Here I mention the id but I want to fetch automatically because the id keep changing for every message replied. Hope my explaination is fine.
irb> m[1]
=> "1303"
From jazzeattle at gmail.com Tue Jun 12 01:59:36 2007
From: jazzeattle at gmail.com (TT Blue)
Date: Mon, 11 Jun 2007 22:59:36 -0700
Subject: [Wtr-general] Handling Popup
In-Reply-To: <50c958a0706111731y3acb099dxfc2c90fe07b7d6e@mail.gmail.com>
References: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com>
<50c958a0706111731y3acb099dxfc2c90fe07b7d6e@mail.gmail.com>
Message-ID: <21fc6efd0706112259k4d74422dm96881ccf20c45d7c@mail.gmail.com>
Tried that too, didn't work.
It's somewhat interesting because with QuickTest Pro, it identified that
dialog as winDialog and I'd thought the winClicker solution would work...
but it didn't.
On 6/11/07, Hayato Iriumi wrote:
>
> I just went through exactly the same issue.
> Try to use click_no_wait and see what happens.
>
> On 6/11/07, TT Blue wrote:
> > I'm new to Watir as well as Ruby, and I need help handling a pop-up
> dialog.
> >
> > I've searched both the mailing list as well as the trying all that I've
> > found, but I couldn't get it to click on the "OK" pop-up button.
> > ==============================================================
> > require 'watir'
> > require 'watir\enabled_popup'
> > #require 'watir/WinClicker'
> > def startClicker( button , waitTime= 9, user_input=nil )
> > # get a handle if one exists
> > hwnd = $ie.enabled_popup(waitTime)
> > if (hwnd) # yes there is a popup
> > w = WinClicker.new
> > if ( user_input )
> > w.setTextValueForFileNameField ( hwnd, "#{user_input}" )
> > end
> > # I put this in to see the text being input it is not necessary
> to
> > work
> > sleep 3
> > # "OK" or whatever the name on the button is
> > w.clickWindowsButton_hwnd( hwnd, "#{button}" )
> > #
> > # this is just cleanup
> > w=nil
> > end
> > end
> >
> > switch_role.role.select("my role")
> > startClicker( "OK", 3, "")
> > ==============================================================
> > when I tried code block above, I get this error message:
> > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > `gem_original_require': no such file to load --
> watir\contrib\enabled_popup
> > (LoadError)
> > from
> > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > `require'
> > from CMSlogin.rb:2
> >
> > when I try this code block:
> >
> > require 'watir/WinClicker'
> > def sstartClicker( button , waitTime = 3)
> > w = WinClicker.new
> > longName = $ie.dir.gsub("/" , "\\" )
> > shortName = w.getShortFileName(longName)
> > c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{
> > waitTime} "
> > puts "Starting #{c}"
> > w.winsystem(c)
> > w=nil
> > end
> >
> > switch_role.role.select("my role")
> > startClicker( "OK", 3)
> >
> > This just waits forever and does not click on the OK button.
> >
> > ==============================================================
> >
> > Can someone please help?
> >
> >
> >
> >
> > _______________________________________________
> > Wtr-general mailing list
> > Wtr-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/68828741/attachment.html
From forum-watir-users at openqa.org Tue Jun 12 03:18:17 2007
From: forum-watir-users at openqa.org (mihai)
Date: Tue, 12 Jun 2007 02:18:17 CDT
Subject: [Wtr-general] $ie show/hide?
Message-ID: <39789039.2551181632727291.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
can i hide my IE page while its being test?
something like:
$ie.hide
#test command
$ie.show
From forum-watir-users at openqa.org Tue Jun 12 04:39:40 2007
From: forum-watir-users at openqa.org (imran)
Date: Tue, 12 Jun 2007 03:39:40 CDT
Subject: [Wtr-general] Upgrading the gem for watir 1.5.1.1192
In-Reply-To: <4665AB4A.7030404@pettichord.com>
Message-ID: <28182982.4091181637610043.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, Bret
Thanks for considering my question.
I have un-installed the watir 1.4.1, so the problem get resolved now.
But there is another query.
I am working on writing the scripts for my web application but the problem is that i am unable to locate the object named Microsoft Tab strip. Code is like that
|
Patient Info
*Insurance Info*
*Admission Info*
|
I did try the method to get the url of the respective tab and send it to that location but in vain due to the serverside session creation which is the part of the URL. Some session number dynamically generated is part of that URL. SO when i use that approach it says session expired/ no such session exists.
I have to click the *Admisison Info* tab.
Please suggest some solution to resolve this burning issue.
Thanks :)
kind Regards,
M.Imran
From forum-watir-users at openqa.org Tue Jun 12 04:43:06 2007
From: forum-watir-users at openqa.org (imran)
Date: Tue, 12 Jun 2007 03:43:06 CDT
Subject: [Wtr-general] Microsoft Tab Strip -
Message-ID: <30735302.4151181637816359.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, All
I am working on writing the scripts for my web application but the problem is that i am unable to locate the object named Microsoft Tab strip. Code is like that
|
Patient Info
*Insurance Info*
*Admission Info*
|
I did try the method to get the url of the respective tab and send it to that location but in vain due to the serverside session creation which is the part of the URL. Some session number dynamically generated is part of that URL. So when i use that approach it says session expired/ no such session exists.
I have to click the Admisison Info tab.
Please suggest some solution to resolve this burning issue.
Thanks
kind Regards,
M.Imran
From forum-watir-users at openqa.org Tue Jun 12 04:50:24 2007
From: forum-watir-users at openqa.org (sandeep)
Date: Tue, 12 Jun 2007 03:50:24 CDT
Subject: [Wtr-general] $ie show/hide?
In-Reply-To: <39789039.2551181632727291.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <33762064.4211181638254883.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
you can user $ie.bring_to_front() method which brings the window come to front.
For hiding you may use $ie.minimize which minimizes the window (appears as icon on taskbar).
Is this what you want?
From forum-watir-users at openqa.org Tue Jun 12 05:02:17 2007
From: forum-watir-users at openqa.org (imran)
Date: Tue, 12 Jun 2007 04:02:17 CDT
Subject: [Wtr-general] $ie show/hide?
In-Reply-To: <39789039.2551181632727291.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <34147116.4461181638967887.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi,carabusu
To bring the IE at front use the line = $ie.bring_to_front()
To Maximize the IE use the line = $ie.maximize()
To Minimize the IE use the line = $ie.minimize()
To hide the IE follow the link below:
URL = http://rubyonwindows.blogspot.com/2007/05/automating-internet-explorer-with-ruby.html
kind Regards,
M.Imran
From zeljko.filipin at gmail.com Tue Jun 12 05:39:49 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Tue, 12 Jun 2007 11:39:49 +0200
Subject: [Wtr-general] Need to fetch the ID
In-Reply-To: <33198844.1661181626334759.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References:
<33198844.1661181626334759.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
Hi Sapna,
You should really read something about Regular Expressions. You can start
here.
http://www.rubycentral.com/book/tut_stdtypes.html
There is chapter named Regular Expressions.
For now, try this (Bret left it in comment at my blog).
(ie.link(:text, "RE: Check Copy Request").href =~ /id=(.*)&/)[1]
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/272982fc/attachment-0001.html
From Mark_Cain at RL.gov Tue Jun 12 09:51:55 2007
From: Mark_Cain at RL.gov (Cain, Mark)
Date: Tue, 12 Jun 2007 06:51:55 -0700
Subject: [Wtr-general] Handling Popup
In-Reply-To: <21fc6efd0706112259k4d74422dm96881ccf20c45d7c@mail.gmail.com>
References: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com><50c958a0706111731y3acb099dxfc2c90fe07b7d6e@mail.gmail.com>
<21fc6efd0706112259k4d74422dm96881ccf20c45d7c@mail.gmail.com>
Message-ID: <74805676EA7D9243BDF45D637BAD341067D9A6@EX01-3.rl.gov>
I had to alter this method when I had a Pop-up occur from clicking a
radio button (couldn't use the click_no_wait). This seemed to get me
past that problem.
require 'tread'
...
def startClicker(button, ieObj)
# Strart a new thread that will dismiss the JSPopup.
if ieObj != nil then
t = Thread.new {
w = WinClicker.new
hwnd = ieObj.enabled_popup(10) if nil == hwnd
w.clickWindowsButton_hwnd(hwnd, button)
t.join
t = nil
w = nil
}
end
...
startClicker('OK', $ie)
switch_role.role.select("my role")
Hope this helps,
--Mark
________________________________
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of TT Blue
Sent: Monday, June 11, 2007 11:00 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Handling Popup
Tried that too, didn't work.
It's somewhat interesting because with QuickTest Pro, it identified that
dialog as winDialog and I'd thought the winClicker solution would
work... but it didn't.
On 6/11/07, Hayato Iriumi wrote:
I just went through exactly the same issue.
Try to use click_no_wait and see what happens.
On 6/11/07, TT Blue wrote:
> I'm new to Watir as well as Ruby, and I need help handling a
pop-up dialog.
>
> I've searched both the mailing list as well as the trying all
that I've
> found, but I couldn't get it to click on the "OK" pop-up
button.
> ==============================================================
> require 'watir'
> require 'watir\enabled_popup'
> #require 'watir/WinClicker'
> def startClicker( button , waitTime= 9, user_input=nil )
> # get a handle if one exists
> hwnd = $ie.enabled_popup(waitTime)
> if (hwnd) # yes there is a popup
> w = WinClicker.new
> if ( user_input )
> w.setTextValueForFileNameField ( hwnd,
"#{user_input}" )
> end
> # I put this in to see the text being input it is not
necessary to
> work
> sleep 3
> # "OK" or whatever the name on the button is
> w.clickWindowsButton_hwnd( hwnd, "#{button}" )
> #
> # this is just cleanup
> w=nil
> end
> end
>
> switch_role.role.select("my role")
> startClicker( "OK", 3, "")
> ==============================================================
> when I tried code block above, I get this error message:
>
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require': no such file to load --
watir\contrib\enabled_popup
> (LoadError)
> from
>
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
> from CMSlogin.rb:2
>
> when I try this code block:
>
> require 'watir/WinClicker'
> def sstartClicker( button , waitTime = 3)
> w = WinClicker.new
> longName = $ie.dir.gsub("/" , "\\" )
> shortName = w.getShortFileName(longName)
> c = "start ruby #{shortName }\\watir\\clickJSDialog.rb
#{button } #{
> waitTime} "
> puts "Starting #{c}"
> w.winsystem (c)
> w=nil
> end
>
> switch_role.role.select("my role")
> startClicker( "OK", 3)
>
> This just waits forever and does not click on the OK button.
>
> ==============================================================
>
> Can someone please help?
>
>
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/63e18a10/attachment.html
From bret at pettichord.com Tue Jun 12 10:25:52 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Tue, 12 Jun 2007 09:25:52 -0500
Subject: [Wtr-general] $ie show/hide?
In-Reply-To: <39789039.2551181632727291.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <39789039.2551181632727291.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <466EACF0.9060009@pettichord.com>
mihai wrote:
> can i hide my IE page while its being test?
> something like:
>
> $ie.hide
> #test command
> $ie.show
$ie.visible = false
# test
$ie.visible = true
From forum-watir-users at openqa.org Tue Jun 12 10:49:07 2007
From: forum-watir-users at openqa.org (santosh)
Date: Tue, 12 Jun 2007 09:49:07 CDT
Subject: [Wtr-general] What are people using for 'test executive'?
In-Reply-To: <35027834.1173877138636.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <31444847.11661181659778019.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
We too are using FitNesse to run our Selenium tests, but are getting this exception on RC server and browser too gets killed,
Logs on RC:
_____________________________________________________________________________
GET: cmd=getNewBrowserSession&1=*iexplore&2=http%3A%2F%2Fwww.google.com
Backing up registry settings...
Modifying registry settings...
Launching Internet Explorer...
Not handling: http://www.google.com/selenium-server/core/jsunit/app/jsUnitCore.js?null
Browser 340453/:top sel_82573 posted START NEW
req: true:POST http://www.google.com/selenium-server/core/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_82573&sessionId=3404
53&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1181655348218 HTTP/1.0
Accept: */*
Referer: http://www.google.com/selenium-server/core/RemoteRunner.html?sessionId=340453&multiWindow=false&debugMode=false
Accept-Language: en-us
Proxy-Connection: keep-alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Host: www.google.com
Cookie: PREF=ID=9f5a9971d8484878:TM=1181294031:LM=1181294031:S=UpSXpU9rw9Nma3jP
Pragma: no-cache
Content-Length: 5
Allocated session 340453 for http://www.google.com
Browser 340453/:top sel_82573 posted OK
req: null:POST http://www.google.com/selenium-server/core/driver/?&localFrameAdd
ress=top&seleniumWindowName=&uniqueId=sel_82573&sessionId=340453&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1181655348281 HTTP/1.0
Accept: */*
Referer: http://www.google.com/selenium-server/core/RemoteRunner.html?sessionId=340453&multiWindow=false&debugMode=false
Accept-Language: en-us
Proxy-Connection: keep-alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1
.4322)
Host: www.google.com
Cookie: PREF=ID=9f5a9971d8484878:TM=1181294031:LM=1181294031:S=UpSXpU9rw9Nma3jP
Pragma: no-cache
Content-Length: 2
Got result: OK,340453 on session 340453
GET: cmd=testComplete&sessionId=340453
Restoring registry settings (won't affect running browsers)...
Got result: OK on session 340453
Please can anyone help with the solution..?
-Santosh
From bcolfer at shopping.com Tue Jun 12 12:22:17 2007
From: bcolfer at shopping.com (Colfer, Brian)
Date: Tue, 12 Jun 2007 10:22:17 -0600
Subject: [Wtr-general] Upgrading the gem for watir 1.5.1.1192
In-Reply-To: <28182982.4091181637610043.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <4665AB4A.7030404@pettichord.com>
<28182982.4091181637610043.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <5A95EAE4A3FE1645992FAF868AD6DCDC03C05F1F@DEN-EXM-06.corp.ebay.com>
I have both 1.4.1 and 1.5.1.1192 installed ...
I installed the gem by running gem -l install watir in the directory
where the watir 1.5.1.1192 is located.
I have two versions of the scripts using
gem 'watir', '= 1.4.1'
and
gem 'watir', '= 1.5.1.1192'
There may be a better way to determine the necessary version of a gem...
but I know you can run two versions of your tests with different
versions of WATIR.
Brian
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of imran
Sent: Tuesday, June 12, 2007 1:40 AM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Upgrading the gem for watir 1.5.1.1192
Hi, Bret
Thanks for considering my question.
I have un-installed the watir 1.4.1, so the problem get resolved now.
From forum-watir-users at openqa.org Tue Jun 12 13:12:34 2007
From: forum-watir-users at openqa.org (mihai)
Date: Tue, 12 Jun 2007 12:12:34 CDT
Subject: [Wtr-general] $ie.text.include? problem
Message-ID: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
i have this code:
testSite = 'http://www.google.com'
$ie = IE.new
$ie.goto(testSite)
if $ie.text.include?("Programs")
then puts "OK"
else puts "CRAP"
end
end
and the output:
OK
OK
OK
why does 3 OK appears? how can i do that only one OK appear and how can i write the code for, example,:
if strings "Microsoft" and "Programs" and "OK" are in $ie.text puts OK
From paul.rogers at shaw.ca Tue Jun 12 13:21:58 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Tue, 12 Jun 2007 11:21:58 -0600
Subject: [Wtr-general] $ie.text.include? problem
In-Reply-To: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
I just ran your code fro mirb using watir 1.4.1 and it only printed it once....
----- Original Message -----
From: mihai
Date: Tuesday, June 12, 2007 11:12 am
Subject: [Wtr-general] $ie.text.include? problem
> i have this code:
>
> testSite = 'http://www.google.com'
> $ie = IE.new
> $ie.goto(testSite)
>
> if $ie.text.include?("Programs")
> then puts "OK"
> else puts "CRAP"
> end
>
>
> end
>
> and the output:
> OK
> OK
> OK
>
> why does 3 OK appears? how can i do that only one OK appear and
> how can i write the code for, example,:
>
> if strings "Microsoft" and "Programs" and "OK" are in $ie.text
> puts OK
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
From forum-watir-users at openqa.org Tue Jun 12 13:30:33 2007
From: forum-watir-users at openqa.org (mihai)
Date: Tue, 12 Jun 2007 12:30:33 CDT
Subject: [Wtr-general] $ie.text.include? problem
In-Reply-To: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <37595444.13921181669463982.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
but i need watir 1.5 because i'm working with some java scripts
From jeff.fry at gmail.com Tue Jun 12 13:41:54 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 10:41:54 -0700
Subject: [Wtr-general] syntax error, unexpected tIVAR
Message-ID: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
Hey gang,
I am updating a script due to a GUI change. There was previously only one
button on the page where class = 'Button Menu'. Now there are two. I'm
trying to identify the button by the div it's in, like so:
@ie.div(:class, 'PopupMenuLabel title'). at ie.button(:class,'Button
Menu').click
But I get the following syntax error:
add_many_types.rb:34: syntax error, unexpected tIVAR
@ie.div(:class, 'PopupMenuLabel title'). at ie.button(:class,'Button
Menu').click
When I cut that line back to the original
@ie.button(:class,'Button Menu').click
The script runs...but hits the wrong button. My second choice for resolving
this was the somewhat more fragile
@ie.button(:class =>'Button Menu', :index => 2).click
which yielded
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in `send':
{:class=>"Button Menu", :index=>2} is not a symbol (TypeError)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in
`locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1091:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1091:in
`locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:3716:in
`locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2411:in
`assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2642:in
`enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2417:in
`assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2587:in
`click!'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2573:in
`click'
I'm wondering what I am doing wrong in both cases.
Thanks!
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/be745fce/attachment.html
From jeff.fry at gmail.com Tue Jun 12 13:48:07 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 10:48:07 -0700
Subject: [Wtr-general] Capturing HTML source from modular/constructed pages
Message-ID: <970956b0706121048u7cfe500blfe41713956457dd4@mail.gmail.com>
The pages I am automating now are very modular, and often the element I'm
driving comes from some included js like:
include("metaweb/domain/domainApplication.js");
include("metaweb/core/components/EditableMetawebText.js");
include("metaweb/core/mqlquery/MQLDomainTypesQuery.js");
For an example, check out http://sandbox.freebase.com/signin/signin
Note that none of the fields on the page are listed in the source for the
page.
The IE Dev Toolbar works perfectly for me in these cases, showing many
things that aren't visible by viewing source. I realize though that I don't
know of a good way to capture the constructed source code to paste into an
email. Can I capture the source of the constructed page via IE Dev Toolbar
(or something else)?
Thanks again,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/a52bc425/attachment.html
From paul.rogers at shaw.ca Tue Jun 12 13:50:37 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Tue, 12 Jun 2007 11:50:37 -0600
Subject: [Wtr-general] syntax error, unexpected tIVAR
In-Reply-To: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
References: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
Message-ID:
use this instead
@ie.div(:class, 'PopupMenuLabel title').button(:class,'Button Menu').click
-------------- next part --------------
Hey gang,
I am updating a script due to a GUI change. There was previously only one
button on the page where class = 'Button Menu'. Now there are two. I'm
trying to identify the button by the div it's in, like so:
@ie.div(:class, 'PopupMenuLabel title'). at ie.button(:class,'Button
Menu').click
But I get the following syntax error:
add_many_types.rb:34: syntax error, unexpected tIVAR
@ie.div(:class, 'PopupMenuLabel title'). at ie.button(:class,'Button
Menu').click
When I cut that line back to the original
@ie.button(:class,'Button Menu').click
The script runs...but hits the wrong button. My second choice for resolving
this was the somewhat more fragile
@ie.button(:class =>'Button Menu', :index => 2).click
which yielded
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in `send':
{:class=>"Button Menu", :index=>2} is not a symbol (TypeError)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in
`locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1091:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1091:in
`locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:3716:in
`locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2411:in
`assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2642:in
`enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2417:in
`assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2587:in
`click!'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2573:in
`click'
I'm wondering what I am doing wrong in both cases.
Thanks!
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/2882b60b/attachment.html
-------------- next part --------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From paul.rogers at shaw.ca Tue Jun 12 13:51:13 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Tue, 12 Jun 2007 11:51:13 -0600
Subject: [Wtr-general] Capturing HTML source from modular/constructed
pages
In-Reply-To: <970956b0706121048u7cfe500blfe41713956457dd4@mail.gmail.com>
References: <970956b0706121048u7cfe500blfe41713956457dd4@mail.gmail.com>
Message-ID:
in irb
use ie.html
-------------- next part --------------
The pages I am automating now are very modular, and often the element I'm
driving comes from some included js like:
include("metaweb/domain/domainApplication.js");
include("metaweb/core/components/EditableMetawebText.js");
include("metaweb/core/mqlquery/MQLDomainTypesQuery.js");
For an example, check out http://sandbox.freebase.com/signin/signin
Note that none of the fields on the page are listed in the source for the
page.
The IE Dev Toolbar works perfectly for me in these cases, showing many
things that aren't visible by viewing source. I realize though that I don't
know of a good way to capture the constructed source code to paste into an
email. Can I capture the source of the constructed page via IE Dev Toolbar
(or something else)?
Thanks again,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/ddfbaa87/attachment.html
-------------- next part --------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From jeff.fry at gmail.com Tue Jun 12 13:58:26 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 10:58:26 -0700
Subject: [Wtr-general] $ie.text.include? problem
In-Reply-To: <37595444.13921181669463982.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<37595444.13921181669463982.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <970956b0706121058t614a3f92s33f3aa2424c6af60@mail.gmail.com>
I don't believe Watir 1.5 is your issue here. I tried your code in 1.5 and
also only got one OK. Specifically, I tried:
> require 'test/unit'
> require 'watir'
>
> class TC_sample < Test::Unit::TestCase
> include Watir
>
> def test_sample
> testSite = 'http://www.google.com'
> $ie = IE.new
> $ie.goto(testSite)
>
> if $ie.text.include?("Programs")
> then puts "OK"
> else puts "CRAP"
> end
>
> end # method
>
> end #class
>
And got:
> >ruby test_sample.rb
> Loaded suite test_sample
> Started
> OK
> .
> Finished in 1.442 seconds.
>
If you run exactly what I pasted above, do you see 3 OKs? If not, how does
your script differ from mine? How does your actual test site differ from
google.com?
Jeff
On 6/12/07, mihai wrote:
>
> but i need watir 1.5 because i'm working with some java scripts
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/0d9a99b5/attachment.html
From jeff.fry at gmail.com Tue Jun 12 13:59:37 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 10:59:37 -0700
Subject: [Wtr-general] syntax error, unexpected tIVAR
In-Reply-To:
References: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
Message-ID: <970956b0706121059t3e3b5e1fh95ceba7090a532bc@mail.gmail.com>
Doh! Thanks Paul :)
On 6/12/07, Paul Rogers wrote:
>
> use this instead
> @ie.div(:class, 'PopupMenuLabel title').button(:class,'Button Menu').click
>
> Hey gang,
>
> I am updating a script due to a GUI change. There was previously only one
> button on the page where class = 'Button Menu'. Now there are two. I'm
> trying to identify the button by the div it's in, like so:
> @ie.div(:class, 'PopupMenuLabel title'). at ie.button(:class,'Button
> Menu').click
>
> But I get the following syntax error:
> add_many_types.rb:34: syntax error, unexpected tIVAR
> @ie.div(:class, 'PopupMenuLabel title').@ ie.button(:class,'Button
> Menu').click
> When I cut that line back to the original
> @ie.button(:class,'Button Menu').click
> The script runs...but hits the wrong button. My second choice for
> resolving this was the somewhat more fragile
> @ie.button(:class =>'Button Menu', :index => 2).click
>
> which yielded
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in `send':
> {:class=>"Button Menu", :index=>2} is not a symbol (TypeError)
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in
> `locate_input_element'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1091:in
> `each'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 1.5.1.1166/./watir.rb:1091:in
> `locate_input_element'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:3716:in
> `locate'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2411:in
> `assert_exists'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2642:in
> `enabled?'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2417:in
> `assert_enabled'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 1.5.1.1166/./watir.rb:2587:in
> `click!'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2573:in
> `click'
>
> I'm wondering what I am doing wrong in both cases.
>
> Thanks!
> Jeff
>
> --
> http://testingjeff.wordpress.com
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/9296f0fc/attachment-0001.html
From paul.rogers at shaw.ca Tue Jun 12 14:18:48 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Tue, 12 Jun 2007 12:18:48 -0600
Subject: [Wtr-general] safari on windows
Message-ID:
http://www.apple.com/safari/
From jeff.fry at gmail.com Tue Jun 12 15:44:36 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 12:44:36 -0700
Subject: [Wtr-general] safari on windows
In-Reply-To:
References:
Message-ID: <970956b0706121244h5029ad61n6268b837137934d0@mail.gmail.com>
...which was followed within hours by reports of 4 DoS and 2 remote code
execution bugs http://erratasec.blogspot.com/2007/06/niiiice.html
I have to say, I'd really like to see Apple concentrate on getting Safari
working on the Mac before they port it to Windows.
Jeff
On 6/12/07, Paul Rogers wrote:
>
> http://www.apple.com/safari/
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/b07528cf/attachment.html
From jazzeattle at gmail.com Tue Jun 12 21:43:15 2007
From: jazzeattle at gmail.com (TT Blue)
Date: Tue, 12 Jun 2007 18:43:15 -0700
Subject: [Wtr-general] Handling Popup
In-Reply-To: <74805676EA7D9243BDF45D637BAD341067D9A6@EX01-3.rl.gov>
References: <21fc6efd0706111727x64879dbfyee43932d75111a14@mail.gmail.com>
<50c958a0706111731y3acb099dxfc2c90fe07b7d6e@mail.gmail.com>
<21fc6efd0706112259k4d74422dm96881ccf20c45d7c@mail.gmail.com>
<74805676EA7D9243BDF45D637BAD341067D9A6@EX01-3.rl.gov>
Message-ID: <21fc6efd0706121843q1ca928edi69dc413f4cd7fe31@mail.gmail.com>
I was able to clear a security dialog box using the similar method that
you've described below, but I couldn't get it to clear this dialog box.
I'll have to go ask the developer that exactly it is so maybe I can tackle
this in a different way.
On 6/12/07, Cain, Mark wrote:
>
> I had to alter this method when I had a Pop-up occur from clicking a
> radio button (couldn't use the click_no_wait). This seemed to get me past
> that problem.
>
>
> require 'tread'
>
> ...
>
> def startClicker(button, ieObj)
> # Strart a new thread that will dismiss the JSPopup.
> if ieObj != nil then
> t = Thread.new {
> w = WinClicker.new
> hwnd = ieObj.enabled_popup(10) if nil == hwnd
> w.clickWindowsButton_hwnd(hwnd, button)
> t.join
> t = nil
> w = nil
> }
> end
> ...
>
> startClicker('OK', $ie)
> switch_role.role.select("my role")
> Hope this helps,
>
> *--Mark***
>
>
>
>
> ------------------------------
> *From:* wtr-general-bounces at rubyforge.org [mailto:
> wtr-general-bounces at rubyforge.org] *On Behalf Of *TT Blue
> *Sent:* Monday, June 11, 2007 11:00 PM
> *To:* wtr-general at rubyforge.org
> *Subject:* Re: [Wtr-general] Handling Popup
>
> Tried that too, didn't work.
>
> It's somewhat interesting because with QuickTest Pro, it identified that
> dialog as winDialog and I'd thought the winClicker solution would work...
> but it didn't.
>
> On 6/11/07, Hayato Iriumi wrote:
> >
> > I just went through exactly the same issue.
> > Try to use click_no_wait and see what happens.
> >
> > On 6/11/07, TT Blue wrote:
> > > I'm new to Watir as well as Ruby, and I need help handling a pop-up
> > dialog.
> > >
> > > I've searched both the mailing list as well as the trying all that
> > I've
> > > found, but I couldn't get it to click on the "OK" pop-up button.
> > > ==============================================================
> > > require 'watir'
> > > require 'watir\enabled_popup'
> > > #require 'watir/WinClicker'
> > > def startClicker( button , waitTime= 9, user_input=nil )
> > > # get a handle if one exists
> > > hwnd = $ie.enabled_popup(waitTime)
> > > if (hwnd) # yes there is a popup
> > > w = WinClicker.new
> > > if ( user_input )
> > > w.setTextValueForFileNameField ( hwnd, "#{user_input}" )
> > > end
> > > # I put this in to see the text being input it is not
> > necessary to
> > > work
> > > sleep 3
> > > # "OK" or whatever the name on the button is
> > > w.clickWindowsButton_hwnd( hwnd, "#{button}" )
> > > #
> > > # this is just cleanup
> > > w=nil
> > > end
> > > end
> > >
> > > switch_role.role.select("my role")
> > > startClicker( "OK", 3, "")
> > > ==============================================================
> > > when I tried code block above, I get this error message:
> > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > > `gem_original_require': no such file to load --
> > watir\contrib\enabled_popup
> > > (LoadError)
> > > from
> > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > > `require'
> > > from CMSlogin.rb:2
> > >
> > > when I try this code block:
> > >
> > > require 'watir/WinClicker'
> > > def sstartClicker( button , waitTime = 3)
> > > w = WinClicker.new
> > > longName = $ie.dir.gsub("/" , "\\" )
> > > shortName = w.getShortFileName(longName)
> > > c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{
> > > waitTime} "
> > > puts "Starting #{c}"
> > > w.winsystem (c)
> > > w=nil
> > > end
> > >
> > > switch_role.role.select("my role")
> > > startClicker( "OK", 3)
> > >
> > > This just waits forever and does not click on the OK button.
> > >
> > > ==============================================================
> > >
> > > Can someone please help?
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Wtr-general mailing list
> > > Wtr-general at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/wtr-general
> > >
> > _______________________________________________
> > Wtr-general mailing list
> > Wtr-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/28f42460/attachment.html
From jeff.fry at gmail.com Tue Jun 12 22:45:20 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 19:45:20 -0700
Subject: [Wtr-general] OT-ish - What is determining the order this hash gets
iterated through?
Message-ID: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
Hey gang,
I've set up a hash of labeled URLs:
$pages = {"clint_eastwood"
=>"/view?id=%239202a8c04000641f8000000000056de6",
"wood"
=>"/view?id=%239202a8c04000641f80000000002bb2f4",
"home" =>"/view/",
"all_domains" =>"/view/allDomains",
"discuss_boats" =>"/discuss/view?id=%2Fboats%2Fboat",
"filter_musical_artist" =>"/view/filter?id=/music/artist",
"filter_location" =>"/view/filter?id=/location/location",
"top_user_druderman" =>"/view/user?id=/user/druderman"}
and have code that iterates through them and logs page load times to a CSV:
$pages.each_key do |page|
$results_array = []
$results_array << page
10.times do
url = $url_root + $pages[page]
$ie.goto(url)
$results_array << $ie.down_load_time.to_s
end
which in turn creates a CSV like this:
filter_musical_artist,1.212,1.282,1.442,1.296,1.242,1.512,1.282,1.182,1.292,
1.232
top_user_druderman,1.763,1.432,1.582,1.623,1.462,1.412,1.422,1.612,1.582,
1.422
filter_location,0.971,0.982,1.242,1.152,1.532,1.162,1.202,1.151,1.221,1.151
all_domains,1.032,0.951,0.661,0.851,0.731,0.871,0.49,0.882,0.701,0.851
wood,1.382,1.321,1.462,1.382,1.332,1.342,1.232,1.292,3.416,1.232
clint_eastwood,2.574,2.864,2.804,3.055,2.994,2.864,2.714,2.975,2.744,2.884
discuss_boats,1.041,0.561,0.561,0.531,0.551,0.571,0.551,0.571,0.541,0.531
home,1.001,1.041,1.032,1.041,1.031,0.982,1.011,1.052,1.132,1.011
So here's the question: Why aren't the csv results in the order of the hash?
And what order /are/ they in? There seems to be some method to the madness
here, because they come out consistently in the /same/ order...but it isn't
the order they are listed in the hash, or alphabetical by key or
value...anyone know how this works?
Thanks,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/09b87026/attachment.html
From christopher.mcmahon at gmail.com Tue Jun 12 22:58:52 2007
From: christopher.mcmahon at gmail.com (Chris McMahon)
Date: Tue, 12 Jun 2007 20:58:52 -0600
Subject: [Wtr-general] OT-ish - What is determining the order this hash
gets iterated through?
In-Reply-To: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
References: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
Message-ID: <72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
> So here's the question: Why aren't the csv results in the order of the hash?
> And what order /are/ they in? There seems to be some method to the madness
> here, because they come out consistently in the /same/ order...but it isn't
> the order they are listed in the hash, or alphabetical by key or
> value...anyone know how this works?
Hashes are not sorted in predictable ways, regardless of which
language you're using. Luckily, in Ruby, the Hash object has a sort()
method: http://www.rubycentral.com/book/ref_c_hash.html#Hash.sort
I'm not a huge expert at this stuff, but I've tripped over it before.
From jeff.fry at gmail.com Wed Jun 13 00:52:58 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 12 Jun 2007 21:52:58 -0700
Subject: [Wtr-general] OT-ish - What is determining the order this hash
gets iterated through?
In-Reply-To: <72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
References: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
<72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
Message-ID: <466F782A.90909@gmail.com>
Chris McMahon wrote:
>> So here's the question: Why aren't the csv results in the order of the hash?
>> And what order /are/ they in? There seems to be some method to the madness
>> here, because they come out consistently in the /same/ order...but it isn't
>> the order they are listed in the hash, or alphabetical by key or
>> value...anyone know how this works?
>>
>
> Hashes are not sorted in predictable ways, regardless of which
> language you're using. Luckily, in Ruby, the Hash object has a sort()
> method: http://www.rubycentral.com/book/ref_c_hash.html#Hash.sort
>
> I'm not a huge expert at this stuff, but I've tripped over it before.
...and here comes Chris McMahon, champion of the off topic question!
Thanks dude. I half-wondered if my tagging my post as OT would call you
out. ;)
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070612/e55d2805/attachment.html
From christopher.mcmahon at gmail.com Wed Jun 13 01:11:20 2007
From: christopher.mcmahon at gmail.com (Chris McMahon)
Date: Tue, 12 Jun 2007 23:11:20 -0600
Subject: [Wtr-general] OT-ish - What is determining the order this hash
gets iterated through?
In-Reply-To: <466F782A.90909@gmail.com>
References: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
<72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
<466F782A.90909@gmail.com>
Message-ID: <72799cd70706122211nef85670yfe259703f9ebc84d@mail.gmail.com>
> I'm not a huge expert at this stuff, but I've tripped over it before.
>
> ...and here comes Chris McMahon, champion of the off topic question! Thanks
> dude. I half-wondered if my tagging my post as OT would call you out. ;)
heehee!
I am so not-Ruby not-Watir these days. I am heads-down-elbows-up in
Selenium/Perl, but I remember dealing with hash sorting in Perl back
in the day, and I had to jump in...
From forum-watir-users at openqa.org Wed Jun 13 03:20:53 2007
From: forum-watir-users at openqa.org (sapna)
Date: Wed, 13 Jun 2007 02:20:53 CDT
Subject: [Wtr-general] Want to display data in the same row using Puts
Message-ID: <36630437.51181719287190.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi,
I want display data in the same row using puts. For the reference see below. Thanks in advance.
puts "{a[4][1]):{a[4][2]}" --> This is not working but. Tell me how to put this value.
Regards
Sapna
From forum-watir-users at openqa.org Wed Jun 13 04:35:07 2007
From: forum-watir-users at openqa.org (reinier)
Date: Wed, 13 Jun 2007 03:35:07 CDT
Subject: [Wtr-general] how to properly use the snippet function?
Message-ID: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
I am trying to get rid of all cookies via a function.
On this forum I found the Snippet thingy.
http://rubyforge.org/snippet/detail.php?type=snippet&id=26
So I included that code in my script and trying to use it, but I can't figure out how.
this is the code:
[code]
DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 'V')
[/code]
So what function should be called to delete all the cookies?
From zeljko.filipin at gmail.com Wed Jun 13 06:12:17 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Wed, 13 Jun 2007 12:12:17 +0200
Subject: [Wtr-general] syntax error, unexpected tIVAR
In-Reply-To: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
References: <970956b0706121041t138725bckd8fa8146a35ae726@mail.gmail.com>
Message-ID:
On 6/12/07, Jeff Fry wrote:
>
> @ie.button(:class =>'Button Menu', :index => 2).click
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in `send':
> {:class=>"Button Menu", :index=>2} is not a symbol (TypeError)
>
Hi Jeff,
I guess that button is one of those elements that still do not have multiple
attribute support.
Zeljko
--
ZeljkoFilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/6327b051/attachment.html
From zeljko.filipin at gmail.com Wed Jun 13 06:23:11 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Wed, 13 Jun 2007 12:23:11 +0200
Subject: [Wtr-general] Want to display data in the same row using Puts
In-Reply-To: <36630437.51181719287190.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36630437.51181719287190.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
Hi Sapna,
If you have variable called var, you can display its value inside string
like this.
puts "var = #{var}"
Zeljko
--
ZeljkoFilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/2209b63f/attachment.html
From zeljko.filipin at gmail.com Wed Jun 13 06:59:17 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Wed, 13 Jun 2007 12:59:17 +0200
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To: <4669C6F2.70807@pettichord.com>
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<4669A305.4080609@pettichord.com>
<970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com>
<970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com>
<4669C6F2.70807@pettichord.com>
Message-ID:
On 6/8/07, Bret Pettichord wrote:
>
> However, if you are using the Watir::IE#modal_dialog method, you must
> use Ruby 1.8.2-14 and not a more recent version.
I just installed ruby182-14.exe on clean xp pro machine. Components: only
RubyGems Package Manager. Then I tried to install watir-1.5.1.1192.gem. I
first executed
Y:\>gem install win32-process --include-dependencies
and got this error message.
Y:\>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install win32-process
--include-dep
endencies
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --include-dependencies
I uninstalled ruby182-14.exe and installed ruby182-15.exe and did not get
that error message. Am I doing something wrong?
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/6e5cbf2a/attachment.html
From npadmana at thoughtworks.com Wed Jun 13 06:46:24 2007
From: npadmana at thoughtworks.com (Nivetha Padmanaban)
Date: Wed, 13 Jun 2007 16:16:24 +0530
Subject: [Wtr-general] Porting Watir to JRuby
Message-ID:
Any plans of porting WATIR to JRuby??
Regards,
Nivetha
Email - nivetha at thoughtworks.com
Mobile - (0) 98807 17518
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/d82f0624/attachment.html
From forum-watir-users at openqa.org Wed Jun 13 08:28:13 2007
From: forum-watir-users at openqa.org (reinier)
Date: Wed, 13 Jun 2007 07:28:13 CDT
Subject: [Wtr-general] how to delete cookies (trying now with snippet
but this is quite unclear)
In-Reply-To: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <30189218.1281181737723946.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
got it working myself.
by calling the delete_cache and including the file mentioned below (got that from this forum somewhere)
[code]
#!/bin/ruby
#
#
#
#
#
# set TEMPIF=%USERPROFILE%\Local Settings\Temporary Internet Files
# %TEMPIF%\Content.IE5\Index.DAT
require 'Win32API'
#
#
# HashMethods = a Hash that can be accessed with methods
# e.g. h = MethodHash.new
# h['street'] = 'Broadway'
# h.street = 'Broadway'
# puts h.street ===> Broadway
require 'delegate'
class MethodHash < SimpleDelegator
def initialize h = {}
super h
end
def method_missing(method_name, *args)
name = method_name.to_s
if name.ends_with?('=')
self[ name.chop ] = args[0]
else
self[ name ]
end
end
end
class String
def ends_with?(substr)
len = substr.length
self.reverse() [0 .. len-1].reverse == substr
end
def starts_with?(substr)
len = substr.length
self[0 .. len-1] == substr
end
alias start_with? starts_with?
alias begin_with? starts_with?
alias begins_with? starts_with?
alias end_with? ends_with?
# String each() operator reads line-by-line
# These functions return characters
def each_char
self.each_byte{|x| yield x.chr }
end
def collect_char
r = []
self.each_byte{|x| r << x.chr }
r
end
end
=begin
// Windows System calls needed to clear cache.
//
BOOL DeleteUrlCacheEntry(
LPCTSTR lpszUrlName
);
HANDLE FindFirstUrlCacheEntry(
LPCTSTR lpszUrlSearchPattern,
LPINTERNET_CACHE_ENTRY_INFO lpFirstCacheEntryInfo,
LPDWORD lpdwFirstCacheEntryInfoBufferSize
);
BOOL FindNextUrlCacheEntry(
HANDLE hEnumHandle,
LPINTERNET_CACHE_ENTRY_INFO lpNextCacheEntryInfo,
LPWORD lpdwNextCacheEntryInfoBufferSize
);
BOOL FindCloseUrlCache(
IN HANDLE hEnumHandle
);
typedef struct _INTERNET_CACHE_ENTRY_INFO {
DWORD dwStructSize;
LPTSTR lpszSourceUrlName;
LPTSTR lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpireTime;
FILETIME LastAccessTime;
FILETIME LastSyncTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPTSTR lpszFileExtension;
union {
DWORD dwReserved;
DWORD dwExemptDelta;
}
} INTERNET_CACHE_ENTRY_INFO, *LPINTERNET_CACHE_ENTRY_INFO;
=end
def delete_cache
w = get_api('wininet',FUNCS)
i = 0
info,infosize = get_first_info(w)
cache = w.FindFirstUrlCacheEntry.Call(nil,info,infosize)
if cache != 0
begin
len, source_file_ptr, local_file_ptr = info.unpack 'LLL'
w.DeleteUrlCacheEntry.Call(source_file_ptr)
i += 1
info,infosize = get_next_info( w, cache )
end while w.FindNextUrlCacheEntry.Call(cache, info, infosize) != 0
end
w.FindCloseUrlCache.Call(cache)
i
end
def get_first_info(api)
sizenum = [0,0].pack('L*')
buf = [1024,0].pack('L*').ljust(1024)
r = api.FindFirstUrlCacheEntry.Call(nil,nil,sizenum)
n = sizenum.unpack('L')[0]
info = sizenum.ljust(n)
[info,sizenum]
end
def get_next_info(api, handle)
sizenum = [0,0].pack('L*')
buf = [1024,0].pack('L*').ljust(1024)
r = api.FindNextUrlCacheEntry.Call(handle,nil,sizenum)
n = sizenum.unpack('L')[0]
info = sizenum.ljust(n)
[info,sizenum]
end
#
# Win32 API used in this file is listed here.
# Each system call can be instatiated like this
# DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 'V')
# Instead, the functions are defined dynamically from this list:
#
FUNCS = {
'FindFirstUrlCacheEntry' => ['ppp','n'],
'FindNextUrlCacheEntry' => ['npp','n'],
'DeleteUrlCacheEntry' => ['n', 'n'],
'FindCloseUrlCache' => ['n', 'n']
}
#
# get_api returns a hash with Win32 API system calls
# Usage:
# api = get_api('Kernel32', {'GetLastError'=>['V', 'N'],...})
#
def get_api(library, function_hash)
f = MethodHash.new
function_hash.each{|funcname,types|
in_types = types[0].collect_char{|x| x}
out_type = types[1]
f[funcname] = Win32API.new(library, funcname, in_types, out_type)
}
f
end
def getLastError
f = Win32API.new('Kernel32', 'GetLastError', ['V'], 'N')
f.call
end
if __FILE__ == $0
n = main
# print "Deleted #{n} items\n"
end
[/code]
From nicksieger at gmail.com Wed Jun 13 09:29:49 2007
From: nicksieger at gmail.com (Nick Sieger)
Date: Wed, 13 Jun 2007 08:29:49 -0500
Subject: [Wtr-general] Porting Watir to JRuby
In-Reply-To:
References:
Message-ID:
On 6/13/07, Nivetha Padmanaban wrote:
>
> Any plans of porting WATIR to JRuby??
None that I know of at the moment. The stumbling block is to get a
compatible version of 'win32ole' on JRuby which we don't have.
/Nick
From tester.paul at gmail.com Wed Jun 13 09:46:59 2007
From: tester.paul at gmail.com (Paul Carvalho)
Date: Wed, 13 Jun 2007 09:46:59 -0400
Subject: [Wtr-general] OT-ish - What is determining the order this hash
gets iterated through?
In-Reply-To: <72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
References: <970956b0706121945y7434e096jca215955bcc06dc1@mail.gmail.com>
<72799cd70706121958q7ca2a1fo94c24d07cf31628a@mail.gmail.com>
Message-ID: <37c405480706130646n63282068ldeaf551b20921829@mail.gmail.com>
Just remember that if you 'sort' a hash, you get an *array* not a hash. You
may need to adjust your code to match. That's tripped me up before.
On 12/06/07, Chris McMahon wrote:
>
> > So here's the question: Why aren't the csv results in the order of the
> hash?
> > And what order /are/ they in? There seems to be some method to the
> madness
> > here, because they come out consistently in the /same/ order...but it
> isn't
> > the order they are listed in the hash, or alphabetical by key or
> > value...anyone know how this works?
>
> Hashes are not sorted in predictable ways, regardless of which
> language you're using. Luckily, in Ruby, the Hash object has a sort()
> method: http://www.rubycentral.com/book/ref_c_hash.html#Hash.sort
>
> I'm not a huge expert at this stuff, but I've tripped over it before.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/26b000e7/attachment.html
From forum-watir-users at openqa.org Wed Jun 13 10:17:34 2007
From: forum-watir-users at openqa.org (imran)
Date: Wed, 13 Jun 2007 09:17:34 CDT
Subject: [Wtr-general] $ie.text.include? problem
In-Reply-To: <27215568.13481181668384130.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <28441807.4621181744284909.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, *carabasu*
Please execute the code below, i have just removed form your code an extra *end*.
and added
require 'watir' and replaced IE.new with Watir::IE.new because i didn't use include WATIR
Execute below code it will print one .. OK
require 'watir'
testSite = 'http://www.google.com'
$ie = Watir::IE.new
$ie.goto(testSite)
if $ie.text.include?("Programs")
then puts "OK"
else puts "CRAP"
end
:)
*kind Regards*
M.Imran
From carl.l.shaulis at convergys.com Wed Jun 13 10:21:08 2007
From: carl.l.shaulis at convergys.com (carl.l.shaulis at convergys.com)
Date: Wed, 13 Jun 2007 09:21:08 -0500
Subject: [Wtr-general] Carl L Shaulis is out of the office.
Message-ID:
I will be out of the office starting 06/13/2007 and will not return until
06/14/2007.
If you need immediate assistance please try Cari Spruiell or my cell phone
at 512-560-5773. Thanks!
--
"NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."
From Mark_Cain at RL.gov Wed Jun 13 10:33:39 2007
From: Mark_Cain at RL.gov (Cain, Mark)
Date: Wed, 13 Jun 2007 07:33:39 -0700
Subject: [Wtr-general] how to properly use the snippet function?
In-Reply-To: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <74805676EA7D9243BDF45D637BAD341067D9A8@EX01-3.rl.gov>
The attached file works on my Windows XP/IE7 machine. It will delete
all the temporary internet files and the cookies. I don't remember
where I got it or who wrote it originally, but I tweaked it to get it to
work right for me.
Hope this helps,
--Mark
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of reinier
Sent: Wednesday, June 13, 2007 1:35 AM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] how to properly use the snippet function?
I am trying to get rid of all cookies via a function.
On this forum I found the Snippet thingy.
http://rubyforge.org/snippet/detail.php?type=snippet&id=26
So I included that code in my script and trying to use it, but I can't
figure out how.
this is the code:
[code]
DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry",
['P'], 'V') [/code]
So what function should be called to delete all the cookies?
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CookieKiller.rb
Type: application/octet-stream
Size: 1858 bytes
Desc: CookieKiller.rb
Url : http://rubyforge.org/pipermail/wtr-general/attachments/20070613/7c598543/attachment.obj
From carl.l.shaulis at convergys.com Wed Jun 13 10:35:08 2007
From: carl.l.shaulis at convergys.com (carl.l.shaulis at convergys.com)
Date: Wed, 13 Jun 2007 09:35:08 -0500
Subject: [Wtr-general] Carl L Shaulis is out of the office.
Message-ID:
I will be out of the office starting 06/13/2007 and will not return until
06/14/2007.
If you need immediate assistance please try Cari Spruiell or my cell phone
at 512-560-5773. Thanks!
--
"NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."
From forum-watir-users at openqa.org Wed Jun 13 11:12:55 2007
From: forum-watir-users at openqa.org (imran)
Date: Wed, 13 Jun 2007 10:12:55 CDT
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
Message-ID: <38224533.6441181747605648.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, All
I am working on writing the scripts for my web application but the problem is that i am unable to locate the object named Microsoft Tab strip. Code is like that
|
Patient Info
*Insurance Info*
*Admission Info*
|
I did try the method to get the url of the respective tab and send it to that location but in vain due to the serverside session creation which is the part of the URL. Some session number dynamically generated is part of that URL. So when i use that approach it says session expired/ no such session exists.
I have to click the Admisison Info tab.
Please suggest some solution to resolve this burning issue.
Thanks
kind Regards,
M.Imran
From billagee at gmail.com Wed Jun 13 13:55:53 2007
From: billagee at gmail.com (Bill Agee)
Date: Wed, 13 Jun 2007 10:55:53 -0700
Subject: [Wtr-general] how to properly use the snippet function?
In-Reply-To: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <73e7817e0706131055p38497c79y3ea25b8bf91d0878@mail.gmail.com>
When I needed to use that snippet, I just left the whole thing in a
separate file, and initiated the cache/cookie cleanup with
system('ruby del_cache.rb')
You could also probably paste the whole blob of code into a new method
and it should work.
It would be possible to do the same work in fewer lines of code, but
you'd have to refactor the script somewhat.
On 6/13/07, reinier wrote:
> I am trying to get rid of all cookies via a function.
> On this forum I found the Snippet thingy.
> http://rubyforge.org/snippet/detail.php?type=snippet&id=26
> So I included that code in my script and trying to use it, but I can't figure out how.
>
> this is the code:
> [code]
> DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 'V')
> [/code]
>
> So what function should be called to delete all the cookies?
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
From bret at pettichord.com Wed Jun 13 14:09:28 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Wed, 13 Jun 2007 13:09:28 -0500
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To:
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com> <4669A305.4080609@pettichord.com> <970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com> <970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com> <4669C6F2.70807@pettichord.com>
Message-ID: <467032D8.7000402@pettichord.com>
?eljko Filipin wrote:
> On 6/8/07, *Bret Pettichord* > wrote:
> I just installed ruby182-14.exe on clean xp pro machine. Components:
> only RubyGems Package Manager. Then I tried to install
> watir-1.5.1.1192.gem. I first executed
>
> Y:\>gem install win32-process --include-dependencies
>
> and got this error message.
>
> Y:\>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install win32-process
> --include-dep
> endencies
> ERROR: While executing gem ... (OptionParser::InvalidOption)
> invalid option: --include-dependencies
>
> I uninstalled ruby182-14.exe and installed ruby182-15.exe and did not
> get that error message. Am I doing something wrong?
Probably not. My guess is that you have run into a problem with the
version of rubygems installed with 182-14. What happens if you don't use
the "--include-dependencies" option?
Bret
From bret at pettichord.com Wed Jun 13 14:13:02 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Wed, 13 Jun 2007 13:13:02 -0500
Subject: [Wtr-general] Upgrading the gem for watir 1.5.1.1192
In-Reply-To: <28182982.4091181637610043.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <28182982.4091181637610043.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <467033AE.1040805@pettichord.com>
imran wrote:
> But there is another query.
>
If you have a new question, please submit it under a (different) subject
line that describes the problem.
From bret at pettichord.com Wed Jun 13 14:36:14 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Wed, 13 Jun 2007 13:36:14 -0500
Subject: [Wtr-general] NoMethodError :Undefined method "Process_id" for
1808:Fixnum
In-Reply-To: <27770958.10281181300329871.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <27770958.10281181300329871.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <4670391E.3080901@pettichord.com>
Simba wrote:
> When i Run Below is code in IRB ,its throwinf error
> require 'watir'
> ie=Watir::IE.start("www.google.com")
>
> Error :
> NoMethodError :Undefined method "Process_id" for 1808:Fixnum
>
> Please some body tell me why this error is coming?
>
> Before Going into IRB , I had installed Win32-process 0.4.0 & Watir-1.5.1.1158.gem
>
Could you please provide a stack trace?
From forum-watir-users at openqa.org Wed Jun 13 14:36:29 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Wed, 13 Jun 2007 13:36:29 CDT
Subject: [Wtr-general] Save results to file
Message-ID: <39841913.6971181759819214.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Pls be patient. I just d/l'd Watir and am just starting...
I used this .rb from the tutorial of Watir
---------snippet start------------------
require 'watir' # the watir controller
# set a variable
test_site = 'http://www.google.com'
# open the IE browser
ie = Watir::IE.new
# print some comments
puts "## Beginning of test: Google search"
puts " "
puts "Step 1: go to the test site: " + test_site
ie.goto(test_site)
puts " Action: entered " + test_site + " in the address bar."
puts "Step 2: enter 'pickaxe' in the search text field"
ie.text_field(:name, "q").set("Beer + Bottle + Label") # q is the name of the search field
puts " Action: entered pickaxe in the search field"
puts "Step 3: click the 'Google Search' button"
ie.button(:name, "btnG").click
# "btnG" is the name of the Search button
puts " Action: clicked the Google Search button."
puts "Expected Result: "
puts " - a Google page with results should be shown. 'Programming Ruby' should be high on the list."
puts "Actual Result: Check that the 'Programming Ruby' link appears on the results page "
if ie.contains_text("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results."
else
puts "Test Failed! Could not find: 'Programming Ruby'"
end
puts " "
puts "## End of test: Google search"
----------end snippet--------------
It opens the window and performs the search.
NOW...How do I save the text of the results to a file? I will eventually want to save the results to a MySQL tble, but I'm trying baby steps to learn the syntax.
Thanks,
B
From bret at pettichord.com Wed Jun 13 14:44:30 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Wed, 13 Jun 2007 13:44:30 -0500
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <38224533.6441181747605648.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <38224533.6441181747605648.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <46703B0E.6080908@pettichord.com>
This looks like an ActiveX control. I don't know how to handle ActiveX
controls with Watir. Can you point us to a page that includes this control?
Bret
From areed at relocationcentral.com Wed Jun 13 14:47:16 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Wed, 13 Jun 2007 13:47:16 -0500
Subject: [Wtr-general] Save results to file
In-Reply-To: <39841913.6971181759819214.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <39841913.6971181759819214.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E2C@rc-mail.relocationcentral.com>
There are quite a few other steps that I'm skipping because they're
pretty easy to google (checking if a log file exists already, appending
the log name with the date to preven overwrites, etc), but here's a real
simple intro:
textlog = File.open("text.log",
File::CREAT|File::APPEND|File::WRONLY)
This creates a file named text.log in the root directory. The flags at
the end tell it to create the file it if doesn't exist, append the file
if it already exists, and allow write access.
Now, when you want to write something to the log, you use:
textlog.puts "Here's some stuff"
I store my logging function in a separate library and call it at the
beginning of each test, and then call a separate function that enters
some formatting for the end of the log at the end of each test. I just
use simple formatting like "## " at the beginning of every heading line
to make the important information easier to read.
Hope that helps,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 1:36 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Save results to file
Pls be patient. I just d/l'd Watir and am just starting...
I used this .rb from the tutorial of Watir ---------snippet
start------------------
require 'watir' # the watir controller
# set a variable
test_site = 'http://www.google.com'
# open the IE browser
ie = Watir::IE.new
# print some comments
puts "## Beginning of test: Google search"
puts " "
puts "Step 1: go to the test site: " + test_site
ie.goto(test_site)
puts " Action: entered " + test_site + " in the address bar."
puts "Step 2: enter 'pickaxe' in the search text field"
ie.text_field(:name, "q").set("Beer + Bottle + Label") # q is
the name of the search field
puts " Action: entered pickaxe in the search field"
puts "Step 3: click the 'Google Search' button"
ie.button(:name, "btnG").click
# "btnG" is the name of the Search button
puts " Action: clicked the Google Search button."
puts "Expected Result: "
puts " - a Google page with results should be shown. 'Programming
Ruby' should be high on the list."
puts "Actual Result: Check that the 'Programming Ruby' link appears
on the results page "
if ie.contains_text("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'.
Actual Results match Expected Results."
else
puts "Test Failed! Could not find: 'Programming Ruby'"
end
puts " "
puts "## End of test: Google search"
----------end snippet--------------
It opens the window and performs the search.
NOW...How do I save the text of the results to a file? I will eventually
want to save the results to a MySQL tble, but I'm trying baby steps to
learn the syntax.
Thanks,
B
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From forum-watir-users at openqa.org Wed Jun 13 15:16:35 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Wed, 13 Jun 2007 14:16:35 CDT
Subject: [Wtr-general] Save results to file
In-Reply-To: <36B5DBA88E027F47812ED877C6A978D801372E2C@rc-mail.relocationcentral.com>
Message-ID: <36372109.7181181762225640.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?
I.E. I thought of ie.put(:text,)
But, this syntax is more of a 'push' and I'm trying to 'pull' the result data (i.e. scrape results and iterate thru the results into a file) so I know it is wrong before I even tried it
-----from watir online tutorial-------------
Text Attribute
This is the Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click
What you see in the HTML source (attribute highlighted):
---------end snippet-------------------
From areed at relocationcentral.com Wed Jun 13 15:23:34 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Wed, 13 Jun 2007 14:23:34 -0500
Subject: [Wtr-general] Save results to file
In-Reply-To: <36372109.7181181762225640.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E2C@rc-mail.relocationcentral.com>
<36372109.7181181762225640.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E2D@rc-mail.relocationcentral.com>
I'm not sure what you're trying to say -- you lost me here.
If you want to scrape a page for URLs and then write them to the log
file:
ie.links.each do |link| # for each link on the current page in IE...
textlog.puts link.src # print url of the link in the textlog we
created
end #ie.links.each
Otherwise, please include the purpose of your script and the html from
the page you're testing.
Thanks,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 2:17 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Save results to file
Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?
I.E. I thought of ie.put(:text,)
But, this syntax is more of a 'push' and I'm trying to 'pull' the result
data (i.e. scrape results and iterate thru the results into a file) so I
know it is wrong before I even tried it
-----from watir online tutorial------------- Text Attribute This is the
Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click
What you see in the HTML source (attribute highlighted):
---------end snippet-------------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From areed at relocationcentral.com Wed Jun 13 15:29:18 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Wed, 13 Jun 2007 14:29:18 -0500
Subject: [Wtr-general] Save results to file
In-Reply-To: <36B5DBA88E027F47812ED877C6A978D801372E2D@rc-mail.relocationcentral.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E2C@rc-mail.relocationcentral.com><36372109.7181181762225640.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<36B5DBA88E027F47812ED877C6A978D801372E2D@rc-mail.relocationcentral.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E2E@rc-mail.relocationcentral.com>
I don't know what's up with the formatting, the "end #ie.links.each"
should be on the next line (or else it'll get tied into the previous
comment).
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Adam Reed
Sent: Wednesday, June 13, 2007 2:24 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Save results to file
I'm not sure what you're trying to say -- you lost me here.
If you want to scrape a page for URLs and then write them to the log
file:
ie.links.each do |link| # for each link on the current page in IE...
textlog.puts link.src # print url of the link in the textlog we
created end #ie.links.each
Otherwise, please include the purpose of your script and the html from
the page you're testing.
Thanks,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 2:17 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Save results to file
Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?
I.E. I thought of ie.put(:text,)
But, this syntax is more of a 'push' and I'm trying to 'pull' the result
data (i.e. scrape results and iterate thru the results into a file) so I
know it is wrong before I even tried it
-----from watir online tutorial------------- Text Attribute This is the
Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click
What you see in the HTML source (attribute highlighted):
---------end snippet-------------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From jeff.fry at gmail.com Wed Jun 13 21:18:38 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Wed, 13 Jun 2007 18:18:38 -0700
Subject: [Wtr-general] OT: ruby/eclipse question
Message-ID: <970956b0706131818j7ac4f5eeq4f100942d8be6269@mail.gmail.com>
Hey, I know a few of y'all use Eclipse so I figured its worth a shot to ask
this here.
The shop I'm working for has a bunch of (non-GUI) automation written in
Python, to which I'll be adding some GUI scripts written in Ruby/Watir.
There is an existing svn repository like
https://OurSVNrepository.com/svn/mwtest/trunk/misc
I added a /mwtest/trunk/misc/watir folder to the project and tried to save
my .rb file there, but eclipse is complaining:
Save could not be completed.
Reason: The project trunk is supposed to have a ruby nature.
Googling: "The project trunk is supposed to have a" nature. gets me 0
results. Do I need to create a separate project for my ruby scripts? Can I
somehow give this project a 'dual nature'?
I should note that I have RDT 0.9.0 installed, and have a project for the
watir project here that works just fine (I can save to
https://svn.openqa.org/svn/watir/trunk/watir
) so my eclipse setup in general shouldn't be the issue.
Thanks,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/233d4b59/attachment.html
From arcteryx at comcast.net Wed Jun 13 21:33:16 2007
From: arcteryx at comcast.net (Jason Darling)
Date: Wed, 13 Jun 2007 20:33:16 -0500
Subject: [Wtr-general] OT: ruby/eclipse question
In-Reply-To: <970956b0706131818j7ac4f5eeq4f100942d8be6269@mail.gmail.com>
Message-ID:
Hey Jeff,
Make sure when you create your project, that it's a Ruby Project. You check
out it out from svn and then create your project/workspace as a Ruby
project. There is a little "ruby" icon that shows up for .rb files if this
is done. Are you seeing this?
Cheers,
Jason
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org]On Behalf Of Jeff Fry
Sent: Wednesday, June 13, 2007 8:19 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] OT: ruby/eclipse question
Hey, I know a few of y'all use Eclipse so I figured its worth a shot to
ask this here.
The shop I'm working for has a bunch of (non-GUI) automation written in
Python, to which I'll be adding some GUI scripts written in Ruby/Watir.
There is an existing svn repository like
https://OurSVNrepository.com/svn/mwtest/trunk/misc
I added a /mwtest/trunk/misc/watir folder to the project and tried to save
my .rb file there, but eclipse is complaining:
Save could not be completed.
Reason: The project trunk is supposed to have a ruby nature.
Googling: "The project trunk is supposed to have a" nature. gets me 0
results. Do I need to create a separate project for my ruby scripts? Can I
somehow give this project a 'dual nature'?
I should note that I have RDT 0.9.0 installed, and have a project for the
watir project here that works just fine (I can save to
https://svn.openqa.org/svn/watir/trunk/watir ) so my eclipse setup in
general shouldn't be the issue.
Thanks,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/94b3d6b9/attachment-0001.html
From charley.baker at gmail.com Wed Jun 13 21:56:38 2007
From: charley.baker at gmail.com (Charley Baker)
Date: Wed, 13 Jun 2007 19:56:38 -0600
Subject: [Wtr-general] OT: ruby/eclipse question
In-Reply-To:
References: <970956b0706131818j7ac4f5eeq4f100942d8be6269@mail.gmail.com>
Message-ID:
Hey Jeff,
You can create a .project file at the root of your project directory and
put this in it - replace project_name with your project name.
project_name
org.rubypeople.rdt.core.rubybuilder
org.rubypeople.rdt.core.rubynature
-Charley
On 6/13/07, Jason Darling wrote:
>
> Hey Jeff,
>
> Make sure when you create your project, that it's a Ruby Project. You
> check out it out from svn and then create your project/workspace as a Ruby
> project. There is a little "ruby" icon that shows up for .rb files if
> this is done. Are you seeing this?
>
> Cheers,
> Jason
>
> -----Original Message-----
> *From:* wtr-general-bounces at rubyforge.org [mailto:
> wtr-general-bounces at rubyforge.org]*On Behalf Of *Jeff Fry
> *Sent:* Wednesday, June 13, 2007 8:19 PM
> *To:* wtr-general at rubyforge.org
> *Subject:* [Wtr-general] OT: ruby/eclipse question
>
> Hey, I know a few of y'all use Eclipse so I figured its worth a shot to
> ask this here.
>
> The shop I'm working for has a bunch of (non-GUI) automation written in
> Python, to which I'll be adding some GUI scripts written in Ruby/Watir.
>
> There is an existing svn repository like https://OurSVNrepository.com/svn/mwtest/trunk/misc
>
>
> I added a /mwtest/trunk/misc/watir folder to the project and tried to save
> my .rb file there, but eclipse is complaining:
> Save could not be completed.
> Reason: The project trunk is supposed to have a ruby nature.
>
> Googling: "The project trunk is supposed to have a" nature. gets me 0
> results. Do I need to create a separate project for my ruby scripts? Can I
> somehow give this project a 'dual nature'?
>
> I should note that I have RDT 0.9.0 installed, and have a project for the
> watir project here that works just fine (I can save to https://svn.openqa.org/svn/watir/trunk/watir
> ) so my eclipse setup in general shouldn't be the issue.
>
> Thanks,
> Jeff
>
> --
> http://testingjeff.wordpress.com
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/828756b0/attachment.html
From jeff.fry at gmail.com Wed Jun 13 22:05:24 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Wed, 13 Jun 2007 19:05:24 -0700
Subject: [Wtr-general] OT: ruby/eclipse question
In-Reply-To:
References:
Message-ID: <4670A264.7040507@gmail.com>
Thanks Jason,
Normally I do that, but I didn't with this one because when I created it
it was a Python project. That said - I found the solution. I went
exploring again and found the amusingly straightforward Project > Add
Ruby Nature...which did the trick.
It leaves me wondering what a project nature in eclipse is, and what it
means for a project to have more than one nature. Definitely one of the
most metaphysical roadblocks I've stumbled across in recent months.
Jeff "Off looking for 'Add Buddha Nature
'" Fry
Jason Darling wrote:
> Hey Jeff,
>
> Make sure when you create your project, that it's a Ruby Project. You
> check out it out from svn and then create your project/workspace as a
> Ruby project. There is a little "ruby" icon that shows up for .rb
> files if this is done. Are you seeing this?
>
> Cheers,
> Jason
>
> -----Original Message-----
> *From:* wtr-general-bounces at rubyforge.org
> [mailto:wtr-general-bounces at rubyforge.org]*On Behalf Of *Jeff Fry
> *Sent:* Wednesday, June 13, 2007 8:19 PM
> *To:* wtr-general at rubyforge.org
> *Subject:* [Wtr-general] OT: ruby/eclipse question
>
> Hey, I know a few of y'all use Eclipse so I figured its worth a
> shot to ask this here.
>
> The shop I'm working for has a bunch of (non-GUI) automation
> written in Python, to which I'll be adding some GUI scripts
> written in Ruby/Watir.
>
> There is an existing svn repository like
> https://OurSVNrepository.com/svn/mwtest/trunk/misc
>
>
> I added a /mwtest/trunk/misc/watir folder to the project and tried
> to save my .rb file there, but eclipse is complaining:
> Save could not be completed.
> Reason: The project trunk is supposed to have a ruby nature.
>
> Googling: "The project trunk is supposed to have a" nature. gets
> me 0 results. Do I need to create a separate project for my ruby
> scripts? Can I somehow give this project a 'dual nature'?
>
> I should note that I have RDT 0.9.0 installed, and have a project
> for the watir project here that works just fine (I can save to
> https://svn.openqa.org/svn/watir/trunk/watir
> ) so my eclipse
> setup in general shouldn't be the issue.
>
> Thanks,
> Jeff
>
> --
> http://testingjeff.wordpress.com
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070613/6a641127/attachment.html
From forum-watir-users at openqa.org Thu Jun 14 00:29:03 2007
From: forum-watir-users at openqa.org (sapna)
Date: Wed, 13 Jun 2007 23:29:03 CDT
Subject: [Wtr-general] Want to display data in the same row using Puts
In-Reply-To:
Message-ID: <30960400.8271181795373730.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Thanks a lot Zeljko. Is there any book to refer regarding WATIR for beginner.
From angrez at gmail.com Thu Jun 14 00:50:21 2007
From: angrez at gmail.com (Angrez Singh)
Date: Thu, 14 Jun 2007 10:20:21 +0530
Subject: [Wtr-general] Want to display data in the same row using Puts
In-Reply-To: <30960400.8271181795373730.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References:
<30960400.8271181795373730.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
Hi,
The question you asked was related to Ruby and not to Watir. I think you
should start reading the book "Programming Ruby". It will be there in your
installation directory i.e. where you have installed ruby.
- Angrez
On 6/14/07, sapna wrote:
>
> Thanks a lot Zeljko. Is there any book to refer regarding WATIR for
> beginner.
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070614/e24da194/attachment.html
From forum-watir-users at openqa.org Thu Jun 14 04:27:55 2007
From: forum-watir-users at openqa.org (imran)
Date: Thu, 14 Jun 2007 03:27:55 CDT
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <46703B0E.6080908@pettichord.com>
Message-ID: <36648699.9211181809705192.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, Bret
Thanks.
Its a health application deployed at my machine locally. So no one can access it from abroad.
Actually its a Microsoft Tab Strip, the better way to explain it i found a link.
Please follow it.
http://msdn2.microsoft.com/en-us/library/ms529257.aspx
Thanks waiting for the response.
Kind Regards,
M.Imran
From zeljko.filipin at gmail.com Thu Jun 14 05:33:11 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Thu, 14 Jun 2007 11:33:11 +0200
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To: <467032D8.7000402@pettichord.com>
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<4669A305.4080609@pettichord.com>
<970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com>
<970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com>
<4669C6F2.70807@pettichord.com>
<467032D8.7000402@pettichord.com>
Message-ID:
On 6/13/07, Bret Pettichord wrote:
>
> What happens if you don't use the "--include-dependencies" option?
It politely asks if I want to install dependencies. :)
Works fine that way. Thanks Bret.
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070614/ade31f1b/attachment.html
From forum-watir-users at openqa.org Thu Jun 14 05:58:33 2007
From: forum-watir-users at openqa.org (Simba)
Date: Thu, 14 Jun 2007 04:58:33 CDT
Subject: [Wtr-general] OnMouseOver EVENT error
Message-ID: <23240489.51181815144176.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Below is the Csstest.rb
# feature tests for css
# revision: $Revision: 962 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/setup'
class TC_CSS < Test::Unit::TestCase
include Watir
def divTester( message )
divs = $ie.getIE.document.getElementsByTagName("DIV")
puts "Found #{divs.length} div tags"
divs.each do |d|
puts "Checking div #{d.id}"
puts "div #{d.invoke("id") } class is #{d.invoke("className") }"
end
end
def isMessageDisplayed(message)
s = false
divs = $ie.getIE.document.getElementsByTagName("DIV")
#puts "Found #{divs.length} div tags"
divs.each do |d|
#puts "----Checking div #{d.id} innertext is ( #{d.innerText} )"
if d.innerText.to_s.downcase.match( /#{message}/i )
#puts "div #{d.invoke("id") } class is #{d.invoke("className") }"
if d.invoke("className").to_s.downcase.match(/show/i)
#puts "message is shown!!!"
s = true
end
end
end
#puts "Not Shown " if s== false
return s
end
def gotoCSSPage
$ie.goto($htmlRoot + "cssTest.html")
end
def test_SuccessMessage
gotoCSSPage
sleep(5)
$ie.button( :caption , "Success").click
#isMessageDisplayed( "Success" )
#divTester( "Success" )
assert( isMessageDisplayed("Success") )
$ie.button( :caption , "Failure").fire_event("onmouseover")
assert(!isMessageDisplayed("Success") )
end
end
=================================================================================
Below is the Code for Csstest.html
Test Hidden Message
=========================================================================
When i Run Csstest.rb file , Last assertion is failing (Ie assert(!isMessageDisplayed("Success") )) Any reason why this failing?
From forum-watir-users at openqa.org Thu Jun 14 08:48:24 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Thu, 14 Jun 2007 07:48:24 CDT
Subject: [Wtr-general] Save results to file
In-Reply-To: <36B5DBA88E027F47812ED877C6A978D801372E2E@rc-mail.relocationcentral.com>
Message-ID: <23366909.551181825334774.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
I am very close, this finds the links but errors on a variable and the .txt file is empty
#-------------------------------------------------------------------------------------------------------------#
#
# I'm a Pretty Flower Box
#
#
#
#------------------------------------------------------------------------------------------------------------#
require 'watir' # the watir controller
# set a variable
test_site = 'http://www.google.com'
# set the log file
textlog = File.open("text.log", File::CREAT|File::APPEND|File::WRONLY)
# open the IE browser
ie = Watir::IE.new
# print some comments
puts "## Beginning of test: Google search"
puts " "
ie.goto(test_site)
puts " Action: entered " + test_site + " in the address bar."
ie.text_field(:name, "q").set("Beer + Bottle + Label") # q is the name of the search field
puts "Step 3: click the 'Google Search' button"
ie.button(:name, "btnG").click # "btnG" is the name of the Search button
puts " Action: clicked the Google Search button."
puts "Expected Result: "
puts " - a Google page with results should be shown."
puts "Iterate thru links on page a pull them into txt file "
puts "Test Passed. Found the test string: 'Beer Bottle Label'."
ie.links.each do |link| # for each link on the current page in IE...
textlog.puts link.src # print url of the link in the textlog we
created end
# createdtextlog.puts "Here's some stuff"
puts "## End of test: Google search"
if ie.contains_text("Beer + Bottle + Label")
else
puts "Test Failed!"
end
From tester.paul at gmail.com Thu Jun 14 09:45:17 2007
From: tester.paul at gmail.com (Paul Carvalho)
Date: Thu, 14 Jun 2007 09:45:17 -0400
Subject: [Wtr-general] Save results to file
In-Reply-To: <23366909.551181825334774.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E2E@rc-mail.relocationcentral.com>
<23366909.551181825334774.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <37c405480706140645x5500df3du2b44eec40a622e94@mail.gmail.com>
Hey B! Just a few things.
First off, there is a more efficient way of opening a file for writing. Try
the following instead:
textlog = File.open("text.log", "w")
Secondly, when I run your script, the text.log file is *not* empty. There
are in fact 70 blank lines in the output file. That tells me something. It
tells me that you are correctly opening and writing to the file, but you
just aren't capturing the right information somewhere.
I replaced your link iteration with the following and I got the log file to
list all the URL's:
ie.links.each do |link|
textlog.puts link.href
end
Is that what you wanted to do? If not, please post some more details with
what you are looking for and we'll try to help.
Cheers! Paul C.
On 14/06/07, B Smith wrote:
>
> I am very close, this finds the links but errors on a variable and the
> .txt file is empty
>
>
>
>
> #-------------------------------------------------------------------------------------------------------------#
> #
> # I'm a Pretty Flower Box
> #
> #
> #
>
> #------------------------------------------------------------------------------------------------------------#
>
> require 'watir' # the watir controller
>
> # set a variable
> test_site = 'http://www.google.com'
> # set the log file
> textlog = File.open("text.log", File::CREAT|File::APPEND|File::WRONLY)
>
> # open the IE browser
> ie = Watir::IE.new
> # print some comments
> puts "## Beginning of test: Google search"
> puts " "
> ie.goto(test_site)
> puts " Action: entered " + test_site + " in the address bar."
> ie.text_field(:name, "q").set("Beer + Bottle + Label") # q is
> the name of the search field
> puts "Step 3: click the 'Google Search' button"
> ie.button(:name, "btnG").click # "btnG" is the name of the Search
> button
> puts " Action: clicked the Google Search button."
>
> puts "Expected Result: "
> puts " - a Google page with results should be shown."
> puts "Iterate thru links on page a pull them into txt file "
> puts "Test Passed. Found the test string: 'Beer Bottle Label'."
> ie.links.each do |link| # for each link on the current page in IE...
> textlog.puts link.src # print url of the link in the textlog we
> created end
> # createdtextlog.puts "Here's some stuff"
>
> puts "## End of test: Google search"
> if ie.contains_text("Beer + Bottle + Label")
> else
> puts "Test Failed!"
> end
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070614/9b703dc6/attachment.html
From forum-watir-users at openqa.org Thu Jun 14 10:16:52 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Thu, 14 Jun 2007 09:16:52 CDT
Subject: [Wtr-general] Save results to file
In-Reply-To: <37c405480706140645x5500df3du2b44eec40a622e94@mail.gmail.com>
Message-ID: <29780406.1951181830642841.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Thanks,
That worked.
From bret at pettichord.com Thu Jun 14 18:28:53 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Thu, 14 Jun 2007 17:28:53 -0500
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <36648699.9211181809705192.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36648699.9211181809705192.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <4671C125.4010706@pettichord.com>
imran wrote:
> Actually its a Microsoft Tab Strip, the better way to explain it i found a link.
> Please follow it.
>
> http://msdn2.microsoft.com/en-us/library/ms529257.aspx
>
> Thanks waiting for the response.
>
OK. That is not ActiveX (i guessed wrong). It is a server-side code.
When it hits the browser, it will be transformed into traditional HTML
elements. You can see them using View Source. That is what Watir works with.
Bret
From bret at pettichord.com Thu Jun 14 18:43:45 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Thu, 14 Jun 2007 17:43:45 -0500
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To:
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com> <4669A305.4080609@pettichord.com> <970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com> <970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com> <4669C6F2.70807@pettichord.com> <467032D8.7000402@pettichord.com>
Message-ID: <4671C4A1.3070900@pettichord.com>
?eljko Filipin wrote:
> On 6/13/07, *Bret Pettichord* > wrote:
>
> What happens if you don't use the "--include-dependencies" option?
>
>
> It politely asks if I want to install dependencies. :)
> Works fine that way. Thanks Bret.
Since we are still supporting 1.8.2 (esp. for modal dialog support), we
should document this somewhere.
From jeff.fry at gmail.com Thu Jun 14 19:24:45 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Thu, 14 Jun 2007 16:24:45 -0700
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To: <4671C4A1.3070900@pettichord.com>
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<4669A305.4080609@pettichord.com>
<970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com>
<970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com>
<4669C6F2.70807@pettichord.com>
<467032D8.7000402@pettichord.com>
<4671C4A1.3070900@pettichord.com>
Message-ID: <970956b0706141624h56bb05c5xec84478fa5e31c3a@mail.gmail.com>
On 6/14/07, Bret Pettichord wrote:
>
> ?eljko Filipin wrote:
> > On 6/13/07, *Bret Pettichord* > > wrote:
> >
> > What happens if you don't use the "--include-dependencies" option?
> >
> >
> > It politely asks if I want to install dependencies. :)
> > Works fine that way. Thanks Bret.
> Since we are still supporting 1.8.2 (esp. for modal dialog support), we
> should document this somewhere.
OK, readme.rb seems to be a reasonable option, unless this needs more space
than we need there. Even then, perhaps the readme would point to a page on
the wiki.
Here's the current (relevant) text:
To Install Ruby: http://ruby-lang.org
Best is to use Ruby 1.8.2-14 or later.
However, if you are using the Watir::IE#modal_dialog method, you must use
Ruby 1.8.2-14 and not a more recent version.
Watir (in general) will not work with Ruby 1.8.1-13. (This version of
Ruby has a bad WIN32OLE library.)
To Install Watir:
Best way to install is to use the gem.
From your command line:
> gem install win32-process --include-dependencies
> gem install watir
This will download and install watir, win32-process and all dependencies.
A few questions coming out of this conversation.
1. When we say "if you are using the Watir::IE#modal_dialog method,
you must use Ruby 1.8.2-14 and not a more recent version." Do we
really mean 1.8.2-14? It sounds like 1.8.2-15 worked correctly with
--include-dependencies. Can we safely just change references from
1.8.2-14 to 1.8.2-15?
2. If not, should we change the above to:
To Install Watir:
Best way to install is to use the gem.
From your command line:
> gem install win32-process
You will be prompted to install dependencies. Say yes.
> gem install watir
This will download and install watir, win32-process and all dependencies.
One more question: Do these instructions change in any way if you have a
previous version installed? If so, what should I know to add?
Thoughts?
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070614/a3f44e47/attachment.html
From forum-watir-users at openqa.org Fri Jun 15 04:41:30 2007
From: forum-watir-users at openqa.org (imran)
Date: Fri, 15 Jun 2007 03:41:30 CDT
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <4671C125.4010706@pettichord.com>
Message-ID: <36275577.8831181896920914.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, Bret
Thanks.
Now, there is another approach to handle this situation, following is the link to hit the required tab.
action="CCAdmissionDefAdmissionInfo.aspx?&Mode=1&UniqueID=69504512&Key2DSInSession=ASP.CCAdmissionDefGeneral_aspx69504512&CallerPage=CCAdmissionDefGeneral.aspx&MainTableID=421651&MainTableMode=1&NavigatingToDetailPage=1&NavigateToDetailPage=CCAdmissionDefAdmissionInfo.aspx&LookupName=CCAdmission&ID=421651&ReturningFromDetail=1"
I can go to that page using this dynamic URL, but in this case one of the field is dynamically generated and contains the session id so when i use this hardcoded url i can not get that session field. Could you tell me how to get that session id from the server so that i could use ie.goto(site) line to follow the link.
sesion key is Key2DSInSession=ASP.CCAdmissionDefGeneral_aspx69504512
Here dynamic portion is 69504512, this number represent the session thats why i can not move to that page.
When i try to use that number in new browser it does not work and say no such session key exist.
Can you help me how to get that dynamic number from the server.
Waiting for you response.
Kind Regards,
M.Imran
From forum-watir-users at openqa.org Fri Jun 15 06:22:26 2007
From: forum-watir-users at openqa.org (Bface)
Date: Fri, 15 Jun 2007 05:22:26 CDT
Subject: [Wtr-general] WET or WATIR, support for DIV tag
Message-ID: <32843964.10181181902976614.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
I am new to WET / WATIR
Trying to script this site that uses DIV dynamically generated. I am using WET/Ruby. Using the Ruby text editor to see how the test runs.
However, I get an error when I script click on DIV
See:
ie.Frame('name:=nav').document.all['297'].click
ie.Frame('name:=content2').div('id:Opener_cont_live').click
I get this error
bug1499.rb:19: undefined method `div' for # (NoMethodError)
How do I get round this because the CMS I am testing does not support selenium and I need to parameterise the test
Should I use WATIR ? If yes, how do I get started with WATIR asap. I am confused
Please urgent help
From forum-watir-users at openqa.org Fri Jun 15 07:23:47 2007
From: forum-watir-users at openqa.org (Bface)
Date: Fri, 15 Jun 2007 06:23:47 CDT
Subject: [Wtr-general] WET or WATIR, support for DIV tag
In-Reply-To: <32843964.10181181902976614.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <31527414.10651181906657495.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hello,
No one is contributing?
>From what I can see, DIV is not supported by WET, but supported using WATIR. However, I prefer using WET. How can I include WATIR so that all supported tags in WATIR will work in my Ruby test code that is based on WET
Then I will be able to use DIV
Thanks Expert
From zeljko.filipin at gmail.com Fri Jun 15 07:29:14 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Fri, 15 Jun 2007 13:29:14 +0200
Subject: [Wtr-general] WET or WATIR, support for DIV tag
In-Reply-To: <31527414.10651181906657495.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <32843964.10181181902976614.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<31527414.10651181906657495.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
On 6/15/07, Bface wrote:
>
> No one is contributing?
I guess they are sleeping now. Maybe you should post this question at wet
forum?
Zeljko
--
ZeljkoFilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/efdcee3a/attachment.html
From mrussell at inpses.co.uk Fri Jun 15 12:46:40 2007
From: mrussell at inpses.co.uk (Max Russell)
Date: Fri, 15 Jun 2007 17:46:40 +0100
Subject: [Wtr-general] Load error
Message-ID:
Hi there, I'm getting the following.
`require': no such file to load -- watir (LoadError)
I've checked the FAQs and downloaded the latest 1.5 version for my Ruby
version 1.8.6.
I've listed my local gems and I can see that water is installed, yet
whenever I try and run my script, I still get the error?
Max Russell
Test Analyst
INPS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/89558cc5/attachment.html
From arcteryx at comcast.net Fri Jun 15 13:38:05 2007
From: arcteryx at comcast.net (Jason Darling)
Date: Fri, 15 Jun 2007 12:38:05 -0500
Subject: [Wtr-general] Load error
In-Reply-To:
References:
Message-ID: <7860894a0706151038u2bdbe5ceo6e2c847137ffdbe1@mail.gmail.com>
can you post your test script? it would help to diagnose your problem.
Cheers,
Jason
On 6/15/07, Max Russell wrote:
>
> Hi there, I'm getting the following.
>
>
>
> `require': no such file to load -- watir (LoadError)
>
>
>
> I've checked the FAQs and downloaded the latest 1.5 version for my Ruby
> version 1.8.6.
>
> I've listed my local gems and I can see that water is installed, yet
> whenever I try and run my script, I still get the error?
>
>
>
>
>
> *Max Russell*
> Test Analyst
> INPS**
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/7572b157/attachment.html
From bret at pettichord.com Fri Jun 15 13:42:57 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Fri, 15 Jun 2007 12:42:57 -0500
Subject: [Wtr-general] Best Combination of Ruby and Watir
In-Reply-To: <970956b0706141624h56bb05c5xec84478fa5e31c3a@mail.gmail.com>
References: <30534709.9331181298147654.JavaMail.oqa-j2ee@openqa01.managed.contegix.com> <4669A305.4080609@pettichord.com> <970956b0706081228g25486f3y7f670474a6321f7f@mail.gmail.com> <970956b0706081353l356b4530kebc93fbea9639941@mail.gmail.com> <4669C6F2.70807@pettichord.com> <467032D8.7000402@pettichord.com> <4671C4A1.3070900@pettichord.com>
<970956b0706141624h56bb05c5xec84478fa5e31c3a@mail.gmail.com>
Message-ID: <4672CFA1.6020906@pettichord.com>
Jeff Fry wrote:
>
> 1. When we say "if you are using the Watir::IE#modal_dialog method,
> you must use Ruby 1.8.2-14 and not a more recent version." Do we
> really mean 1.8.2-14? It sounds like 1.8.2-15 worked correctly
> with --include-dependencies. Can we safely just change
> references from 1.8.2-14 to 1.8.2-15?
> 2. If not, should we change the above to:
>
Yeah, i'm wondering if we should just tell people not to use 1.8.2-14.
> To Install Watir:
> Best way to install is to use the gem.
> From your command line:
> > gem install win32-process
> You will be prompted to install dependencies. Say yes.
> > gem install watir
> This will download and install watir, win32-process and all
> dependencies.
>
> One more question: Do these instructions change in any way if you have
> a previous version installed? If so, what should I know to add?
Yes. See here for details:
http://wiki.openqa.org/display/WTR/Development+Builds
From christopher.mcmahon at gmail.com Fri Jun 15 14:04:17 2007
From: christopher.mcmahon at gmail.com (Chris McMahon)
Date: Fri, 15 Jun 2007 12:04:17 -0600
Subject: [Wtr-general] OT-ish: How many reqistered OpenQA Watir users?
Message-ID: <72799cd70706151104h4d6ce9cve6b71bcb8eb66f08@mail.gmail.com>
I'm interested in how many registered users the project has.
Other information like page traffic, downloads, would be fun to know also.
From bret at pettichord.com Fri Jun 15 14:16:39 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Fri, 15 Jun 2007 13:16:39 -0500
Subject: [Wtr-general] OT-ish: How many reqistered OpenQA Watir users?
In-Reply-To: <72799cd70706151104h4d6ce9cve6b71bcb8eb66f08@mail.gmail.com>
References: <72799cd70706151104h4d6ce9cve6b71bcb8eb66f08@mail.gmail.com>
Message-ID: <4672D787.4030200@pettichord.com>
Chris McMahon wrote:
> I'm interested in how many registered users the project has.
> Other information like page traffic, downloads, would be fun to know also.
>
I don't believe users register for specific projects. You can ask
Patrick for the other information.
Bret
From bret at pettichord.com Fri Jun 15 14:18:40 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Fri, 15 Jun 2007 13:18:40 -0500
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <36275577.8831181896920914.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36275577.8831181896920914.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <4672D800.1080509@pettichord.com>
Can you find the session key in the page itself?
From bret at pettichord.com Fri Jun 15 14:19:37 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Fri, 15 Jun 2007 13:19:37 -0500
Subject: [Wtr-general] frames and url()
In-Reply-To:
References:
Message-ID: <4672D839.90802@pettichord.com>
Chong Jiang wrote:
> Is there some way to return the url of a frame, for example,
> ie.frame(:index, 1), so I can navigate to the page with a goto?
ie.frame(:index, 1).url
From jeff.fry at gmail.com Fri Jun 15 14:30:15 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Fri, 15 Jun 2007 11:30:15 -0700
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <4672D800.1080509@pettichord.com>
References: <36275577.8831181896920914.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<4672D800.1080509@pettichord.com>
Message-ID: <970956b0706151130mef7ff03r44e8b8e77e463201@mail.gmail.com>
Another approach might be to work around not knowing the session key with
regular expressions, perhaps something like:
$ie.form(:action, /CCAdmissionDefAdmissionInfo.aspx/)
Note that ie.form and :action above are blind guesses, since I haven't
worked tabs like this, but hopefully illustrate how you would use a regular
expression to identify an element by a substring.
Regexes can be used in many many more complex ways. See for example
http://www.regular-expressions.info/
Jeff
On 6/15/07, Bret Pettichord wrote:
>
> Can you find the session key in the page itself?
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/8bc20df5/attachment-0001.html
From jeff.fry at gmail.com Fri Jun 15 15:20:33 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Fri, 15 Jun 2007 12:20:33 -0700
Subject: [Wtr-general] Understanding down_load_time on AJAXy pages
Message-ID: <970956b0706151220w1d66ba3an5ebbbc3a4dd45e86@mail.gmail.com>
Hi,
The app I'm testing has very dynamic pages, constructed by a series of
queries, leading to certain elements loading faster than others. I'd like to
benchmark how long it takes for various pages to load. Toward that end I
wrote:
100.times do
url = $url_root + "/view?id=%239202a8c04000641f8000000000056de6"
start = Time.now
$ie.goto(url)
if $ie.link(:text,'Million Dollar Baby').exists?
$results_array << $ie.down_load_time.to_s
p '$ie.down_load_time: '+$ie.down_load_time.to_s
else # there's a problem with the page
$results_array << 'e'
p 'e'
end #if
took = Time.now - start
p 'Took: ' + took.to_s
end #N.times do
Which yields results like:
>ruby performance_benchmark2.rb
Loaded suite performance_benchmark2
Started
"$ie.down_load_time: 1.993"
"Took: 2.434"
"$ie.down_load_time: 2.473"
"Took: 2.583"
"$ie.down_load_time: 2.404"
"Took: 2.564"
I'm curious why I get up to .5 seconds more for 'took' than I do for
down_load_time. Does down_load_time have a way of knowing when everything on
the page has finished loading on a page where various elements render in
phases?
I can include more of my script if that's helpful. Our site freebase.com is
in an invite-only alpha right now, but if anyone wants to dig further into
this I would happily forward along on invite.
Thanks,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/fc41c55f/attachment.html
From forum-watir-users at openqa.org Fri Jun 15 19:11:16 2007
From: forum-watir-users at openqa.org (Bach Le)
Date: Fri, 15 Jun 2007 18:11:16 CDT
Subject: [Wtr-general] Our contribution to Watir
Message-ID: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hello all,
We've been working with Watir for a while now and sort of using watir was a browser driver for our monitoring product. Internally, there were monitoring directives/functions that we found useful in our proprietary monitoring language. I've reproduced these functions to be used with watir as we move to a more open platform.
The details can be found at [http://jira.openqa.org/browse/WTR-162|http://jira.openqa.org/browse/WTR-162]
Please take a look and contribute any comments or code where you can. Any help would be appreciated.
Our view is that Watir is a useful tool in automated testing and we are trying to use that to develop a package that could be paired with Watir for performance testing. This contribution is only the beginning. We have more useful things that will be coming down the pipe and we look forward to contributing more in the future.
Bach Le
Software Engineer
Webmetrics Inc.
bmle at webmetrics.com
From jeff.fry at gmail.com Fri Jun 15 20:43:45 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Fri, 15 Jun 2007 17:43:45 -0700
Subject: [Wtr-general] Breaking code into several classes and methods
Message-ID: <970956b0706151743h41fab083o930968aee2c0c56f@mail.gmail.com>
Hi all,
I'm using my trusty pickaxe plus various code samples to try to take a
script of mine and break it up a bit into several classes and methods within
classes...and getting stuck.
When I run the code below, I get:
test_benchmark_page(TC_PerformanceBenchmark):
NoMethodError: undefined method `link_to_text' for #
performance_benchmark2.rb:56:in `benchmark'
performance_benchmark2.rb:54:in `times'
performance_benchmark2.rb:54:in `benchmark'
performance_benchmark2.rb:69:in `test_benchmark_page'
It complains about this line in particular:
if $ie.link(:text, page.link_to_text).exists?
But when I try it in irb it seems that page.link_to_text shouldn't be a
problem:
irb(main):040:0> $page = Page.new("c_eastwood",
"/view?id=%239202a8c04000641f800000000056de6", "Mystic River")
=> #
irb(main):041:0> $page.link_to_test
=> "Mystic River"
Here's my relevant code:
class TC_PerformanceBenchmark < Test::Unit::TestCase
...
def benchmark(page)
1.times do
$ie.goto($url_root + page.url)
if $ie.link(:text, page.link_to_text).exists?
$results_array << $ie.down_load_time.to_s
p '$ie.down_load_time: '+$ie.down_load_time.to_s
else
$results_array << 'e'
p 'e'
end #if
end #do
end
def test_benchmark_page
login($url_root, $user, $pw)
$page = Page.new("c_eastwood",
"/view?id=%239202a8c04000641f8000000000056de6", "Mystic River")
benchmark($page)
end
end #class
class Page
def initialize (key, url, link_to_test)
@key = key
@url = url
@link_to_test = link_to_test
end
attr_reader :key
attr_reader :url
attr_reader :link_to_test
end
Any ideas?
Thanks,
Jeff
--
http://testingjeff.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070615/e921ea6e/attachment.html
From aidy.lewis at googlemail.com Sat Jun 16 03:53:12 2007
From: aidy.lewis at googlemail.com (aidy lewis)
Date: Sat, 16 Jun 2007 08:53:12 +0100
Subject: [Wtr-general] Our contribution to Watir
In-Reply-To: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com>
On 16/06/07, Bach Le wrote:
> The details can be found at [http://jira.openqa.org/browse/WTR-162|http://jira.openqa.org/browse/WTR-162]
There is no project on this URL.
Cheers
Aidy
From jeff.fry at gmail.com Sun Jun 17 11:39:26 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Sun, 17 Jun 2007 08:39:26 -0700
Subject: [Wtr-general] Our contribution to Watir
In-Reply-To: <7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com>
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com>
Message-ID: <467555AE.6050404@gmail.com>
aidy lewis wrote:
> On 16/06/07, Bach Le wrote:
>
>> The details can be found at [http://jira.openqa.org/browse/WTR-162|http://jira.openqa.org/browse/WTR-162]
>>
>
> There is no project on this URL.
>
>
The url got doubled. If you take either side of the bar it works - and
looks interesting!
http://jira.openqa.org/browse/WTR-162
Thanks Bach &etc. for passing this on!
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070617/de8acd69/attachment.html
From charley.baker at gmail.com Sat Jun 16 18:35:43 2007
From: charley.baker at gmail.com (Charley Baker)
Date: Sat, 16 Jun 2007 16:35:43 -0600
Subject: [Wtr-general] Our contribution to Watir
In-Reply-To: <467555AE.6050404@gmail.com>
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com>
<467555AE.6050404@gmail.com>
Message-ID:
It's great to have user contributions, I haven't had a chance to look at it
yet, but will soon. Instead of adding it to a jira ticket, you should add
it to the user contribution area of the wiki on openqa.
http://wiki.openqa.org/display/WTR/Contributions
-Charley
On 6/17/07, Jeff Fry wrote:
>
> aidy lewis wrote:
>
> On 16/06/07, Bach Le wrote:
>
> The details can be found at [http://jira.openqa.org/browse/WTR-162|http://jira.openqa.org/browse/WTR-162]
>
> There is no project on this URL.
>
> The url got doubled. If you take either side of the bar it works - and
> looks interesting!
>
> http://jira.openqa.org/browse/WTR-162
>
> Thanks Bach &etc. for passing this on!
>
> Jeff
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070616/3326b34e/attachment.html
From bret at pettichord.com Sat Jun 16 18:42:16 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Sat, 16 Jun 2007 17:42:16 -0500
Subject: [Wtr-general] Our contribution to Watir
In-Reply-To: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <46746748.2070103@pettichord.com>
Bach Le wrote:
> The details can be found at [http://jira.openqa.org/browse/WTR-162|http://jira.openqa.org/browse/WTR-162]
>
> Please take a look and contribute any comments or code where you can. Any help would be appreciated.
>
Thanks for the contribution. We will be looking at it.
Bret
From bret at pettichord.com Sat Jun 16 18:45:45 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Sat, 16 Jun 2007 17:45:45 -0500
Subject: [Wtr-general] Our contribution to Watir
In-Reply-To:
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com> <7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com> <467555AE.6050404@gmail.com>
Message-ID: <46746819.3070309@pettichord.com>
Charley Baker wrote:
> It's great to have user contributions, I haven't had a chance to look
> at it yet, but will soon. Instead of adding it to a jira ticket, you
> should add it to the user contribution area of the wiki on openqa.
> http://wiki.openqa.org/display/WTR/Contributions
I've been talking the people at Webmetrics off-list. They would like
their enhancements to be bundled in the watir gem. I explained that we
would need unit tests and need to review the enhancements for
consistency with the Watir design principles. Submissions via Jira are
appropriate for this kind of thing. For changes, we prefer a patch file,
but since this submission amounts to a monkey patch, it's current form
is acceptable.
Just for the record, we don't have these constraints (tests,
consistency) for code that submitted to the contributions page of the wiki.
Bret
From aidy.lewis at googlemail.com Sun Jun 17 04:44:28 2007
From: aidy.lewis at googlemail.com (aidy lewis)
Date: Sun, 17 Jun 2007 09:44:28 +0100
Subject: [Wtr-general] Porting Watir to JRuby
In-Reply-To:
References:
Message-ID: <7ac2300c0706170144m480f3668r6b61673b256ae5ec@mail.gmail.com>
Hi,
On 13/06/07, Nick Sieger wrote:
> On 6/13/07, Nivetha Padmanaban wrote:
> >
> > Any plans of porting WATIR to JRuby??
>
> None that I know of at the moment. The stumbling block is to get a
> compatible version of 'win32ole' on JRuby which we don't have.
Watij uses Groovy as it's scripting language. Groovy is a dynamic
lanagage that exists within a JVM. Groovy can access COM.
http://groovy.codehaus.org/COM+Scripting
aidy
From paul.rogers at shaw.ca Sun Jun 17 09:54:38 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Sun, 17 Jun 2007 07:54:38 -0600
Subject: [Wtr-general] Breaking code into several classes and methods
References: <970956b0706151743h41fab083o930968aee2c0c56f@mail.gmail.com>
Message-ID: <00be01c7b0e7$0c6184c0$6400a8c0@laptop>
a very quick look suggesrs you need
if $ie.link(:text, $page.link_to_text ).exists?
in place of
if $ie.link(:text, page.link_to_text ).exists?
----- Original Message -----
From: Jeff Fry
To: wtr-general at rubyforge.org
Sent: Friday, June 15, 2007 6:43 PM
Subject: [Wtr-general] Breaking code into several classes and methods
Hi all,
I'm using my trusty pickaxe plus various code samples to try to take a script of mine and break it up a bit into several classes and methods within classes...and getting stuck.
When I run the code below, I get:
test_benchmark_page(TC_PerformanceBenchmark):
NoMethodError: undefined method `link_to_text' for #
performance_benchmark2.rb:56:in `benchmark'
performance_benchmark2.rb:54:in `times'
performance_benchmark2.rb:54:in `benchmark'
performance_benchmark2.rb:69:in `test_benchmark_page'
It complains about this line in particular:
if $ie.link(:text, page.link_to_text).exists?
But when I try it in irb it seems that page.link_to_text shouldn't be a problem:
irb(main):040:0> $page = Page.new("c_eastwood", "/view?id=%239202a8c04000641f800000000056de6", "Mystic River")
=> #
irb(main):041:0> $page.link_to_test
=> "Mystic River"
Here's my relevant code:
class TC_PerformanceBenchmark < Test::Unit::TestCase
...
def benchmark(page)
1.times do
$ie.goto($url_root + page.url)
if $ie.link(:text, page.link_to_text ).exists?
$results_array << $ie.down_load_time.to_s
p '$ie.down_load_time: '+$ie.down_load_time.to_s
else
$results_array << 'e'
p 'e'
end #if
end #do
end
def test_benchmark_page
login($url_root, $user, $pw)
$page = Page.new("c_eastwood", "/view?id=%239202a8c04000641f8000000000056de6", "Mystic River")
benchmark($page)
end
end #class
class Page
def initialize (key, url, link_to_test)
@key = key
@url = url
@link_to_test = link_to_test
end
attr_reader :key
attr_reader :url
attr_reader :link_to_test
end
Any ideas?
Thanks,
Jeff
--
http://testingjeff.wordpress.com
------------------------------------------------------------------------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070617/48993a75/attachment.html
From paul.rogers at shaw.ca Sun Jun 17 10:06:12 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Sun, 17 Jun 2007 08:06:12 -0600
Subject: [Wtr-general] Our contribution to Watir
References: <32105796.15641181949107087.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<7ac2300c0706160053q58671b5erce58acb21b8a131c@mail.gmail.com>
<467555AE.6050404@gmail.com>
<46746819.3070309@pettichord.com>
Message-ID: <00e501c7b0e8$a9b39b90$6400a8c0@laptop>
looking at the methods provided, it would seem that some are definite
candidates for inclusion the dialog code for example )
some of the others, like the regex methods, dont seem to be particularly
suited watir.
But saying that, thanks for the contributions, they are always welcome, and
give people ideas of what can be done
Paul
----- Original Message -----
From: "Bret Pettichord"
To:
Sent: Saturday, June 16, 2007 4:45 PM
Subject: Re: [Wtr-general] Our contribution to Watir
> Charley Baker wrote:
>> It's great to have user contributions, I haven't had a chance to look
>> at it yet, but will soon. Instead of adding it to a jira ticket, you
>> should add it to the user contribution area of the wiki on openqa.
>> http://wiki.openqa.org/display/WTR/Contributions
> I've been talking the people at Webmetrics off-list. They would like
> their enhancements to be bundled in the watir gem. I explained that we
> would need unit tests and need to review the enhancements for
> consistency with the Watir design principles. Submissions via Jira are
> appropriate for this kind of thing. For changes, we prefer a patch file,
> but since this submission amounts to a monkey patch, it's current form
> is acceptable.
>
> Just for the record, we don't have these constraints (tests,
> consistency) for code that submitted to the contributions page of the
> wiki.
>
> Bret
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
From bret at pettichord.com Sun Jun 17 11:09:23 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Sun, 17 Jun 2007 10:09:23 -0500
Subject: [Wtr-general] Breaking code into several classes and methods
In-Reply-To: <970956b0706151743h41fab083o930968aee2c0c56f@mail.gmail.com>
References: <970956b0706151743h41fab083o930968aee2c0c56f@mail.gmail.com>
Message-ID: <46754EA3.5050301@pettichord.com>
Jeff Fry wrote:
> It complains about this line in particular:
> if $ie.link(:text, page.link_to_text).exists?
>
> But when I try it in irb it seems that page.link_to_text shouldn't be
> a problem:
> irb(main):040:0> $page = Page.new("c_eastwood",
> "/view?id=%239202a8c04000641f800000000056de6", "Mystic River")
> => # @url="/view?id=%239202a8c0400641f8000000000056de6", @key="c_eastwood">
> irb(main):041:0> $page.link_to_test
> => "Mystic River"
you've confused link_to_text for link_to_test
From bret at pettichord.com Sun Jun 17 11:22:39 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Sun, 17 Jun 2007 10:22:39 -0500
Subject: [Wtr-general] Understanding down_load_time on AJAXy pages
In-Reply-To: <970956b0706151220w1d66ba3an5ebbbc3a4dd45e86@mail.gmail.com>
References: <970956b0706151220w1d66ba3an5ebbbc3a4dd45e86@mail.gmail.com>
Message-ID: <467551BF.1080307@pettichord.com>
Jeff Fry wrote:
> 100.times do
> url = $url_root + "/view?id=%239202a8c04000641f8000000000056de6"
> start = Time.now
> $ie.goto(url)
> if $ie.link(:text,'Million Dollar Baby').exists?
> $results_array << $ie.down_load_time.to_s
> p '$ie.down_load_time: '+$ie.down_load_time.to_s
> else # there's a problem with the page
> $results_array << 'e'
> p 'e'
> end #if
> took = Time.now - start
>
> I'm curious why I get up to .5 seconds more for 'took' than I do for
> down_load_time. Does down_load_time have a way of knowing when
> everything on the page has finished loading on a page where various
> elements render in phases?
You should take a look at the code in the wait method that compiles the
download_time (which really is the page load time).
ie.goto calls navigate before starting the counter, you could measure it
to see how much time it is taking.
You are also calling ie.link().exists? before stopping your counter and
it is also probably taking some time.
Bret
From bret at pettichord.com Sun Jun 17 11:31:03 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Sun, 17 Jun 2007 10:31:03 -0500
Subject: [Wtr-general] how to properly use the snippet function?
In-Reply-To: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <25003293.371181723737709.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <467553B7.7090104@pettichord.com>
reinier wrote:
> I am trying to get rid of all cookies via a function.
> On this forum I found the Snippet thingy.
> http://rubyforge.org/snippet/detail.php?type=snippet&id=26
> So I included that code in my script and trying to use it, but I can't figure out how.
>
> this is the code:
> [code]
> DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 'V')
> [/code]
>
> So what function should be called to delete all the cookies
main
From forum-watir-users at openqa.org Mon Jun 18 01:47:02 2007
From: forum-watir-users at openqa.org (imran)
Date: Mon, 18 Jun 2007 00:47:02 CDT
Subject: [Wtr-general] Microsoft Tab Strip Issues - urgent
In-Reply-To: <970956b0706151130mef7ff03r44e8b8e77e463201@mail.gmail.com>
Message-ID: <26274769.371182145652273.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hi, Bret
Thanks.
I will try the regular expression. If you means to say any hidden parameter as session key then no.
I need to work on regular expressions. thanks for the link. I will let you know about the progress i made.
I think microsft tab strip support must be added to the watir.
Also if one wants to add one's own function then what one will have to do. Please refer any site "How to contribute to watir and what are the required skills."
Thanks again.
Kind Regards,
M.Imran
From forum-watir-users at openqa.org Mon Jun 18 02:50:41 2007
From: forum-watir-users at openqa.org (kumari)
Date: Mon, 18 Jun 2007 01:50:41 CDT
Subject: [Wtr-general] Not able to find the title of newly opened window.
In-Reply-To: <28774252.3491181251065197.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <33371265.751182149471352.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
i think the window doesn't have URL ,it has only tiltle which can't be caputred before clicking the link.And the title is with respect to name of the person which changes depending on the link which we r clicking.
From manish at gslab.com Mon Jun 18 02:57:23 2007
From: manish at gslab.com (Manish Sapariya)
Date: Mon, 18 Jun 2007 12:27:23 +0530
Subject: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks is withdrawn
Message-ID: <46762CD3.2030109@gslab.com>
I am trying to access following url for last two days,
but no success.
http://cruisecontrolrb.thoughtworks.com/
Is anybody out here facing same problem.
Thanks,
Manish
From mrussell at inpses.co.uk Mon Jun 18 04:34:52 2007
From: mrussell at inpses.co.uk (Max Russell)
Date: Mon, 18 Jun 2007 09:34:52 +0100
Subject: [Wtr-general] Load Error
Message-ID:
>can you post your test script? it would help to diagnose your problem.
# Simple test harness
require 'watir'
require 'watir/testcase'
#require 'test/unit'
#$LOAD_PATH << '..' if $0 == __FILE__
$LOAD_PATH << './Tests'
class TestSuite < Watir::TestCase
File.open(ARGV[0]).each_line do |entry|
code = lambda{load "#{entry.strip}.rb" }
self.send(:define_method, entry.strip, code)#{load
"#{entry.strip}.rb" }#puts "#{entry.strip}"
#self.send(:public, entry.strip.to_sym )
end
end
if $0 == __FILE__
require 'test/unit/ui/console/testrunner'
Test::Unit::UI::Console::TestRunner.run(TestSuite)
End
Done, the only change I've made from the previously working version is
that this should take command line arguments.
I don't believe this has anything to do with my script at all, but
something to do with the environment it's running under.
Ruby 1.8.6 watir 1.5 - I did have all this working some time ago. The
only real updates have been the Ruby and WATiR versions.
Max Russell
Test Analyst
INPS
Tel: 01382564346
Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ
Registered Number: 1788577
Registered in the UK
Visit our Internet Web site at www.inps.co.uk
The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpdesk at inps.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070618/33bdee4b/attachment-0001.html
From forum-watir-users at openqa.org Mon Jun 18 07:52:44 2007
From: forum-watir-users at openqa.org (sourabh jain)
Date: Mon, 18 Jun 2007 06:52:44 CDT
Subject: [Wtr-general] How to get properties of a JSP page using Watir.
Message-ID: <24767057.2411182167594511.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
hi
i am trying to automate a jsp page. when i am doing ie.showAllObjects its only showing
HTML Document name=MX_HIDDEN id=MX_HIDDEN src=javascript:document.writeln();document.close()
HTML Document name= id= src=MxPortal.jsp
I want to click a link using watir methods but since all the properties are hidden i am not able to go to that particular link.
i also used firefox with firebug to get the properties or DOM of that page but i am getting only html source code. and the source code of the page is disabled.
if i do ie.html then its displaying following code and the information about the link name is not visible.
""
is there any way to get the link name and parent frame of that particular link.
From forum-watir-users at openqa.org Mon Jun 18 08:45:48 2007
From: forum-watir-users at openqa.org (mihai)
Date: Mon, 18 Jun 2007 07:45:48 CDT
Subject: [Wtr-general] control existing IE window?
Message-ID: <28456310.3211182170778265.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
how can i control a already IE opened window
for example if i have www.google.com window open but not with watir can i associate a variable $ie to that window an then click links etc using that variable?
From zeljko.filipin at gmail.com Mon Jun 18 08:54:56 2007
From: zeljko.filipin at gmail.com (=?UTF-8?Q?=C5=BDeljko_Filipin?=)
Date: Mon, 18 Jun 2007 14:54:56 +0200
Subject: [Wtr-general] control existing IE window?
In-Reply-To: <28456310.3211182170778265.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <28456310.3211182170778265.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID:
>From WATIR User Guide (http://wtr.rubyforge.org/watir_user_guide.html),
section New Windows.
ie = Watir::IE.attach(:url, 'http://mytestsite')
ie = Watir::IE.attach(:title, 'Test New Window')
ie = Watir::IE.attach(:title, /Test New/)
Zeljko
--
ZeljkoFilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070618/c070ec96/attachment.html
From forum-watir-users at openqa.org Mon Jun 18 09:02:55 2007
From: forum-watir-users at openqa.org (mihai)
Date: Mon, 18 Jun 2007 08:02:55 CDT
Subject: [Wtr-general] control existing IE window?
In-Reply-To: <28456310.3211182170778265.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <38062644.3951182171805431.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
tnx a lot
From jeff.fry at gmail.com Tue Jun 19 10:53:35 2007
From: jeff.fry at gmail.com (Jeff Fry)
Date: Tue, 19 Jun 2007 07:53:35 -0700
Subject: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks is
withdrawn
In-Reply-To: <46762CD3.2030109@gslab.com>
References: <46762CD3.2030109@gslab.com>
Message-ID: <4677EDEF.1090200@gmail.com>
Manish Sapariya wrote:
> I am trying to access following url for last two days,
> but no success.
>
> http://cruisecontrolrb.thoughtworks.com/
>
> Is anybody out here facing same problem.
>
Just tried and yes, it times out for me too. Not sure what's on which
page, but http://rubyforge.org/projects/cruisecontrolrb/ works, if that
helps. Otherwise, you could try the mailing list
http://www.nabble.com/CruiseControl.rb---Users-f22849.html to find out
what's up at ThoughtWorks.
Jeff
From forum-watir-users at openqa.org Mon Jun 18 11:24:06 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Mon, 18 Jun 2007 10:24:06 CDT
Subject: [Wtr-general] iterate thru forum
Message-ID: <34250428.4641182180276531.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
I am trying to develop a check for replies vs. views for a forum.
Problems,
A) dynamically find categories
B) dynamically iterate thru topics to cull answer
Since I am still new to WATIR, I don't know howto set up the iteration
and I'm trying to get the navstrip info so that I know what area the info
came from
Any help appreciated
--------------.rb starts -------------------------------------
#--------------------------------------------------------------#
#
#
# Edit of Simple LAWSON SITE check
#
#
#------------------------------------------------------------------#
require 'watir' # the watir controller
# set a variable
base_site = 'http://lawsontalk.com/index.php'
forum_detail = '?showforum=17'
test_site = base_site + forum_detail
# open the IE browser
ie = Watir::IE.new
# print some comments
puts "## Beginning; open Lawsontalk"
puts " "
puts "go to the test site: " + test_site
ie.goto(test_site)
puts " Action: entered " + test_site + " in the address bar."
# Set Login Info - This WORKS
# puts " Action: Enter Login info for forum"
# ie.text_field(:name, "UserName").set("Login")
# ie.text_field(:name, "PassWord").set("Password")
# This should press 'GO' button to complete login, disabled for testing
# ie.button(:name, "Go").click
# Once Logged in perform Housekeeping
#
# this should be LawsonTalk -> Community -> General
Thread_area = ie.div(:id, "navstrip")
# this should be an iteration of all forum topics
Topic = ie.row(:row, "forum topics")
# Compare Replies to Views
# If views > 50 and Replies = 0 then Thread requires attention
puts " Action: Find threads not answered"
puts " The following Topic" + Topic + " in area" + Thread_area + " has " + Views + " and no replies, this may require attention "
puts " "
# end of test
puts "## End of test"
# End
-------------.rb ends-------------------------------------
From bret at pettichord.com Mon Jun 18 13:01:15 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Mon, 18 Jun 2007 12:01:15 -0500
Subject: [Wtr-general] Load Error
In-Reply-To:
References:
Message-ID: <4676BA5B.3000504@pettichord.com>
Max Russell wrote:
>
> > can you post your test script? it would help to diagnose your problem.
>
>
>
> # Simple test harness
>
What was your original question? Your reply was not indexed with the
original post.
Bret
From bret at pettichord.com Mon Jun 18 13:09:59 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Mon, 18 Jun 2007 12:09:59 -0500
Subject: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks is
withdrawn
In-Reply-To: <46762CD3.2030109@gslab.com>
References: <46762CD3.2030109@gslab.com>
Message-ID: <4676BC67.9040501@pettichord.com>
Manish Sapariya wrote:
> I am trying to access following url for last two days,
> but no success.
>
> http://cruisecontrolrb.thoughtworks.com/
>
>
See http://rubyforge.org/projects/cruisecontrolrb/
Both Alexey and Jeremy have made commits in the past week, but it does
look like the project has lost some degree of support from TW.
Here's the place to ask:
http://rubyforge.org/pipermail/cruisecontrolrb-users/
From forum-watir-users at openqa.org Mon Jun 18 13:25:57 2007
From: forum-watir-users at openqa.org (B Smith)
Date: Mon, 18 Jun 2007 12:25:57 CDT
Subject: [Wtr-general] iterate thru forum
In-Reply-To: <34250428.4641182180276531.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <26091920.5071182187587376.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
I got this far on my own
table = ie.table(:index,5)
v_3 = table[1][3].to_s
v_4 = table[1][4].to_s
v_5 = table[1][5].to_s
v_6 = table[1][6].to_s
variable = v_3 + " " + v_4 + " " + v_5 + " " + v_6
puts variable
This now returns the HEADER row from the correct table in the page. HOW DO I set this to iterate thru all the threads??
I saw a forum posting for counting links :: ie.(:index,1).links.length, but it isn't working for my variable.
thanks,
From jfitisoff at yahoo.com Mon Jun 18 13:33:49 2007
From: jfitisoff at yahoo.com (John Fitisoff)
Date: Mon, 18 Jun 2007 10:33:49 -0700 (PDT)
Subject: [Wtr-general] control existing IE window?
In-Reply-To: <28456310.3211182170778265.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <32526.10633.qm@web54109.mail.re2.yahoo.com>
ie = IE.attach(:title, /TitlebarText/)
--- mihai wrote:
> how can i control a already IE opened window
> for example if i have www.google.com window open but
> not with watir can i associate a variable $ie to
> that window an then click links etc using that
> variable?
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/
From bret at pettichord.com Mon Jun 18 14:29:36 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Mon, 18 Jun 2007 13:29:36 -0500
Subject: [Wtr-general] Not able to find the title of newly opened window.
In-Reply-To: <33371265.751182149471352.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <33371265.751182149471352.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <4676CF10.5050405@pettichord.com>
kumari wrote:
> i think the window doesn't have URL ,it has only tiltle which can't be caputred before clicking the link.And the title is with respect to name of the person which changes depending on the link which we r clicking.
Every browser window has a URL. Sometimes the browser will hide the URL
widget. But it still has a URL and watir can use it.
From exortech at gmail.com Mon Jun 18 14:30:57 2007
From: exortech at gmail.com (Owen Rogers)
Date: Mon, 18 Jun 2007 11:30:57 -0700
Subject: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks is
withdrawn
In-Reply-To: <46762CD3.2030109@gslab.com>
References: <46762CD3.2030109@gslab.com>
Message-ID:
On 17/06/07, Manish Sapariya wrote:
> I am trying to access following url for last two days,
> but no success.
>
> http://cruisecontrolrb.thoughtworks.com/
>
> Is anybody out here facing same problem.
try now. the server needed a reboot.
cheers,
owen.
--
Owen Rogers | http://dotnetjunkies.com/weblog/exortech |
CruiseControl.NET - http://ccnet.thoughtworks.com
From forum-watir-users at openqa.org Mon Jun 18 15:23:00 2007
From: forum-watir-users at openqa.org (Lauren)
Date: Mon, 18 Jun 2007 14:23:00 CDT
Subject: [Wtr-general] Method Precedence confusion
Message-ID: <30223399.5701182194610910.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Hello,
I apologize for my confusion yet again, but I hope this will be a simple answer for someone...
I have written a script that asserts whether labels on a page exist or not. Here is a small snippet of code to serve as an example:
class TC_banking_info_labels < Test::Unit::TestCase
include Watir
def test_bank_name
assert($ie.span(:text, "bank name").exists?)
$logger.log(" FOUND! Banking Information: 'Bank Name' field...")
end
end
I have discovered that the order of operation within the class is alphabetical. (method test_a* will execute before test_z*). My problem is that I have a teardown script located in another file. I can access the methods in the files just fine by accessing them directly. For example by typing in:
$close_logger
$close_browser
The problem with that is that my teardown methods/variables get executed before my Test::Unit::TestCase classes/methods which causes my browser to close before my tests are executed, which causes all 66 of my tests to fail.
Here are the contents of my teardown.rb script:
require 'watir'
#includes for using logger
require 'example_logger1'
$close_logger = $logger.log("## Testing Complete ##")
$close_browser = $ie.close
My question is: How can I call this teardown script into my test script and have it executed LAST. How do I control the order in which methods are executed?
As always, thank you for your help. I have been researching quite a bit about methods & classes, etc...but there is still a disconnect somewhere...and I am stuck.
From areed at relocationcentral.com Mon Jun 18 15:29:00 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Mon, 18 Jun 2007 14:29:00 -0500
Subject: [Wtr-general] Method Precedence confusion
In-Reply-To: <30223399.5701182194610910.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <30223399.5701182194610910.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E36@rc-mail.relocationcentral.com>
The teardown script automatically runs at the completion of all test
functions. The alphabetical order only affects multiple test_*
functions. If you have:
def setup
end
def test_01
end
def test_02
end
def teardown
end
They will run in this order: setup, test_01, teardown, setup, test_02,
teardown. So if you have 66 tests, only the ones that are called after
the first testname should fail, because you're closing the browser and
the logger after the first test runs.
Hope that helps,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Lauren
Sent: Monday, June 18, 2007 2:23 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Method Precedence confusion
Hello,
I apologize for my confusion yet again, but I hope this will be a simple
answer for someone...
I have written a script that asserts whether labels on a page exist or
not. Here is a small snippet of code to serve as an example:
class TC_banking_info_labels < Test::Unit::TestCase
include Watir
def test_bank_name
assert($ie.span(:text, "bank name").exists?)
$logger.log(" FOUND! Banking Information: 'Bank Name' field...")
end
end
I have discovered that the order of operation within the class is
alphabetical. (method test_a* will execute before test_z*). My problem
is that I have a teardown script located in another file. I can access
the methods in the files just fine by accessing them directly. For
example by typing in:
$close_logger
$close_browser
The problem with that is that my teardown methods/variables get executed
before my Test::Unit::TestCase classes/methods which causes my browser
to close before my tests are executed, which causes all 66 of my tests
to fail.
Here are the contents of my teardown.rb script:
require 'watir'
#includes for using logger
require 'example_logger1'
$close_logger = $logger.log("## Testing Complete ##")
$close_browser = $ie.close
My question is: How can I call this teardown script into my test script
and have it executed LAST. How do I control the order in which methods
are executed?
As always, thank you for your help. I have been researching quite a bit
about methods & classes, etc...but there is still a disconnect
somewhere...and I am stuck.
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From forum-watir-users at openqa.org Mon Jun 18 16:40:52 2007
From: forum-watir-users at openqa.org (Lauren)
Date: Mon, 18 Jun 2007 15:40:52 CDT
Subject: [Wtr-general] Method Precedence confusion
In-Reply-To: <36B5DBA88E027F47812ED877C6A978D801372E36@rc-mail.relocationcentral.com>
Message-ID: <30372873.6121182199282899.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Yes Indeed! Your reply was a great help! Your explanation was so clear - I don't know how I missed that in the first place!
I have redesigned my tests. There are only 4 tests now with 66 assertions only because I didn't want my browser to open and close 66x. Now it opens and closes 4 times. It does bring up an interesting discussion on method organization "best practices". For example, is it better to have one or two assertions per test case, or 4 test cases with 66 assertions between them...
Anyway. I am all set for now...Onward and upward! Many thanks to you, Adam.
From areed at relocationcentral.com Mon Jun 18 16:55:43 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Mon, 18 Jun 2007 15:55:43 -0500
Subject: [Wtr-general] Method Precedence confusion
In-Reply-To: <30372873.6121182199282899.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E36@rc-mail.relocationcentral.com>
<30372873.6121182199282899.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E39@rc-mail.relocationcentral.com>
Glad I could help. One thing you'd have most likely noticed if you were
to run those 66 separate functions is an "RPC Error" that would stop
your testing cold. Eventually IE can't open/close fast enough to keep
up with the script, and basically crashes itself. So, you're already
one step ahead on best practices there.
I generally keep my test cases organized by objective or method of
testing. For instance, if it's a simple navigation test, I'll keep all
the sidebar navigation element testing in one case, and the main div
navigation elements in another, etc. If I'm testing forms, each form
will get a separate case, etc.
However, I also have one script that checks our dynamically created
pages for a specific link -- I query the DB for the pages that should
exist and check each for the target link in a loop. That single test
case has around 16,000 assertions because of that loop. The one thing
that makes this test remain useful is effective logging and error
reporting.
Thanks,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Lauren
Sent: Monday, June 18, 2007 3:41 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Method Precedence confusion
Yes Indeed! Your reply was a great help! Your explanation was so clear -
I don't know how I missed that in the first place!
I have redesigned my tests. There are only 4 tests now with 66
assertions only because I didn't want my browser to open and close 66x.
Now it opens and closes 4 times. It does bring up an interesting
discussion on method organization "best practices". For example, is it
better to have one or two assertions per test case, or 4 test cases with
66 assertions between them...
Anyway. I am all set for now...Onward and upward! Many thanks to you,
Adam.
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From paul.rogers at shaw.ca Mon Jun 18 16:59:42 2007
From: paul.rogers at shaw.ca (Paul Rogers)
Date: Mon, 18 Jun 2007 14:59:42 -0600
Subject: [Wtr-general] Fwd: Re: Fwd: Re: OT: Is cruisecontrol.rb by
thoughworks is withdrawn
Message-ID:
heres why cruise.rb was down
-------------- next part --------------
An embedded message was scrubbed...
From: Alexey Verkhovsky
Subject: Re: Fwd: Re: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks is
withdrawn
Date: Mon, 18 Jun 2007 15:19:04 -0500
Size: 6064
Url: http://rubyforge.org/pipermail/wtr-general/attachments/20070618/1d44f5b2/attachment.mht
From bret at pettichord.com Mon Jun 18 16:59:57 2007
From: bret at pettichord.com (Bret Pettichord)
Date: Mon, 18 Jun 2007 15:59:57 -0500
Subject: [Wtr-general] Method Precedence confusion
In-Reply-To: <36B5DBA88E027F47812ED877C6A978D801372E39@rc-mail.relocationcentral.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E36@rc-mail.relocationcentral.com> <30372873.6121182199282899.JavaMail.oqa-j2ee@openqa01.managed.contegix.com>
<36B5DBA88E027F47812ED877C6A978D801372E39@rc-mail.relocationcentral.com>
Message-ID: <4676F24D.7020205@pettichord.com>
Adam Reed wrote:
> Glad I could help. One thing you'd have most likely noticed if you were
> to run those 66 separate functions is an "RPC Error" that would stop
> your testing cold. Eventually IE can't open/close fast enough to keep
> up with the script, and basically crashes itself. So, you're already
> one step ahead on best practices there.
>
Actually, this problem can be avoided if you use the latest version of
Watir and the new "IE.new_process" method. This is what i am using in my
tests when i have to close and re-open the browser.
Bret
From areed at relocationcentral.com Mon Jun 18 17:07:22 2007
From: areed at relocationcentral.com (Adam Reed)
Date: Mon, 18 Jun 2007 16:07:22 -0500
Subject: [Wtr-general] Method Precedence confusion
In-Reply-To: <4676F24D.7020205@pettichord.com>
References: <36B5DBA88E027F47812ED877C6A978D801372E36@rc-mail.relocationcentral.com> <30372873.6121182199282899.JavaMail.oqa-j2ee@openqa01.managed.contegix.com><36B5DBA88E027F47812ED877C6A978D801372E39@rc-mail.relocationcentral.com>
<4676F24D.7020205@pettichord.com>
Message-ID: <36B5DBA88E027F47812ED877C6A978D801372E3B@rc-mail.relocationcentral.com>
Aha - I haven't been keeping up with the new release docs. I'll have to
try that out. Thanks
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Bret Pettichord
Sent: Monday, June 18, 2007 4:00 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Method Precedence confusion
Adam Reed wrote:
> Glad I could help. One thing you'd have most likely noticed if you
> were to run those 66 separate functions is an "RPC Error" that would
> stop your testing cold. Eventually IE can't open/close fast enough to
> keep up with the script, and basically crashes itself. So, you're
> already one step ahead on best practices there.
>
Actually, this problem can be avoided if you use the latest version of
Watir and the new "IE.new_process" method. This is what i am using in my
tests when i have to close and re-open the browser.
Bret
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
From manish at gslab.com Mon Jun 18 22:22:02 2007
From: manish at gslab.com (Manish Sapariya)
Date: Tue, 19 Jun 2007 07:52:02 +0530
Subject: [Wtr-general] OT: Is cruisecontrol.rb by thoughworks
is withdrawn
In-Reply-To:
References: <46762CD3.2030109@gslab.com>
Message-ID: <46773DCA.2070106@gslab.com>
Owen Rogers wrote:
> try now. the server needed a reboot.
> cheers,
> owen.
>
Thanks all.
-Manish
From mrussell at inpses.co.uk Tue Jun 19 04:10:54 2007
From: mrussell at inpses.co.uk (Max Russell)
Date: Tue, 19 Jun 2007 09:10:54 +0100
Subject: [Wtr-general] Load Error
Message-ID:
My original question was:
On 6/15/07, Max Russell wrote:
>
> Hi there, I'm getting the following.
>
>
>
> `require': no such file to load -- watir (LoadError)
>
>
>
> I've checked the FAQs and downloaded the latest 1.5 version for my
> Ruby version 1.8.6.
>
> I've listed my local gems and I can see that water is installed, yet
> whenever I try and run my script, I still get the error?
My script was:
# Simple test harness
require 'watir'
require 'watir/testcase'
#require 'test/unit'
#$LOAD_PATH << '..' if $0 == __FILE__
$LOAD_PATH << './Tests'
class TestSuite < Watir::TestCase
File.open(ARGV[0]).each_line do |entry|
code = lambda{load "#{entry.strip}.rb" }
self.send(:define_method, entry.strip, code)#{load
"#{entry.strip}.rb" }#puts "#{entry.strip}"
#self.send(:public, entry.strip.to_sym )
end
end
if $0 == __FILE__
require 'test/unit/ui/console/testrunner'
Test::Unit::UI::Console::TestRunner.run(TestSuite)
End
Done, the only change I've made from the previously working version is
that this should take command line arguments.
I don't believe this has anything to do with my script at all, but
something to do with the environment it's running under.
Ruby 1.8.6 watir 1.5 - I did have all this working some time ago. The
only real updates have been the Ruby and WATiR versions.
Max Russell
Test Analyst
INPS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070619/7ae6ab17/attachment-0001.html
From forum-watir-users at openqa.org Tue Jun 19 06:04:27 2007
From: forum-watir-users at openqa.org (Jason)
Date: Tue, 19 Jun 2007 05:04:27 CDT
Subject: [Wtr-general] WYSIWYG editor inside |