[Wtr-general] Unable to Click on tab - any workaround??
Paul Carvalho
tester.paul at gmail.com
Tue Apr 18 18:12:05 EDT 2006
Hi there, you've given us some information about the problem, but not enough
to provide you with an exact answer. One thing that I would recommend to
you would be to spend some more time looking at the objects on the page to
try and understand exactly how the tabs are placed on the page.
For example, in one of the web applications that I work with the tabs shown
are actually laid out within two nested tables. By using IRB and various
tries at "ie.table(:index, #).flash" I was able to find the table that holds
the clickable tab graphics and links. I also discovered that there were
extra, blank columns that I needed to avoid.
My actual script code looks something like this:
----
# Find out how many Tabs are showing. (Column count - 2 ) / 2 = # Tabs
tab_count = ($ie.frame('MainWindow').table(:index, 2).column_count - 2 ) /
2
tab_count.times do |x| # click the tabs to find the desired page
# The clickable 'tabs' are in columns 2, 4, 6...
$ie.frame('MainWindow').table(:index, 2)[1][2*(x+1)].click rescue true
sleep 1
break if $ie.frame('MainWindow').span(:id, /foo/).text == 'bar'
end
----
It took me a few minutes to work out the math, but the pattern was repeated
throughout the application so it was time well spent. There might be
different ways to do this, but that's what I came up with at the time.
I'm just offering this as an example. You will need to figure out how your
tabs are laid out on your application's web page and find a good way to
script the steps.
If there's one thing I've learned, it's that if I can click it with a mouse,
I can automate it with Watir!
Good luck!
Paul.
On 18/04/06, Anil Kumar Das <anil.kumar.das at gmail.com> wrote:
>
> I have a web application for SALES ORDER Module....
>
> -------------------------------------
> Order Detail | Parties |Line Items
> -------------------------------------
> Onclick of order detail application opens 10-20 fields to add order
> information, party tab shows 10-20 fields to enter party information and
> Line Items shows fields to enter product details
> When I saw source code of this web page I found ..
> displayZerothTab,displayFirstTab,displaySecondTab were the variables which
> takes values of onClick from user action
>
> I tried all possible following combination but couldn`t solve this issue
> # $ie.link(:url, "").click
> # $ie.button(:name, "").click
> $ie.image(:src, "").click
> $ie.link(:text, "").click
> $ie.image(:text, "").click
> $ie.link(:scr,"").click
> $ie.link(:url, "").click
> $ie.attach(:title,"").click
>
> with displaySecondTab & Line Items (lebal of this tab)
>
> I was wondering if there is any workaround for clicking "Tab" like
> button,image,url etc in watir??
> Waiting for reply
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060418/1d6b27f6/attachment.html
More information about the Wtr-general
mailing list