Re: [Wtr-general] Selecting controls in a dialog box

2007-07-11 Thread Matt Berney
It seems like I am having troubles with Ruby v1.8.5 and the modal_dialog 
support.  Should I roll back to 1.8.2-14?  I was reading a post by Bret the 
other day saying that there may be issues with newer versions of Ruby.

I am using:
  ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
  watir 1.5.1.1192

irb(main):006:0* b.modal_dialog.title
NoMethodError: IE#modal_dialog not supported with the current version of Ruby 
(1.8.5).
See http://jira.openqa.org/browse/WTR-2 for details.
undefined method `connect_unknown' for WIN32OLE:Class
from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:28
27:in `initialize'
from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32
5:in `new'
from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32
5:in `modal_dialog'
from (irb):6
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Selecting controls in a dialog box

2007-07-11 Thread Matt Berney
No way!!! It works!!!

Uninstalling 1.8.5 and installing 1.8.2-15 worked like a champ!!!
This required installing gem watir-1192 as well as installing gem win32-process.

But other than that, it works just as advertised...

ie = Watir::IE.attach(:url,/ticket.aspx/)
ie.button(:name,button).click == opens modal dialog
ie.modal_dialog.select_list(:id,comboBox).select(item)
ie.modal_dialog.text_field(:id,text).set(Comments)
ie.modal_dialog.button(:name,btnContinue).click

Thanks again for all the help!!!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Having problems figuring out what to click

2007-07-09 Thread Matt Berney
Excellent!!! 
That did the trick.  
Thanks loads!!!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Selecting controls in a dialog box

2007-07-09 Thread Matt Berney
When I click a button on the web page, it displays a dialog.

Title: Web Page Dialog
Controls:
  * one select list
  * one text field
  * two buttons (OK, Cancel)

How do I access the dialog box?
How do I select an item from the list?  Do I use the 
Watir::IE.select_list.getAllItems() call?
How do I enter data in the text field?
How do I click on the buttons?

Thanks in advance.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] not able to click ok for the pop up , after a selection from select lis

2007-06-07 Thread matt
It may be a general winClicker issue.  I found that in order to get the 
winClicker to work, the getWindowHandle() had to perform an exact match.  This 
is because many of the IE windows had the same Microsoft Internet Explorer 
text in the title.  As a result, the incorrect window handle was returned. And 
no ok button was present.  The behavior that resulted was that the javascript 
popup window would not dismiss.

winClicker.rb, line 236
  ### MCB 3/7/2007 *exact match*
  if title == textCaption[1].to_s

This worked for me :-)
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] screen_capture filename

2007-04-12 Thread Matt Makins
Hi Charley,

 

Thanks for that.

 

Regarding the omission of curly braces, I didn't think they were required
when referencing a global or instance variable.

According to the ruby pickaxe book anyway ;)

 

Cheers,

Matt

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 11 April 2007 20:08
To: [EMAIL PROTECTED]
Subject: Re: [Wtr-general] screen_capture filename

 

This is probably some code that needs to be yanked out and put in contrib. I
haven't used it and have yet to hear anyone else using it although I'm sure
there are some. You might take a look at Aslak Hellesoy's screenshot
library.
http://blog.aslakhellesoy.com/2006/12/2/getting-screenshots-from-watir
which might make sense to include in Watir vs the screen_capture library
since his implementation has unit tests. You can enter a ticket for that in
Jira if you'd like. As far as the current function, taking a brief look at
it, you've not included curly brackets for evaluation on the time.jpg
variable, you might try the following: 

screen_capture(
mailto:C:[EMAIL PROTECTED]
ime.jpg
C:[EMAIL PROTECTED] ,
true, false) 

 or this: 

screen_capture(
mailto:C:[EMAIL PROTECTED]
ime.jpg  C:/InstantRails/rails_apps/watir_tests/public/images/[EMAIL 
PROTECTED]
, true, false) 

which should get converted into the same thing. 

 

-Charley  

 

On 4/11/07, Matt Makins [EMAIL PROTECTED] wrote:

i am using the screen_capture function which i have working correctly.

 

How do i specify the path where i want to save the image file?

 

screen_capture(
mailto:C:[EMAIL PROTECTED]
ime.jpg  C:[EMAIL PROTECTED] ,
true, false)

 

this doesn't work, anybody tried this??

 

Cheers,

Matt


___
Wtr-general mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/wtr-general

 

___
Wtr-general mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] screen_capture filename

2007-04-11 Thread Matt Makins
i am using the screen_capture function which i have working correctly.

 

How do i specify the path where i want to save the image file?

 

 
screen_capture(C:[EMAIL PROTECTED]
jpg , true, false)

 

this doesn't work, anybody tried this??

 

Cheers,

Matt

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Pass data to tests

2007-03-28 Thread matt
This may be more of a test/unit question than a watir question...

I have a test case, based on the Test::Unit::TestCase.  How does one pass data 
to the test in such a way that the test can be run multiple times with 
different data.

For example:

class TC_CreateOrder  Test::Unit::TestCase
  def test_NewOrder
assert order successful
  end
end

Now, I want to be able to generate a new order for various order types, (TYPE1, 
TYPE2, TYPE3, etc.)

class TS_OrderTests
def self.suite
suite = Test::Unit::TestSuite.new
suite  TC_CreateOrder.suite # TYPE1 goes here
suite  TC_CreateOrder.suite # TYPE2 goes here
suite  TC_CreateOrder.suite # TYPE3 goes here
return suite
end
end

Test::Unit::UI::Console::TestRunner.run(TS_OrderTests)


How do I pass the order type to the test, such that the test runs multiple 
times, once for each order type.

Thanks in advance.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir 1.5..1..1158 installation

2007-03-27 Thread matt
You must have the watir gem file for 1158 (watir-1.5.1-1158.gem) in the current 
working directory.  Then you can execute 'gem install watir'.

Hope this helps.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Seemingly bogus error in simple script

2007-03-07 Thread matt
I am a new user to ruby/watir as well...maybe we can get through this together 
:)

Basically, I did the same thing...launch irb and type commands to see what 
happens.  It was my experience that if it worked in irb, it worked in the 
script.  However, I am using ie6.  I haven't tried ruby/watir with ie7 yet...

In irb, try using the ie.show_all_objects.  This generates a table of all the 
objects on the current page.  This was helpful for me to build the list of 
objects for my script.

Maybe using a later version of watir is required?  I am using 1.5.1.1158.

ruby -e 'require watir; puts Watir::IE::VERSION'
1.5.1.1158

ruby --version
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]

 I'm brand new at this.
 
 I've created a very simple script to test a login
 page...
 
 require 'watir'
 
 ie = Watir::IE.start(http://mysite;)
 
 ie.text_field(:name, j_username).set(blah)
 ie.text_field(:name, j_password).set(blah)
 ie.button(:value, Submit).click
 
 If I execute these commands manually in irb, I have
 no problem.
 
 If I execute the script that contains them from the
 command line, I get this error:
 
 c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:
 1928:in `assert_exists': Unable to locate object,
 using name and j_username
 (Watir::Exception::UnknownObjectException)
 from
 c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:
 3382:in `set'
 from Z:/Customers/Beneplace/Beneplace
  Redesign/WATIR tests/admin-login.rb:5
 
 Even though I get the error, the actions occur - the
 text is entered into the text boxes, the button is
 clicked, and I see the next page.
 
 If I put additional commands AFTER the click, they do
 not get executed.
 
 This is being used with a JSP page, if that makes any
 difference, and IE7.
 
 Thanks for any help.
 
 Steven
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6823messageID=19647#19647
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Problems mapping to: http://forums.openqa.org/post!default.jspa?forumID

2007-03-07 Thread matt
Seems to be a common problem.  If I click on the link referenced in the 
previous post, then it works fine.  However, if I open a new browser and paste 
in the url, then an Operation aborted error occurs and the page does not 
display.


 Please note...clicking on this link from within this
 forum ...maps fine. 
 
 To duplicate my problem, I have to open a new IE
 browser and enter paste the URL in there. That's when
 I get my error. 
 
 It looks to me like something isn't mapping right
 somewhere.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6828messageID=19657#19657
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'ie.close' or 'ie.close if ie'

2007-03-06 Thread matt
Hello,

I am new to Ruby/watir ... so forgive me plz.

After reading through the ie window threads, I am still puzzled how to create 
a single ie browser for my test.  Questions:

1) If there is one browser instance for the test, how is one to close the 
browser at the end of the test?  Should a test_closebrowser() method be created 
at the end?

2)  When using this example, I am finding that the @ie instance variable is nil 
at the beginning of each test method.  Isn't the instance variable supposed to 
be persistent throughout all of the tests?

3) I looked through the examples, but couldn't find an example of the 
IE.attach() method.  Should I keep track of the window handle when the instance 
is created and just reference that throughout the test?

Thanks in advance



Here is a simple example

require 'watir'
require 'test/unit'

class My_TestCase  Test::Unit::TestCase

  # Instance variables
  @ie = nil

  def test_01_initialtest
# create a new browser for the test (if necessary)
@ie = Watir::IE.new if @ie == nil

# do some work ...
  end

  def test_02_secondtest
  # create a new browser for the test (if necessary)
 @ie = Watir::IE.new if @ie == nil

# do some work ...
  end
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6562messageID=19604#19604
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] pop up box

2006-12-11 Thread Matt Makins
Thanks, it's on hold at the moment.  I used the winclicker clickJSDialogue
method and ran it has a separate process, however it didn't seem to find the
window.

I'll have to give it some more time.

 

Cheers,

Matt

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cain, Mark
Sent: 11 December 2006 16:25
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] pop up box

 

Did you get this solved?

 

--Mark

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Makins
Sent: Thursday, December 07, 2006 4:24 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] pop up box

 

 

Hi,

 

I have a pop up box that appears on a web page, just a IE window with a 'OK'
button.

How do I access the pop up box and click the 'OK' button.

 

I have tried WinClicker.

 

Thanks,

Matt

 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] pop up box

2006-12-07 Thread Matt Makins
 

Hi,

 

I have a pop up box that appears on a web page, just a IE window with a 'OK'
button.

How do I access the pop up box and click the 'OK' button.

 

I have tried WinClicker.

 

Thanks,

Matt

 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Javascript Problem....

2006-11-24 Thread Matt Makins
Once you are logged in use 

ie.goto('http://example.com/example.html')

to go directly to another page.

this will only work if you are authorized to view this page.

Cheers,
Matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of san
Sent: 24 November 2006 11:38
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Javascript Problem

 Is There Any Way To Directly Go To The Page After Logged In... I Don't
Want To See The 1st page  The Data That Are Entered Will It Save A
Little Bit Of Time?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5425messageID=15123#15123
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Matt Johnson
Thank you, adding include Win32 worked. -- MattJOn 10/9/06, Cain, Mark [EMAIL PROTECTED] wrote:

You could also just put include Win32 right above thedef enabled_popup(timeout=4) in /watir/contrib/enabled_popup.rb--Mark-Original Message-From: 
[EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of David SchmidtSent: Saturday, October 07, 2006 7:07 PMTo: 
wtr-general@rubyforge.org; [EMAIL PROTECTED]Subject: Re: [Wtr-general] _javascript_ Alert windowsMatt,The problem is that when the enabled_popup method was removed from
watir.rb the definitions for GetWindows() definition wasn't moved withit.Afterwards, the definition for GetWindows was moved in the watir.rbfile so that it is no longer found by enabled_popup.If you look in the 
watir.rb file for GetWindow and move thosedefinitions into the enabled_popup.rb file then it should work fine.David Schmidt-- [EMAIL PROTECTED]
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Javascript Alert windows

2006-10-06 Thread Matt Johnson
On 10/5/06, Cain, Mark [EMAIL PROTECTED] wrote:
The _javascript_ Alert, Confirm, Prompt, Security, File Save, File Download, File Upload, error message, and login (I think this is a complete list but there may be others) are all a special type of modal popup dialog window—there isn't a different one. In order to handle these types of popups you have to start another thread independent of your $ie thread OR you have to not block the process by using click_no_wait.
There are two ways (that actually both use the WInClicker). The first one is listed below that works with the older versions of Watir. The second (I have found after using them both) is more reliable than the first but require you having a Watir version greater than 1079 because of some fixes to click_no_wait (can't remember the exact version). You can get them here: 
http://wiki.openqa.org/display/WTR/Development+Builds 

First method (works with Watir 1.4.x):def jsAlert(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
Then, before the button you want to click that generates the popup, add in:
jsAlert(OK, 3)ie.button(:name, woohoo).click
 # This is the button you want to click that generates the popup
Second Method (faster and more reliable):
require 'watir\contrib\enabled_popup'
Your code
$ie.button("Button Label Text").click_no_wait
# use click_no_wait to click the button that invokes the JS Alert $ie.button.click_no_wait
hwnd = ie.enabled_popup
(5) # get a handle if one exists
if (hwnd) 
# yes there is a popup
 w = WinClicker.new
 w.makeWindowActive(hwnd)# OK or whatever the name on the button is
 w.clickWindowsButton_hwnd(hwnd, OK) 
end
NOTE: If you are using IE7 then the title on the JS Alert box is different then IE6+ so you will need to alter you 
WinClicker.rb file for either method.\ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb Lines 113 and 144.
IE6 = Microsoft Internet Explorer
IE7 = Windows Internet Explorer
Hope this helps,

--Mark___Wtr-general mailing list
Wtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general
Hello,I have been trying to use the second method described above with no success. I am trying to clear a security dialog that appears after clicking a Sign In button. I can see that the button gets clicked, then the script blocks. If I kill the script ( by closing the browser, or whatever ) I get this error message:
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:10:in `enabled_popup': uninitialized constant Watir::PageContainer::GetWindow (NameError)	from c:/ruby/lib/ruby/gems/1.8/gems/watir-
1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in `wait_until'	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in `until_with_timeout'
	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `enabled_popup'	from C:/ruby/mattj/scanmus/scanmus3.rb:79Can anyone tell me what the problem is, or how I can debug this further? Why is this not initialized? Does that mean I have some kind of path or other environment problem. I am using WinXP SP2, ruby 
1.8.2 (2004-12-25) [i386-mswin32], watir 1.5.1.1100.Thanks in advance.-- MattJ[EMAIL PROTECTED] 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Disclaimer

2006-09-18 Thread Matt Johnson
Bret Pettichord wrote:
 Based on recent feedback, i am thinking that we need to add the 
 following information to the main Watir webpage at wtr.rubyforge.org:
 
   Watir 1.5 is currently under active development.
   However, it remains poorly documented. Users often have to read 
 through a confusing email archive to find solutions to common problems. 
 They also should understand HTML.
   Although developers understand it easily enough, testers are often 
 confused and frustrated by it.
   If you decide to use it anyway, you've been warned. Don't complain to 
 us about it.
  
 Comments please. I'm not joking.
 
 Bret
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general

Bret, this seems like a reasonable message to put on that page. It would 
help people understand what they are getting into.

-- Matt Johnson

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general