[wtr-general] Re: Does Watir support

2009-01-04 Thread Chuck vdL

That's a great tip Alex, and yeah that will work for really simple
stuff that doesn't have any kind of session or user id..  However,
once you login a user and start playing with session id's, or any
ASP.NET stuff designed to prevent plaback spoofing (like viewstate)
you get hosed unless the thing you are using allows you to capture
stuff from responses, and insert it into specific places in the
requests.  You'll also need the ability to read from datafiles to
substitute things like userid and login, at the HTTP level.
Otherwise you're going to have to use multiple threads and multiple
browser instances and run the stuff in watir directly where the
browser takes care of the ASP, cookies, and other session stuff, and
watir can deal with parameters for things like userid's and passwords.

The thing is, anything not dealing with sessions and transactions
(e.g. hitting db and/or middle tier) really doesn't tend to be that
'interesting' in terms of loadtests (since most of the data is static
and cached)  So in general (presuming you don't have issues with
something like oh your homepage when a new user hits it) most of the
things you could do via simple http capture and playback are not
normally the things that cause load issues..  so it's good for really
basic tests, but again not terribly useful for most serious
loadtests.


On Jan 4, 3:35 am, Alex Collins  wrote:
> On 4 Jan 2009, at 07:13, Chuck vdL wrote:
>
>
>
> >>> 5.Can be used for Load Testing?
>
> Following from Chuck's points which are all valid, I have had success  
> in using WATIR to write the script for a load test.
>
> Having written the script doing what you would like, play this into  
> jmeter using the proxy server and use jmeter to perform the load  
> generation. This captures the HTTP traffic for later playback.
>
> You normally still have to do some additional work in adapting the  
> jmeter script depending upon technologies in use and what you wish to  
> achieve.
>
> You will not get the same analysis tools as you might with the  
> commercial products, but the tools are free.
>
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Frame, nested frame

2009-01-04 Thread Jagdeep Jain

Index can also be used to differentiate b/w the similar objects/
components.

On Jan 4, 6:29 am, "Wilson Xu"  wrote:
> Please ignore 'iframe' element in your script code, you can try it again and
> can you post your html source code.
> Wilson
>
> On Wed, Dec 31, 2008 at 6:35 PM, rr  wrote:
>
> > Hi all,
> > I want to know how to write script for nested frame. I want to click
> > on object which is a link and it is in nested frame (means frame
> > inside frame) but there are 4 items in those frames. This situation
> > arises when I open my mailbox. Those 4 items are "Compose", "inbox",
> > "Folder", "Search". Only thing which differ all 4 items is 'href'. I
> > am not getting how to write script for particular item. I have used
> > ie.frame(:name, "name").frame(:name, "name") but it was not usefull as
> > number of items are there inside those frame. Please provide solution.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: text_field problem

2009-01-04 Thread Jagdeep Jain

I got into the same problem and found that whenever you are using
variable we need to use .value=variable instead of .set variable.

On Dec 31 2008, 3:39 am, sowmya  wrote:
> Never mind. It worked.
> [ie.text_field(:id, "create_id").value=(id)]
>
> On Dec 30, 2:26 pm, sowmya  wrote:
>
> > Hello,
>
> > I'm trying to set value to a text field that takes in only numeric
> > values.
>
> > 
>
> > I tried the following:
>
> > id = "123"
> > ie.text_field(:id, "create_id").fire_event("onkeypress")
> > ie.text_field(:id, "create_id").set id
>
> > But I get a pop up saying "Only numeric values allowed" three times as
> > each digit of the id is entered. I even tried entering just 1 instead
> > of 123 and I still got the same error pop-up.
>
> > Anyone has ideas on how to get around this problem?
>
> > Thanks
> > Sowmya.
>
> > P.S: I've just started using Watir. I looked through this forum to
> > make sure my question isn't duplicated, but I couldn't find any
> > answers. If you find that the question is already answered I apologize
> > - please direct me to the right thread.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Navigating to the next page problem - Javascript pop up

2009-01-04 Thread Jagdeep Jain

Hi,
The problem with the code below is that I am not able to move forward
to next page which appear after clicking on "OK" button of Java Script
pop up.

HTML is as follows:
I save this file in C: drive as test.html

   function disp_alert()
{ alert("I am an alert box!!"); }   Jagdeep 

 http://www.google.com"; onclick="disp_alert()" />
Click Here   


Watir Script is as follows:

require 'watir'
require 'watir/ie'
require 'watir/contrib/enabled_popup'
#require 'win32ole'

def startClicker( button , waitTime = 10)
  w = WinClicker.new
  longName = $ie.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb#{button} #
{waitTime}"
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
end

$ie = Watir::IE.new
$ie.goto('C:/test.html/')
startClicker("OK")
$ie.link(:text, 'Click Here').click_no_wait

Here is the code which does not shows any exception but it is also not
moving forward to the next page.
Anyone please help here.

Thanks,
Jagdeep
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: overriding javascript

2009-01-04 Thread Jagdeep Jain

Hi Aidy,

I have changed "disp_confirm" with the earlier one you have supplied
"window.confirm" and removed "JavaScript" from the end and it works
fine for me.

require 'watir'

ie = Watir::IE.new
ie.goto("http://www.w3schools.com/JS/tryit.asp?
filename=tryjs_confirm")
ie.maximize
ie.document.parentWindow.execScript("window.confirm=function(){return
true;}")
ie.frame(:name, "view").button(:value, "Display a confirm
box").click_no_wait

Thanks,
Jagdeep

On Jan 4, 3:44 am, "aidy lewis"  wrote:
> Hi Charley,
>
> Thanks for the advice but I am stilling having trouble overriding the js 
> script.
>
> require 'watir'
>
> ie = Watir::IE.new
> ie.goto("http://www.w3schools.com/JS/tryit.asp?filename=tryjs_confirm";)
> ie.document.parentWindow.execScript("'disp_confirm=function{return
> true;}', 'JavaScript'")
> ie.frame(:name, "view").button(:value, "Display a confirm box").click_no_wait
>
> Aidy
>
> 2009/1/3 Charley Baker :
>
> > Execscript exists on the window object, drop the body call from your code
> > and it should work:
> >http://msdn.microsoft.com/en-us/library/ms536420(VS.85).aspx
>
> > Charley Baker
> > blog:http://charleybakersblog.blogspot.com/
> > Project Manager, Watir,http://wtr.rubyforge.org
> > QA Architect, Gap Inc Direct
>
> > On Sat, Jan 3, 2009 at 1:05 PM, aidy lewis 
> > wrote:
>
> >> Hi,
>
> >> I am trying to override js to bypass a js dialog:
>
> >> This is what I have got:
>
> >> require 'watir'
>
> >> ie = Watir::IE.new
> >> ie.goto("http://www.w3schools.com/JS/tryit.asp?filename=tryjs_confirm";)
> >> #ie.frame(:name, "view").button(:value, "Display a confirm box").click
>
> >> ie.document.body.parentElement.execScript("window.confirm=function(){return
> >> true;}")
>
> >> I am getting unknown property or method `execScript'
>
> >> Could anyone please direct me?
>
> >> Aidy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Selenium 2.0 plans to drive native browsers

2009-01-04 Thread sai

Charley,
Along the same lines, I have been looking at other means to drive
firefox. There are a few interesting options other than what webdriver
is doing. One is Mozilla Repl from Mozilla labs. The other is SD
Connector from ActiveState. 
http://blogs.activestate.com/shanec/2008/05/jssh-replacemen.html

Please let me know if you need more info.

Regards,
Sai

On Jan 4, 10:49 pm, "aidy lewis"  wrote:
> Hi Chris,
>
> 2009/1/4 Chris :
>
> > Yes, but last I heard the implementations of Ruby in the JVM (JRuby,
> > etc) are getting pretty robust.
>
> My argument would be do we really need a JVM? Do we need Java
> libraries? Are JVM's optimised for dynamic languages? Does it matter?
>
> As an Acceptance Tester an interpreter and Ruby gems seem adequate for my 
> needs.
>
> Aidy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Screencast: an introduction to WATIR

2009-01-04 Thread Alex Collins

After an exquisite amount of procrastination, alteration and working  
around defects, I’ve completed my first screencast. I've aimed to  
provide a reasonable first-glance coverage of WATIR including the  
ubiquitous Google-search example which I have also separated out as a  
short.

I've posted these on my blog at http://www.ajcollins.com but the links  
are here for convenience. The files are in m4v format, with two  
different size options.


### short Google search example, ~3mins ###

Small, 9MB
http://screencasts.ajcollins.com/watir/001-google-example/001-google-example-small.m4v

Large, 17MB
http://screencasts.ajcollins.com/watir/001-google-example/001-google-example.m4v.zip


### An introduction to WATIR, ~22mins ###

Small, 27MB
http://screencasts.ajcollins.com/watir/002-introduction/002-introduction-to-WATIR-small.m4v

Large, 36MB
http://screencasts.ajcollins.com/watir/002-introduction/002-introduction-to-WATIR.m4v.zip



Having now worked out how to produce these, I'm planning to put  
together a few more examples of how to handle certain situations and  
showing automation of well known websites.

Topics I'm considering:

- A screencast of the WATIR tutorial
- Using firebug / IE dev toolbar
- Provide screencast examples of public sites eg Google Maps, BBC News
- Popups: javascript, additional windows
- Frameworks: simple tests in a variety of ways for comparison
- Screen scraping
- Using WATIR scripts to drive jmeter for basic load / performance  
testing
- Use of Hudson CI and WATIR

I would greatly appreciate any constructive feedback on any aspect of  
the screencast. If you'd like to suggest a topic or would like to see  
one of the above topics covered, please let me know.

Would it be useful to have a smaller version of the Google search  
example?

Best wishes,

Alex


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Function to flush the variable in RUBY / WATIR

2009-01-04 Thread Bret Pettichord

When you capitalize your variable (Status) it becomes a constant and 
retains its value. You need to make it lower case instead (status).

Bret

Amit wrote:
> Hi,
> Is there any function to flush the value from a variable in RUBY /
> WATIR. I am facing problem while following code
> I am trying to use following code
>
> Status=sheet1.getCellByPosition(5, I).Formula
> ie.text_field(:name, "FieldName").value =Status
>
>
> and it works fine, but On itetrating this piece of code for multiple I/
> Ps, variable 'name', retains its old value for some of the cases. I
> identified this as a cache problem. Please suggest if there any flush
> () type function or action in Ruby/watir to clear the garbage value.
>
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Selenium 2.0 plans to drive native browsers

2009-01-04 Thread aidy lewis

Hi Chris,

2009/1/4 Chris :

> Yes, but last I heard the implementations of Ruby in the JVM (JRuby,
> etc) are getting pretty robust.

My argument would be do we really need a JVM? Do we need Java
libraries? Are JVM's optimised for dynamic languages? Does it matter?

As an Acceptance Tester an interpreter and Ruby gems seem adequate for my needs.

Aidy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Selenium 2.0 plans to drive native browsers

2009-01-04 Thread Chris



On Jan 3, 11:55 am, "aidy lewis"  wrote:
> Chris wrote
>
> > but I would not be surprised in the coming years to see Selenium and Watir 
> > growing closer together.
>
> I am not so sure these worlds will collide, however we can learn and
> borrow off each other.
> Selenium and WebDriver are primarily Java apps, the family of Watir
> tools are explicitly Ruby.

Yes, but last I heard the implementations of Ruby in the JVM (JRuby,
etc) are getting pretty robust.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Pulling hair out on screen scraping

2009-01-04 Thread Bissquitt

ok thank you all so much. I got the majority of the code working. This
is what I have so far.

while contLoop do colVal = worksheet.Cells(row, 'a').Value
  if (colVal) then
  browser.goto("http://bookstore.umbc.edu/SelectCourses.aspx?
src=2&type=2&stoid=9&trm=Spring%2009&cid=" + colVal)

  var = browser.span(:id, /
rptCourses_ctl00_rptItems_ctl\d\d_lblItemTxtTitle/).text
  worksheet.Cells(row, 'b').value = var

  else
  contLoop = false
  end

  row +=  1
  sleep 1
end

Do you know of an easy way to itterate through each span that watches
the above regex and only ones that match or do I need to go through
all and parse each individualy?

I was trying something like this but i couldnt get it to work. (are
span and spans the same? I only saw documentation for spans)
   browser.spans.each(:id, /
rptCourses_ctl00_rptItems_ctl\d\d_lblItemTxtTitle/).text

if that can't be done I guess I will just be storing each span into a
string, look for the regex and go to next.

Thanks again guys


On Jan 3, 3:41 pm, "Charley Baker"  wrote:
> It can be a bit overwhelming to learn Ruby and various libraries at the same
> time. I'd recommend taking a look at the Pickaxe 
> book:http://whytheluckystiff.net/ruby/pickaxe/  just to get some general
> familiarity. There are other Ruby tutorials online as well as some good
> books - The Ruby Way, Everyday Scripting, OReilly's Ruby book.
> succ! as you mention below is a Ruby core method. Gotapi also has a good
> searchable reference to Ruby standard api.http://www.gotapi.com/html click
> on the Ruby Standard Packages. The pickaxe book from the link above also has
> an index of the core api, many with examples.
> Here's a link to the Watir rdocs in case you might find that 
> useful.http://wtr.rubyforge.org/rdoc/and a link to supported elements(though
> openqa is down right 
> now):http://wiki.openqa.org/display/WTR/Methods+supported+by+Element
>
> Strange that the hpricot site is down now as well.
>
> Another useful way to learn how to use libraries in Ruby is by taking a look
> at their unit tests. Watir has a large number of unit tests, hpricot has
> some too. They're located under your ruby install directory in gems.
>
> Ruby comes with a few documentation systems: ri and rdoc. For the gems you
> have installed locally you can see all of the rdocs by going to the command
> line, type:
> gem server
> Then browse tohttp://localhost:8808
> ri can also be used from the command line:
> ri String::succ!
>
> Additional responses inline:
>
>
>
>
>
> On Sat, Jan 3, 2009 at 10:31 AM, Bissquitt  wrote:
>
> > Regarding documentation, I read the Tutorial all the way through but
> > it only hit on a few specific examples leaving out other commands all
> > together. I've visited MANY ruby and watir sites and never once saw
> > the .span command (does it just search for  tags? guess ill
> > google it after this post) I never even found a site listing all the
> > watir commands (http://us.php.net/manual/en/function.abs.php) as an
> > example. In addition there are SO MANY tutorials and such online that
> > are all very poorly done it makes finding a good one via google a
> > needle in a haystack scenario. ie (oh great, you showed me that
> > specific command, but showed me nothing about how that command works
> > so unless I want to use it exactly the way you used it, its useless).
> > My example here is the "ruby on windows" site. If I google for
> > anything regarding ruby and excel I either get that site, or another
> > site that just provides me a link to that site and am forced to make
> > due with that site in order to teach myself how to interact with
> > excel. The site itself lists a BUNCH of examples but leaves it up to
> > you to try and pick apart the syntax to understand what it is doing.
> > For example:
>
> > line = '1'
> > while worksheet.Range("a#{line}")['Value']
> >   line.succ!
> > end
> > #line now holds row number of first empty row
>
> > What on earth does .succ! do? It never tells me. The site, and most
> > that ive seen, are written not to target new people and tutor them but
> > to target advanced users with a more "so heres a cool way to approach
> > the problem" approach. A simple "ok, here is the the excel class, here
> > are the comands in it and what they do, here is a syntax example"
> > would be far more helpful as it doesn't leave anything out. I'm still
> > not sure if its possible to return what row the active cell is on.
>
> Excel is a strange one. :) Agreed that most sites assume a basic familiarity
> with Ruby, and with the links above you should be able to get into it fairly
> quickly. Accessing Excel is done through it's COM interface, so one of the
> best sources of documentation is actually the Excel VBA Microsoft help file.
> There's a link to the standalone version of it somewhere on the internets if
> you don't have it installed. There are some excel libraries on our

[wtr-general] Re: Does Watir support

2009-01-04 Thread Alex Collins


On 4 Jan 2009, at 07:13, Chuck vdL wrote:

>
>>> 5.Can be used for Load Testing?
>

Following from Chuck's points which are all valid, I have had success  
in using WATIR to write the script for a load test.

Having written the script doing what you would like, play this into  
jmeter using the proxy server and use jmeter to perform the load  
generation. This captures the HTTP traffic for later playback.

You normally still have to do some additional work in adapting the  
jmeter script depending upon technologies in use and what you wish to  
achieve.

You will not get the same analysis tools as you might with the  
commercial products, but the tools are free.

Alex

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---