How do I get the URL in IE?

A. Use the autoit function library with the win32OLE extension library…
You will need to install autoit. You can download it here, once installed you can call the function library using the win32OLE extension library.

require 'watir'
require 'rubygems'
require 'win32ole'
autoit = WIN32OLE.new('AutoItX3.Control')
url = autoit.ControlGetText("[CLASS:IEFrame]", "", "Edit1")
puts "url is " + url

The defintion for the autoit function ‘ControlGetText’ is ControlGetText(title, text, controlId)
You can use the “AutoIt Window Info” tool to find the title and controlId, you do not need to use the ‘text’ parameter. I find that using the Class instead of the window title a neater and more accurate solution.

Read More

Throughput vs. Latency

When/if I am asked to conduct interviews again for potential performance test analysts, I think I will include this question in my repertoire to suss out those in the know, and those just, um, pretending …

Here is a great analogy of throughput and latency. I don’t pretend to understand queuing theory (just yet), but am working on it ;)

Read More

FireWatir 1.2.1 is released

A new version of FireWatir has been released. This includes some fixes related to Firefox 3 but more importantly, it marks the merger of FireWatir and Watir projects, allowing for tighter coupling of methods and functionality between the two, allowing you to write less code =)

To use FireWatir, you will have to install a Firefox plugin that enables use of a JavaScript Shell (jssh). FireWatir works on Windows, Mac and Linux.
Install FireWatir: [sudo] gem install FireWatir
Install Plugin: http://wiki.openqa.org/display/WTR/FireWatir

I will be using FireWatir on my mac for impromptu testing, since more recently I’ve found it beneficial to write automated test cases to provide consistent input when recording load test scenarios in JMeter or LoadRunner. For those interested in even more x-browser support, check out SafariWatir as well: http://safariwatir.rubyforge.org/

Read More

Q. How do I set a checkbox with a dynamic id attribute?

A. Use a regex match to populate a dynamic variable …
Example html:

<form action="test_0019.html" method="get" accept-charset="utf-8">
<input id="cblRoles_3" type="checkbox" tabindex="47" name="cblRoles:3"/>
<label for="cblRoles_3">Customer</label>
<input id="cblRoles_4" type="checkbox" tabindex="48" name="cblRoles:4"/>
<label for="cblRoles_4">Expedite</label>

Example watir:

dynamic_id = @b.html[/cblRoles_\d+>Expedite/].gsub(">Expedite","")
@b.checkbox(:id,dynamic_id).set
Read More

Q. How do I get to element X in frame Y?

A. Make sure you prefix your element with the correct frame reference …
Example watir:

@b.goto('http://justaddwatir.com/watir/test_html/tc_0001_0100/test_0017.html')
@b.frame(:index, 2).button(:name, "submit").click

Note: sometimes frames aren’t easily identified with id or name attributes, the example above uses the index attribute to get to the second frame in the frameset.

Read More