Re: [Wtr-general] Wikipedia Article Feedback

2006-10-10 Thread Sun
Thanks. I will say I have had no apparent problems using win32ole functionality 
with the 1.8.4 version of Ruby I have installed -- not with Watir 1.4.1, nor 
with any of the 1.5.x builds. So...maybe I have just been lucky?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4727messageID=13076#13076
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows - include Win32

2006-10-10 Thread Sun
Putting in: 
==
include Win32 
==
without quotation marks, above the:
==
def enabled_popup(timeout=4)
==
is indeed the fix.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4715messageID=13079#13079
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] watirmaker unsupported DEBUG statements

2006-09-30 Thread Sun
I find that WatirMaker is only useful to build a raw framework for a script. 
After stepping through your site, go into the created script, delete all the 
garbage (errors and failures) and then manually put in what is needed. The 
simpler the site, the fewer the errors. For a complex site the value is low.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4616messageID=12718#12718
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Fwd: Managing the Watir Project -- Wikipedia entry

2006-09-29 Thread Sun
 A separate issue is whether the Wikipedia article should include code
 that only works with an experimental library in an unreleased version of
 Watir. 

A valid point. I do point out immediately following the example that it may be 
necessary to download and install the current development Watir gem rather than 
using the standard Watir release to make sure people are aware of this. I 
assume that when the 1.5.x release is available, that this feature will be 
incorporated even if it is from that separate directory. In the mean time, 
people who read the article are informed that if they want to use this bit of 
code, they need the development gem and not the standard release.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4501messageID=12677#12677
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Fwd: Managing the Watir Project -- Wikipedia entry

2006-09-28 Thread Sun
 Sorry to vent, but I'm the author of the enabled_popup() method (which
 has been removed from watir.rb) and the one that helped Sun solve his
 problem when he presented it to the list.

If enabled_popup() has in fact been removed entirely, this will be a problem I 
think -- since I need the WinClicker to handle my popups. Other techniques 
(identified in the FAQ) in fact did not function for me -- at all -- which is 
why I used the code I did. Sowhat is the story?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4501messageID=12622#12622
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Fwd: Managing the Watir Project -- Wikipedia entry

2006-09-27 Thread Sun
A comment -- when substituting this:
===
#Ensure popup won't block Watir
ie.button(:name, btnG).click_no_wait
ie.dialog.button('OK').click
===

for this:

===
#Ensure popup won't block Watir
ie.button(:name, btnG).click_no_wait
#Handle the popup
hwnd = ie.enabled_popup(5)
if (hwnd) #yes there is a popup
   p hwnd
   w = WinClicker.new
   w.makeWindowActive(hwnd)
   w.clickWindowsButton_hwnd(hwnd, Yes)
end
===

I get the following error:
  1) Error:
test_search(TC_article_example):
NoMethodError: undefined method `dialog' for #Watir::IE:0x27e62e0

So while the code I posted in wikipedia may not be the prettiest -- it DOES 
work -- and works reliably.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4501messageID=12545#12545
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Formatting Excel Column Width

2006-09-27 Thread Sun
Thank you. So I did access the link, download the extended MS help, and 
accessed VBAXL10.CHM. I found a method called AutoFit. 

===
#Format workbook columns
worksheet.range(b1:b4).Interior['ColorIndex'] = 36 #pale yellow
worksheet.range(b:b).AutoFit
===

However, because I was originally working with a CSV file, the above approach 
doesn't quite work. It requires changing the code to something like:

===
#open spreadsheet
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Add
worksheet = workbook.Worksheets(1)
worksheet.SaveAs(spreadsheet.xls)

#Log results
worksheet.range(a1).value = executionEnvironment
worksheet.range(b1).value = Acceptable Screen1 time
worksheet.range(c1).value = acceptableScreen1.to_s
worksheet.range(d1).value = Actual Screen1 time
worksheet.range(e1).value = actualScreen1.to_s
worksheet.range(f1).value = resultValue
#
# Etcetera...assume the above happens 4 times, for 4 screens...
#
#Format workbook columns
worksheet.range(b1:b4).Interior['ColorIndex'] = 36 #pale yellow
worksheet.columns(b:b).AutoFit
#close the workbook
workbook.save
workbook.close
excel.Quit
===

Now this code will work just fine, AS LONG AS the file spreadsheet.xls 
actually exists as an Excel file. This is why the Add is done for workbooks, 
and then the SaveAs is done for the worksheet -- up front This way, the 
file is created and saved as an Excel spreadsheet. Thus when later the 
formatting is needed -- it works!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4494messageID=12553#12553
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Formatting Excel Column Width

2006-09-26 Thread Sun
 Sun wrote:
  So I can open the csv file as an Excel file and
 make a format change (turn the 2nd column yellow.)
 But -- I cannot find anywhere, on any forum, or the
 Ruby online documentation, how to autofit the
 column to the text.

 Chris Morris has a link in the RubyGarden page that
 has been frequently 
 mentioned on this list to a the excel documentation.
 Did you install this? Did you search it? This is
 fundamentally an excel 
 question, not a Ruby question.
 
 If you know the excel method that you need to call,
 we can help you do 
 that in Ruby.
 
 Bret
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 

Do you mean this link here?: 
http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel
But in fact it does not provide that information.
As for the Excel method, if you did it manually it would be 
Format/Column/Autofit Selection
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4494messageID=12469#12469
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Managing the Watir Project -- Wikipedia entry

2006-09-26 Thread Sun
Regarding documentation, please see: http://en.wikipedia.org/wiki/Watir

I have updated this by creating an example information section, plus updating 
the base note, and adding links to External Links and See Also.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4501messageID=12470#12470
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Formatting Excel Column Width

2006-09-22 Thread Sun
Technically this is a Ruby question but...since it is useful to record test run 
timing information in Excel format, I think it is relevant to this forum. The 
question is...suppose I write out some test output that looks like this:
===
Test,   Acceptable log in time, 5,  Actual time to log in,  1.683,  OK
Test,   Acceptable admin screen access time,5,  Actual admin screen 
access time,3.235,  OK
Test,   Acceptable user search time,5,  Actual user search time,
2.804,  OK
Test,   Acceptable user info time,  5,  Actual user info time,  1.923,  
OK
===

So, it went through 4 screens. The environment is Test. 2nd column describes 
acceptable time, 3rd column specifies that time, 4th column states actual time, 
5th column is actual time, last column will be OK or NotOK, depending on 
whether actual exceeds expected.

So far, so good. However, I am simply opening and writing out to a CSV file, 
like so:
===
timeSpreadsheet.puts executionEnvironment + ,Acceptable user info time, + 
acceptableTimeDisplayUser.to_s + ,Actual user info time, + (endTime - 
beginTime).to_s + , + resultValue
===

No problems, however, the column widths in the resulting file, when opened by 
Excel, are the standard 8 character columns. Obviously then, when the file is 
opened, much of the descriptive text in columns 2 and 4 is hidden. So the 
question is twofold:
(a) Is it possible, when writing to a CSV file, to do so in such a way that 
when Excel opens the file, it will automatically widen the columns to fit? (I 
think no.)
(b) What then, would be the Excel command, to adjust the column to fit? I can 
do this:
===
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Open(../PC/ + Time.now.strftime(%d-%b-%y) + 
.csv)
worksheet = workbook.Worksheets(1) #get hold of the first worksheet
#Format workbook columns
worksheet.range(b1:b4).Interior['ColorIndex'] = 36 #pale yellow
# How do I widen the 2nd column?
workbook.save
workbook.close
excel.Quit
===
So I can open the csv file as an Excel file and make a format change (turn the 
2nd column yellow.) But -- I cannot find anywhere, on any forum, or the Ruby 
online documentation, how to autofit the column to the text.

And -- no, I do not want to add someones alphaware library if possible, I want 
to use straight old WIN32OLE. Is this possible?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4494messageID=12320#12320
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Disclaimer

2006-09-19 Thread Sun
I would be open to helping with the documentation.

I think part of the effort is not just upgraded documentation, but the 
organizational perspective fof the documentation.

For a single example -- is the base or root for documentation the 
http://wtr.rubyforge.org/ site? As it happens, the user guide there recommends 
accessing the development version by doing Download the Watir tarball from the 
WTR RubyForge site (click download tarball) -- but that link is dead. Plus, I 
think we want people to follow the gem installation?

Or -- is the root the http://wiki.openqa.org/display/WTR/Project+Home site? So 
there are two sources for documentation but they are not identical.

The user guide talks about IRB, but FreeRIDE is distributed with the standard 
Ruby one click installer, and people are more likely to be developing WATIR 
scripts in that than in IRB I think -- the user guide could stand to be 
upgraded, and not just for WATIR specific material.

The FAQ could stand to be strongly expanded, based on the number of questions 
asked and resolved in the openqa forum or mailing list archives. And so on.

I am willing to help with the documentation as time permits.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4344messageID=12005#12005
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Driving Javascript

2006-09-18 Thread Sun
 Well...
  (1) There should be documentation that specifically
 states how to drive a Javascript -- as in, use
 .link(:url, path)
  (2) It should point out that it is driven by
 click, not fire_event('onclick').
  (3) Actually, there should be documentation that
 identifies all of the available API's, and provide
 examples for each. Right now the Watir User Guide is
 too simple. It doesn't handle real world situations.

 I believe most of this is documented in the API
 Documentation.
 http://wtr.rubyforge.org/rdoc/index.html

OK, not to be negative, but surely you're joking.
Have you looked at that page? It is completely bassackwards when you are trying 
to find something. It is organized top down, hierarchically, and has no search 
feature.

So...if I want to go to the rightmost list and look at each and every 
method...some are well documented others not so documented.

But let's take this example: 
ie.frame(top_frame).link(:url,javascript:Events.invokeEvent(\'2_11_act\')).click
Now, the rdoc for frame says:
===
Typical usage:

  ie.frame(:index, 1)
  ie.frame(:name , 'main_frame')
  ie.frame('main_frame')
===
Good enough. But does it say I can do ie.frame(top_frame).link? No. Is link 
listed as a Method? Why yes it is...if I knew that method was what was required 
here, that would be useful -- but since in the code, the Javascript is not 
associated with an HREF, it is not obvious that I need a link -- or even that 
there is a method called link. So I have to scroll through all methods hunting 
and checking. And even then -- I have to take a big guess because the typical 
usage says:
===
Typical Usage

  ie.link(:url, /login/)  # access the first link whose url matches 
login. We can use a string in place of the regular expression
  # but the complete path must be used, 
ie.link(:url, 'http://myserver.com/my_path/login.asp')
  ie.link(:index,2)   # access the second link on the page
  ie.link(:title , Picture) # access a link using the tool tip
  ie.link(:text, 'Click Me')  # access the link that has Click Me as 
its text
  ie.link(:afterText, 'Click-')  # access the link that immediately 
follows the text Click-
===
See? Nothing about Javascript in there. Which there should be -- since this is 
a pretty common Javascript situation I think. So even if there WAS a search 
feature -- it wouldn't have hit on this. So as I result I basically wade 
through the forum, trying this and that.

Look, I am not complaining about the work that has been done -- a number of 
people have done an excellent job with Watir. What I am saying is that if 
Testers are to use Watir, some much better documentation needs to be developed. 
As it happens, I am working up documentation as I go through this and learn 
Watir, and eventually that may be of use, but...it doesn't help me now! ;-)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4171messageID=11912#11912
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Driving Javascript

2006-09-18 Thread Sun
BTW -- once you KNOW that link is the way to go, links will reveal the 
JavaScripts. As in:
ie.frame(top_frame).links.each { |l| puts l.to_s }
And that's the secret.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4171messageID=11914#11914
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Driving Javascript

2006-09-14 Thread Sun
When I execute:
ie.goto(javascript:Events.invokeEvent('2_11_act')) 
in FreeRIDE the script gets to that point and hangs.
When I CTRL-C it (in the terminal window) the error is:
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1081/./watir.rb:1752:in `sleep': 
Interrupt
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1081/./watir.rb:1752:in 
`wait'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1081/./watir.rb:1614:in 
`goto'

Therefore, to see if there is a change in indication, I execute this in a 
command window as:
ruby PC2.rb
The result is identical. Script hangs until I do CTRL-C in the command window.
To validate it was hanging on the attempted invokation, I made a very simple 
script that just attached to the window and attempted the invokation with some 
print statements.
Results are:
Attempting to attach
Completed attach
Attempt javascript invokement
[CTRL-C here after waiting a minute]
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1081/./watir.rb:1752:in `sleep'
Press ENTER to close the window...

Here's the script:

require 'watir'

  # Open the IE browser
  p Attempting to attach
  ie = Watir::IE.attach(:url, 
'https://somewhere.com/policycenter_ch4/pc/PolicyCenter.do')
  p Completed attach
  #ie.cell(:id, '2_11_act').fire_event('onclick')
  p Attempt javascript invokement
  ie.goto(javascript:Events.invokeEvent('2_11_act'))
  p Attempt completed
  #ie.close
===

So...any other ideas?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4171messageID=11510#11510
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Driving Javascript

2006-09-14 Thread Sun
Bit more info.
1st, the javascript in question exists within a nested table structure (this is 
table #5) within a frame. I can actually make the text that is displayed in the 
table cell flash (with this):

ie.frame(top_frame).table(:index, 5)[2][2].flash

And I can actually make it highlight yellow when it is clicked with this:

ie.frame(top_frame).table(:index, 5)[2][2].fire_event('onclick')

however not with this:

ie.frame(top_frame).table(:index, 5)[2][2].click

BUT! Neither the fire_event('onclick') nor the simple click actually CLICK on 
the darn cell to activate the javascript within! Grrr!

Anyone have any suggestions?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4171messageID=11522#11522
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Driving Javascript

2006-09-14 Thread Sun
 Sun wrote:
 Anyone have any suggestions?
 
 Send us the html for the entire lt;tdgt; tag. You've only
 posted a fragment.

OK. But since it is 5 tables deep...and very complex, I will just post the 
table involved:
===
lt;table cellpadding=0 cellspacing=0 border=0gt;
lt;trgt;lt;td rowspan=2 nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=5 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_l_corner_on.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td class=pix_on nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=1 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_r_corner_on.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td rowspan=2 nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=5 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_l_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=1 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_r_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td rowspan=2 nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=5 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_l_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=1 height=1/gt;lt;/tdgt;

lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_r_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td rowspan=2 nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=5 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_l_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=1 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_r_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td rowspan=2 nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=5 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_l_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;td class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/trans_pixel.gif; 
width=1 height=1/gt;lt;/tdgt;
lt;td rowspan=2 class=off nowrap=truegt;lt;img 
src=https://somewhere.com/pc_ch4/pc/resources/images/tab_r_corner_off.gif; 
width=12 height=23 border=0/gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td class=on 
nowrapgt;lt;scriptgt;menuStart(TAB_MENU_ON,'DESlt;ugt;Klt;/ugt;TOP','javascript:Events.invokeEvent(\'2_5_act\')','DESKTOP','DesktopTab');
registerMenuShortcut('K');
menuItem('My Activities','javascript:Events.invokeEvent(\'2_6_act\')',false,'My 
Activities','DesktopTab_Activities');
menuItem('My 
Submissions','javascript:Events.invokeEvent(\'2_7_act\')',false,'My 
Submissions','DesktopTab_Submissions');
menuItem('My Renewals','javascript:Events.invokeEvent(\'2_8_act\')',false,'My 
Renewals','DesktopTab_Renewals');
menuItem('My Policy 
Changes','javascript:Events.invokeEvent(\'2_9_act\')',false,'My Policy 
Changes','DesktopTab_PolicyChanges');
menuItem('My Queues','javascript:Events.invokeEvent(\'2_10_act\')',false,'My 
Queues','DesktopTab_AssignableQueues');
menuEnd();
lt;/scriptgt;lt;/tdgt;lt;td class=off 
nowrapgt;lt;scriptgt;menuStart(TAB_MENU_OFF,'Alt;ugt;Clt;/ugt;COUNT','javascript:Events.invokeEvent(\'2_11_act\')','ACCOUNT','AccountTab');
registerMenuShortcut('C');
lt;/scriptgt;lt;div id=2_12 class=menu_item_findgt;lt;table border=0 
cellspacing=0 cellpadding=0gt;lt;trgt;lt;td class=menu_item_find 
valign=center nowrap=truegt;Acct #:lt;/tdgt;lt;td 
class=menu_item_find valign=center nowrap=truegt;lt;input value= 
type=text class=txt smokeId=AccountNumberSearchItemWidget_TextValue 
id=2_1 delayOnChange=false helpText=__UseTitle__ contenteditable=true 
label= onfocus=EventHandlers.onFocus() onChange=if 
(EventHandlers.valueChanged(this)==false) return false; style=text-align: 
left onKeyDown= size=12 name=2_1 
onblur=EventHandlers.onBlur()gt;lt;/tdgt;lt;td class=menu_item_find 
valign=center nowrap=truegt;  lt

Re: [Wtr-general] Handling (Browser Security Driven?) Modal Dialog

2006-09-13 Thread Sun
OK thank you again. Can you tell me -- where to find good documentation on Ruby 
libraries like WinClicker? I see a lot of basic Ruby language 
documentation...but not much on libraries (if that is the right word.) 
Actually, if I do gem list I see several win32-* gems...I presume the 
WinClicker functionality is stashed in one of them?

So -- where would I find some good documentation on WinClicker functionality?  
I have found what appears to be some winclicker.rb source here:
http://www.koders.com/ruby/fidC4F5215E09DBE47F8274573746C1AF531C6F8FB4.aspx?s=cgi
But no specific documentation.

Also -- is the security popup is Javascript generated? Because it looks like 
the generic one tossed by the IE browser when moving between secure and 
nonsecure zones.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11418#11418
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Driving Javascript

2006-09-13 Thread Sun
I have a piece of Javascript that I need to invoke via Watir. Here is the 
Javascript code:


td class=off nowrap 
scriptmenuStart(TAB_MENU_OFF,'AuC/uCOUNT','javascript:Events.invokeEvent(\'2_11_act\')','ACCOUNT','AccountTab');
registerMenuShortcut('C');
/script


Now if this was a Javascript link I know I could do:
ie.link(:url,javascript:Events.invokeEvent(\'2_11_act\')).fire_event('onclick')
but it isn't, so this won't work.
Obviously what I need to do is to invoke an Event labelled 2_11_act -- but 
I don't have any idea how to do this.

I also tried:
table = ie.table(:index, 5)
tab_cell = table.cell(:text, '2_11_act')
tab_cell.click
since the above script existed within a cell within a table nested 5 levels 
deep  but -- that didn't work either. It couldn't find it. Error was:
Watir::Exception::UnknownObjectException: Unable to locate object, using index 
and 5

Suggestions?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4171messageID=11457#11457
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling (Browser Security Driven?) Modal Dialog - Resolved

2006-09-12 Thread Sun
Problem resolved.
First -- I don't actually know if this is, or is not, a modal dialog, since the:
if (modal = ie.modal_dialog(:hwnd, hwnd))
statement cannot be parsed (because apparently, even in the 1081 code branch 
the :hwnd parameter is not recognized for this method call.)

However, I resolved the problem by brute force (non elegantly.) This is how I 
did it.
===
require 'watir'
require 'test/unit'
class TC_article_example  Test::Unit::TestCase
def test_search
  # open the IE browser
  ie = Watir::IE.new
  # steer to google
ie.goto('http://www.google.com/')
  # load the search field
ie.text_field(:name, q).set(pickaxe)
  #Ensure popup won't block Watir
  ie.button(:name, btnG).click_no_wait
  #Handle the popup
  hwnd = ie.enabled_popup(5)
  if (hwnd) #yes there is a popup
   p hwnd
   w = WinClicker.new
   w.makeWindowActive(hwnd)
   w.clickWindowsButton_hwnd(hwnd, Yes)
  end
  # insert pause or it doesn't work...
  sleep 3
  # Validate response
  assert(ie.pageContainsText(Programming Ruby))
  end
end
===
The key things.
1st, I used the click no wait feature: ie.button(:name, btnG).click_no_wait
2nd, I made use of the new enabled_popup functionality to get hwnd.
3rd, I used WinClicker to access and kill the security popup
4th and finally, I had to insert that sleep statement or...it would fail with 
this error on the assert call: nil is not true. Why this should occur I 
don't know and I find troubling...perhaps someone can explain why this works.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11336#11336
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling (Browser Security Driven?) Modal Dialog

2006-09-11 Thread Sun
 Sun,
 
 If the window only has the title Internet Explorer
 then it's not likely that it's a modal dialog. This sounds more
 like an IE warning dialog, which is quite different.
 
 I cannot duplicate that warning box on my copy of IE,
 probably because I previously unchecked the box in the warning so I
 wouldn't see it again.
 
 Here are some ways you should be able to proceed:
 
 First, run the same series of events manually in IE.
 When you get the popup after clicking the Google Search button see
 if there is a checkbox you can uncheck so that warning will no
 longer pop up. Then you won't have to handle it at all.


Yes...the problem I have is that I have a corporate browser. I have in fact 
checked this so that it should not reappear but it does anyway. Corporate IT 
doesn't let us change the security levels for the browser so...that is probably 
why the popups are forced.


 Second, here is how I've handled that type of popup
 before:
 
 # Change the click to click_no_wait so that any popup
 won't block Watir
 ie.button(:name, btnG).click_no_wait
 
 hwnd = ie.enabled_popup( 10 ) # wait up to 10 seconds
 for a popup to appear
 if( hwnd ) # there is a popup of some kind.
 if( ie2 = ie.modal_dialog(:hwnd, hwnd) ) # if it's a
 modal dialog
 ie2... # do normal Watir stuff on the modal dialog
 else
 wc = WinClicker.new
 wc.clickWindowsButton_hwnd(hwnd, OK) # close
 non-modal popup with 
 Handle=hwnd
 end
 end
 
 David Schmidt
 
OK, thank you for the suggestion. I have implemented it. Problem now is, I get 
this message:
undefined method `enabled_popup' for #Watir::IE:0x2c61aa4

Presumably I am missing a library somewhere? I should be requiring something 
that I am not?
But as I mentioned in the base note, I have installed the current Ruby 
(1.8.4-20 stable), and the development gem for Watir (watir-1.5.1.1065.gem) 
so...here is the complete script text (which I am running in freeride):
===
#
# demo test for the WATIR controller   
#  
#  Simple Google test written by Jonathan Kohl   10/10/04  
# Purpose: to demonstrate the following WATIR functionality:   
#   * entering text into a text field  
#   * clicking a button
#   * checking to see if a page contains text. 
# Test will search Google for the pickaxe Ruby book
#
#-

require 'watir'   # the watir controller

# Main application code follows
#

   # 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.
   
   # Added flashes...
   ie.text_field(:name, q).flash
   ie.button(:value, Google Search).flash

   puts Step 2: enter 'pickaxe' in the search text field
   ie.text_field(:name, q).set(pickaxe)   # q is the name of the search 
field
   puts   Action: entered pickaxe in the search field
   
   #Ensure popup won't block Watir
   ie.button(:name, btnG).click_no_wait

   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.
   
   #Handle the popup
   hwnd = ie.enabled_popup(5)
   if (hwnd) #yes there is a popup
 if (modal = ie.modal_dialog(:hwnd, hwnd)) #and if it is modal
   puts(modal.to_s)
   modal.button(:value, Yes).click
else
  wc = WinClicker.new
  wc.clickWindowsButton_hwnd(hwnd, OK) #close nonmodal popup via handle
end
  end
   
   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 Exit
# -end of simple Google search test
===

Note that if I put the popup handler in front of Step 3 the results are 
identical, it is just that it hangs before step 3 instead of after it. Question 
-- where would the enabled_popup method be located? Isn't this in the watir 
development gem?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11241#11241
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling (Browser Security Driven?) Modal Dialog

2006-09-11 Thread Sun
One more thing...just so you know, when I puts $LOAD_PATH here is the library 
info:
===
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir/win32ole
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/bin
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/.
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
===
So as can be seen I do have the Watir 1.5 material in my path. 
So perhaps there is an additional require that is needed beyond require 
'Watir' ?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11243#11243
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling (Browser Security Driven?) Modal Dialog

2006-09-11 Thread Sun
Also, if I recode it like this:
===
require 'watir'
require 'test/unit'
class TC_article_example  Test::Unit::TestCase
def test_search
  # open the IE browser
  ie = Watir::IE.new
  # steer to google
ie.goto('http://www.google.com/')
  # load the search field
ie.text_field(:name, q).set(pickaxe)
  #Ensure popup won't block Watir
  ie.button(:name, btnG).click_no_wait
  #Handle the popup
 hwnd = ie.enabled_popup(5)
   if (hwnd) #yes there is a popup
 if (modal = ie.modal_dialog(:hwnd, hwnd)) #and if it is modal
   puts(modal.to_s)
   modal.button(:value, Yes).click
else
  wc = WinClicker.new
  wc.clickWindowsButton_hwnd(hwnd, OK) #close nonmodal popup via handle
end
  end
  # click search button
  ie.button(:name, btnG).click
  # Validate response
  assert(ie.pageContainsText(Programming Ruby))
  
  end
end
===
I still get this:
  1) Error:
test_search(TC_article_example):
NoMethodError: undefined method `enabled_popup' for #Watir::IE:0x2764a60
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11245#11245
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Handling (Browser Security Driven?) Modal Dialog

2006-09-07 Thread Sun
I have a popup titled simply Internet Explorer containing the text: When you 
send information to the Internet, it might be possible for others to see that 
information. Do you want to continue? There are two buttons, labeled Yes and 
No.

I am unable to attach to this like so: ie2 = Watir::IE.attach(:title, ‘Internet 
ExplorerÂ’), or by doing: ie2 = Watir::IE.attach(:title, /Internet/). This made 
me suspect this was a modal dialog (besides the fact that it acts like one 
functionally.)

This pops up, by the way, when I execute the script googleSearch.rb (you know, 
the pickaxe script referenced in the Watir user guide.) It happens after the 
script sends the click to the Google Search button.

So...I uninstalled Watir 1.4.1, downloaded the current 1.5 gem (currently 
watir-1.5.1.1065.gem) and installed the gem. So far so good. This was to gain 
modal dialog processing functionality.

I then inserted this statement: ie.modal_dialog.button(:text, Yes).click
immediately after these 3 lines in the script:
=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.

No good. After step 2 completes (pickaxe loaded into google search field) I see:
Step 3: click the 'Google Search' button
  Action: clicked the Google Search button.
Modal Dialog not found. Timeout = 2.0
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:2606:in `locate'
Press ENTER to close the window...

Now, my BELIEF is that the reason this occurs is that this dialog popup is not 
launched by Javascript from the current IE session -- but rather is triggered 
by IE security. Which since I am testing a corporate browser I cannot alter. So 
-- has anyone dealt with this before? I haven't seen any postings in this forum 
or elsewhere on the web about dealing with Browser security generated 
dialogs

Has anyone dealt with this standard security modal dialog before? If so, what 
should I add to that simple googleSearch.rb to get past it automatically?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4012messageID=11008#11008
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general